(client) chore:修改渲染树定义加载,允许默认加载 (#32)

Co-authored-by: zzdxxz <2079238449@qq.com>
Co-committed-by: zzdxxz <2079238449@qq.com>
This commit is contained in:
2025-07-14 17:57:27 +08:00
committed by TheRedApricot
parent 0c86730384
commit a662ecd2c9
3 changed files with 16 additions and 10 deletions

View File

@ -1,2 +1,2 @@
fileFormatVersion: 2
guid: 9ff25140406bbd94499d6fb418c4add5
guid: 449907b94fa9f8742a43a61b7fc2e5dc

View File

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Xml.Linq;
using UnityEditor.ShaderGraph.Internal;
@ -23,6 +24,7 @@ namespace Data
public class CharacterDef : Define
{
public CharacterAttributesDef attributes;
public string texturePath = null;
public DrawingOrderDef
drawingOrder_down,
@ -71,14 +73,18 @@ namespace Data
public override bool Init(XElement xmlDef)
{
base.Init(xmlDef);
foreach (var node in xmlDef.Elements("DrawNodeDef"))
{
var drawNode = new DrawNodeDef();
drawNode.Init(node);
drawNodes.Add(drawNode);
}
return true;
var nodes = xmlDef.Elements("DrawNodeDef");
if (nodes.Count() == 0)
return false;
foreach (var node in nodes)
{
var drawNode = new DrawNodeDef();
drawNode.Init(node);
drawNodes.Add(drawNode);
}
return true;;
}
}

View File

@ -153,7 +153,7 @@ namespace Data
}
}
private Define LoadDefineClass(XElement defineDoc,string className)
private static Define LoadDefineClass(XElement defineDoc,string className)
{
var assembly = Assembly.GetExecutingAssembly();
@ -211,7 +211,7 @@ namespace Data
return define;
}
public void DefaultInitDefine(Define define,XElement defineDoc,Type defineType)
public static void DefaultInitDefine(Define define,XElement defineDoc,Type defineType)
{
var fields = defineType.GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic);