public override void Init(bool UserSoure) { //if (Content.ContainsKey("ForName")) { ForName = Content["ForName"]; } else { SaveValue("ForName", ""); }; //if (Content.ContainsKey("ContentStr")) { ContentStr = Content["ContentStr"]; } else { SaveValue("ContentStr", ""); }; // if (Content.ContainsKey("CanBack")) // { // if (Content["CanBack"] == "0") CanBack = false; // else CanBack = true; // } // else { SaveValue("CanBack", "1"); }; // if (Content.ContainsKey("SkillOnclick")) // SkillOnclick = GameDataTool.GetOrNewGameDataByDynamic<Skill>(UserSoure, Content["SkillOnclick"]); // else { SaveValue("SkillOnclick", ""); } Name = Content["0"]; ForName = InitStringValue("ForName"); ContentStr = InitStringValue("ContentStr"); CanBack = InitBooltValue("CanBack", true); SkillOnclick = InitParaByDynamic <Skill>(UserSoure, "SkillOnclick"); NextComm = new Dictionary <string, CommunicationData>(); for (int i = 0; i < MaxNextComm; i++) { string name = ""; if (Content.ContainsKey("NextCommName_" + i) && !string.IsNullOrEmpty(Content["NextCommName_" + i])) { name = Content["NextCommName_" + i]; //避免循环 if (NextComm.ContainsKey(name)) { throw new System.Exception("NextComm.ContainsKey(name) name=" + name + " i=" + i); } } else { SaveValue("NextCommName_" + i, ""); } if (Content.ContainsKey("NextComm_" + i) && !string.IsNullOrEmpty(Content["NextComm_" + i]) && !string.IsNullOrEmpty(name)) { NextComm.Add(name, GameDataTool.GetOrNewGameDataByStatic <CommunicationData>(true, Content["NextComm_" + i])); } else { SaveValue("NextComm_" + i, ""); } } }
public T InitPara <T>(bool UserSoure, string name, DataManager manager, string init = "") where T : GameData { T t = default(T); if (Content.ContainsKey(name)) { t = GameDataTool.GetOrNewGameData <T>(UserSoure, Content[name], manager); } else { SaveValue(name, init); } return(t); }