From 8a39773a7a995d7515f44f151306bdb812448601 Mon Sep 17 00:00:00 2001 From: k_light <759925088@qq.com> Date: Wed, 15 Apr 2015 00:52:44 +0800 Subject: [PATCH 1/2] =?UTF-8?q?1.=E5=88=A0=E9=99=A4Entity=E5=86=97?= =?UTF-8?q?=E4=BD=99=E5=B1=9E=E6=80=A7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity.cs | 6 +----- KBEngine.cs | 26 ++------------------------ 2 files changed, 3 insertions(+), 29 deletions(-) diff --git a/Entity.cs b/Entity.cs index 4bb865e..dd7a008 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,12 +35,11 @@ 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; diff --git a/KBEngine.cs b/KBEngine.cs index d1f8e19..d351803 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) @@ -964,26 +961,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]; From 9c4a14b01ecc43e148c8854c5026d4fa9d2f91fe Mon Sep 17 00:00:00 2001 From: k_light <759925088@qq.com> Date: Wed, 15 Apr 2015 01:32:51 +0800 Subject: [PATCH 2/2] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E5=A4=8D=E5=88=B6=E5=AF=B9value=E7=9A=84=E8=B5=8B=E5=80=BC?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Entity.cs | 6 ++++-- KBEngine.cs | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Entity.cs b/Entity.cs index dd7a008..1952ad6 100644 --- a/Entity.cs +++ b/Entity.cs @@ -43,10 +43,12 @@ public Entity() { 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 d351803..96382bf 100644 --- a/KBEngine.cs +++ b/KBEngine.cs @@ -830,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;