(client) fix:修复DefineManager没有解析数组类型的Define字段导致定义查找失败
This commit is contained in:
@ -53,7 +53,6 @@ namespace Entity
|
||||
aiTree = ConvertToAIBase(pawnDef.behaviorTree);
|
||||
affiliation = pawnDef.affiliation;
|
||||
InitBody(pawnDef.drawingOrder);
|
||||
|
||||
}
|
||||
|
||||
public virtual void InitBody(DrawingOrderDef drawingOrder)
|
||||
@ -71,8 +70,7 @@ namespace Entity
|
||||
if (drawNode == null) continue;
|
||||
var directionRoot = new GameObject(orientation.ToString());
|
||||
directionRoot.transform.SetParent(body.transform, false);
|
||||
|
||||
InitBodyPart(drawNode, directionRoot);
|
||||
InitBodyPart(drawNode, directionRoot,drawingOrder.texturePath);
|
||||
bodyNodes[orientation] = directionRoot;
|
||||
}
|
||||
currentOrientation = Orientation.Down;
|
||||
@ -85,31 +83,50 @@ namespace Entity
|
||||
}
|
||||
|
||||
// 递归初始化单个绘图节点及其子节点
|
||||
public virtual void InitBodyPart(DrawNodeDef drawNode, GameObject parent)
|
||||
public virtual void InitBodyPart(DrawNodeDef drawNode, GameObject parent,string folderPath)
|
||||
{
|
||||
if(drawNode==null) return;
|
||||
|
||||
GameObject nodeObject;
|
||||
switch (drawNode.drawNodeType)
|
||||
if (drawNode.nodeName == "noName")
|
||||
{
|
||||
case DrawNodeType.Image:
|
||||
nodeObject = Instantiate(imagePrefab.gameObject,parent.transform);
|
||||
break;
|
||||
nodeObject = new();
|
||||
nodeObject.transform.SetParent(parent.transform);
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (drawNode.drawNodeType)
|
||||
{
|
||||
case DrawNodeType.Image:
|
||||
nodeObject = Instantiate(imagePrefab.gameObject, parent.transform);
|
||||
var texture =
|
||||
Managers.PackagesImageManager.Instance.FindBodyTextures(drawNode.packID, folderPath,
|
||||
$"{drawNode.nodeName}_{currentOrientation}");
|
||||
var image = nodeObject.GetComponent<ImagePrefab>();
|
||||
image.SetSprite(texture[0]);
|
||||
break;
|
||||
|
||||
case DrawNodeType.Animation:
|
||||
nodeObject = Instantiate(animatorPrefab.gameObject,parent.transform);
|
||||
ITick tick = nodeObject.GetComponent<SpriteAnimator>();
|
||||
if (tick != null)
|
||||
bodyAnimationNode[currentOrientation].Add(tick);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
case DrawNodeType.Animation:
|
||||
nodeObject = Instantiate(animatorPrefab.gameObject, parent.transform);
|
||||
ITick tick = nodeObject.GetComponent<SpriteAnimator>();
|
||||
if (tick != null)
|
||||
bodyAnimationNode[currentOrientation].Add(tick);
|
||||
var textures = Managers.PackagesImageManager.Instance.FindBodyTextures(drawNode.packID,
|
||||
folderPath,
|
||||
$"{drawNode.nodeName}_{currentOrientation}");
|
||||
var animator = nodeObject.GetComponent<SpriteAnimator>();
|
||||
animator.SetSprites(textures);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
nodeObject.transform.localPosition = drawNode.position;
|
||||
nodeObject.name = drawNode.nodeName;
|
||||
// 递归初始化子节点
|
||||
foreach (var child in drawNode.children)
|
||||
{
|
||||
InitBodyPart(child, nodeObject);
|
||||
InitBodyPart(child, nodeObject,folderPath);
|
||||
}
|
||||
}
|
||||
public void Tick()
|
||||
|
Reference in New Issue
Block a user