diff --git a/src/Luban.Job.Cfg/Source/TypeVisitors/CsJsonDeserialize.cs b/src/Luban.Job.Cfg/Source/TypeVisitors/CsJsonDeserialize.cs index ed0243e..3b8cc23 100644 --- a/src/Luban.Job.Cfg/Source/TypeVisitors/CsJsonDeserialize.cs +++ b/src/Luban.Job.Cfg/Source/TypeVisitors/CsJsonDeserialize.cs @@ -1,6 +1,7 @@ using Luban.Job.Cfg.Datas; using Luban.Job.Common.Types; using Luban.Job.Common.TypeVisitors; +using Luban.Job.Common.Utils; using System; namespace Luban.Job.Cfg.TypeVisitors @@ -80,7 +81,8 @@ namespace Luban.Job.Cfg.TypeVisitors public string Accept(TBean type, string json, string x, int depth) { - return $"{x} = {type.CsUnderingDefineType()}.Deserialize{type.Bean.Name}({json});"; + string src = $"{type.Bean.FullName}.Deserialize{type.Bean.Name}({json});"; + return $"{x} = {ExternalTypeUtil.CsCloneToExternal(type.Bean.FullName, src)};"; } public string Accept(TArray type, string json, string x, int depth) diff --git a/src/Luban.Job.Cfg/Source/TypeVisitors/CsUnityJsonDeserialize.cs b/src/Luban.Job.Cfg/Source/TypeVisitors/CsUnityJsonDeserialize.cs index d85b7f7..16f6b3e 100644 --- a/src/Luban.Job.Cfg/Source/TypeVisitors/CsUnityJsonDeserialize.cs +++ b/src/Luban.Job.Cfg/Source/TypeVisitors/CsUnityJsonDeserialize.cs @@ -1,6 +1,7 @@ using Luban.Job.Cfg.Datas; using Luban.Job.Common.Types; using Luban.Job.Common.TypeVisitors; +using Luban.Job.Common.Utils; using System; namespace Luban.Job.Cfg.TypeVisitors @@ -81,7 +82,8 @@ namespace Luban.Job.Cfg.TypeVisitors public string Accept(TBean type, string json, string x, int depth) { - return $"{{ if(!{json}.IsObject) {{ throw new SerializationException(); }} {x} = {type.CsUnderingDefineType()}.Deserialize{type.Bean.Name}({json}); }}"; + string src = $"{type.Bean.FullName}.Deserialize{type.Bean.Name}({json})"; + return $"{{ if(!{json}.IsObject) {{ throw new SerializationException(); }} {x} = {ExternalTypeUtil.CsCloneToExternal(type.Bean.FullName, src)}; }}"; } public string Accept(TArray type, string json, string x, int depth)