diff --git a/Entity.cs b/Entity.cs index 4bb865e..1952ad6 100644 --- a/Entity.cs +++ b/Entity.cs @@ -26,9 +26,6 @@ public class Entity public bool inWorld = false; - public static Dictionary> alldefpropertys = - new Dictionary>(); - // entityDef属性,服务端同步过来后存储在这里 private Dictionary defpropertys_ = new Dictionary(); @@ -38,19 +35,20 @@ public class Entity public static void clear() { - alldefpropertys.Clear(); } public Entity() { - foreach(Property e in alldefpropertys[GetType().Name].Values) + foreach(Property e in EntityDef.moduledefs[GetType().Name].propertys.Values) { Property newp = new Property(); newp.name = e.name; - newp.properUtype = e.properUtype; newp.utype = e.utype; - newp.val = e.val; + newp.properUtype = e.properUtype; + newp.aliasID = e.aliasID; + newp.defaultValStr = e.defaultValStr; newp.setmethod = e.setmethod; + newp.val = newp.utype.parseDefaultValStr(newp.defaultValStr); defpropertys_.Add(e.name, newp); iddefpropertys_.Add(e.properUtype, newp); } diff --git a/KBEngine.cs b/KBEngine.cs index d1f8e19..96382bf 100644 --- a/KBEngine.cs +++ b/KBEngine.cs @@ -799,10 +799,7 @@ public void onImportClientEntityDef(MemoryStream stream) ScriptModule module = new ScriptModule(scriptmethod_name); EntityDef.moduledefs[scriptmethod_name] = module; EntityDef.idmoduledefs[scriptUtype] = module; - - Dictionary defpropertys = new Dictionary(); - Entity.alldefpropertys.Add(scriptmethod_name, defpropertys); - + Type Class = module.script; while(propertysize > 0) @@ -833,11 +830,12 @@ public void onImportClientEntityDef(MemoryStream stream) Property savedata = new Property(); savedata.name = name; + savedata.utype = utype; savedata.properUtype = properUtype; savedata.aliasID = ialiasID; savedata.defaultValStr = defaultValStr; - savedata.utype = utype; savedata.setmethod = setmethod; + savedata.val = savedata.utype.parseDefaultValStr(savedata.defaultValStr); module.propertys[name] = savedata; @@ -964,26 +962,7 @@ public void onImportClientEntityDef(MemoryStream stream) { Dbg.ERROR_MSG("KBEngine::Client_onImportClientEntityDef: module(" + scriptmethod_name + ") not found!"); } - - foreach(string name in module.propertys.Keys) - { - Property infos = module.propertys[name]; - - Property newp = new Property(); - newp.name = infos.name; - newp.properUtype = infos.properUtype; - newp.aliasID = infos.aliasID; - newp.utype = infos.utype; - newp.val = infos.utype.parseDefaultValStr(infos.defaultValStr); - newp.setmethod = infos.setmethod; - - defpropertys.Add(infos.name, newp); - if(module.script != null && module.script.GetMember(name) == null) - { - Dbg.ERROR_MSG(scriptmethod_name + "(" + module.script + "):: property(" + name + ") no defined!"); - } - }; - + foreach(string name in module.methods.Keys) { // Method infos = module.methods[name];