From a662ecd2c9b773769968c1bbbde6c6e6d5ffbf25 Mon Sep 17 00:00:00 2001 From: zzdxxz <2079238449@qq.com> Date: Mon, 14 Jul 2025 17:57:27 +0800 Subject: [PATCH] =?UTF-8?q?(client)=20chore:=E4=BF=AE=E6=94=B9=E6=B8=B2?= =?UTF-8?q?=E6=9F=93=E6=A0=91=E5=AE=9A=E4=B9=89=E5=8A=A0=E8=BD=BD=EF=BC=8C?= =?UTF-8?q?=E5=85=81=E8=AE=B8=E9=BB=98=E8=AE=A4=E5=8A=A0=E8=BD=BD=20(#32)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: zzdxxz <2079238449@qq.com> Co-committed-by: zzdxxz <2079238449@qq.com> --- .../Scripts/Data/AttributesDefine.cs.meta | 2 +- Client/Assets/Scripts/Data/CharacterDefine.cs | 20 ++++++++++++------- Client/Assets/Scripts/Data/DefinePack.cs | 4 ++-- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Client/Assets/Scripts/Data/AttributesDefine.cs.meta b/Client/Assets/Scripts/Data/AttributesDefine.cs.meta index 76c19b5..33abf30 100644 --- a/Client/Assets/Scripts/Data/AttributesDefine.cs.meta +++ b/Client/Assets/Scripts/Data/AttributesDefine.cs.meta @@ -1,2 +1,2 @@ fileFormatVersion: 2 -guid: 9ff25140406bbd94499d6fb418c4add5 \ No newline at end of file +guid: 449907b94fa9f8742a43a61b7fc2e5dc \ No newline at end of file diff --git a/Client/Assets/Scripts/Data/CharacterDefine.cs b/Client/Assets/Scripts/Data/CharacterDefine.cs index 167902b..3c9abf0 100644 --- a/Client/Assets/Scripts/Data/CharacterDefine.cs +++ b/Client/Assets/Scripts/Data/CharacterDefine.cs @@ -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;; } } diff --git a/Client/Assets/Scripts/Data/DefinePack.cs b/Client/Assets/Scripts/Data/DefinePack.cs index 25e39cb..550229e 100644 --- a/Client/Assets/Scripts/Data/DefinePack.cs +++ b/Client/Assets/Scripts/Data/DefinePack.cs @@ -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);