(client) fix:修复定义链接不正确赋值的问题
This commit is contained in:
@ -8,13 +8,15 @@ using System.Xml.Linq;
|
||||
|
||||
namespace Data
|
||||
{
|
||||
public abstract class Define
|
||||
public class Define
|
||||
{
|
||||
public string defName;
|
||||
public string description;
|
||||
public string label;
|
||||
public string packID;
|
||||
|
||||
public bool isReferene=false;
|
||||
|
||||
/// <summary>
|
||||
/// 初始化方法,根据传入的 XML 元素 (<paramref name="xmlDef" />) 进行处理。
|
||||
/// </summary>
|
||||
@ -112,18 +114,5 @@ namespace Data
|
||||
return string.Join(Environment.NewLine, text.Split('\n').Select(line => prefix + line));
|
||||
}
|
||||
}
|
||||
|
||||
public class DefineReference : Define
|
||||
{
|
||||
public Define def;
|
||||
public string className;
|
||||
public string fieldName;
|
||||
|
||||
public DefineReference(string className, string defName, string fieldName)
|
||||
{
|
||||
this.defName = defName;
|
||||
this.className = className;
|
||||
this.fieldName = fieldName;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -262,8 +262,12 @@ namespace Data
|
||||
}
|
||||
else
|
||||
{
|
||||
value = new DefineReference(field.FieldType.Name, element.Value, field.Name);
|
||||
|
||||
var reference = (Define)Activator.CreateInstance(field.FieldType);
|
||||
reference.isReferene = true;
|
||||
reference.description=field.FieldType.Name;
|
||||
reference.label = field.Name;
|
||||
reference.defName = element.Value;
|
||||
value = reference;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -8,7 +8,7 @@ namespace Data
|
||||
{
|
||||
public class TileDef : Define
|
||||
{
|
||||
public string texturePath = "";
|
||||
public ImageDef texture;
|
||||
public string name = "";
|
||||
|
||||
public override bool Init(XElement xmlDef)
|
||||
@ -45,6 +45,12 @@ namespace Data
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class ImageDef : Define
|
||||
{
|
||||
public string path;
|
||||
public int wCount;
|
||||
public int hCount;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user