public void Save(SHQuestsXml Quests, ref SHStringXml QuestString) { // 문자열 저장 File.Copy(SHGlobal.GetClientSystemFolder() + "\\lang\\ko_KR\\name_quest.xml", Directory.GetCurrentDirectory() + "\\Backup\\string_name_quest." + DateTime.Now.ToString("yy-MM-dd-HHmmss") + ".xml", true); QuestString.Clear(); foreach (SHQuest quest in Quests.dataList) { string szKey = "QUEST_TITLE_" + quest.id.ToString(); AddString(szKey, quest.title, ref QuestString); szKey = "QUEST_DESC_" + quest.id.ToString(); AddString(szKey, quest.desc, ref QuestString); szKey = "QUEST_CATEGORY_" + quest.id.ToString(); AddString(szKey, quest.category, ref QuestString); if (quest.Objectives != null) { for (int r = 0; r < quest.Objectives.dataList.Count; r++) { SHQuestObjective obj = (SHQuestObjective)quest.Objectives.dataList[r]; szKey = "QUEST_OBJ_DESC_" + quest.id.ToString(); szKey = szKey + "_" + obj.id.ToString(); AddString(szKey, obj.desc, ref QuestString); } } } QuestString.Compile(); // Save SHGlobal.Serialize <SHStringXml>(SHGlobal.GetClientSystemFolder() + SHGlobal.Locale.Path(SHLocaleType.KO_KR) + "name_quest.xml", QuestString, Encoding.UTF8); }
public void LoadQuests() { Quests = SHGlobal.Deserialize <SHQuestsXml>(SHGlobal.GetServerSystemFolder() + "\\quest.xml", Encoding.UTF8); if (Quests == null) { Quests = new SHQuestsXml(); Quests.LoadingFail(); } SHQuestStringReplacer replacer = new SHQuestStringReplacer(); replacer.ReplaceKeyToString(ref Quests, ref LocalXml.QuestString, true); Quests.Compile(); }
public void ReplaceKeyToString(ref SHQuestsXml Quests, ref SHStringXml QuestString, bool bReplaceTitle) { foreach (SHQuest quest in Quests.dataList) { string szKey; if (bReplaceTitle) { szKey = "QUEST_TITLE_" + quest.id.ToString(); if (QuestString.IsValid(szKey)) { quest.title = QuestString[szKey].ToString(); } } szKey = "QUEST_DESC_" + quest.id.ToString(); if (QuestString.IsValid(szKey)) { quest.desc = QuestString[szKey].ToString(); } szKey = "QUEST_CATEGORY_" + quest.id.ToString(); if (QuestString.IsValid(szKey)) { quest.category = QuestString[szKey].ToString(); } if (quest.Objectives != null) { for (int r = 0; r < quest.Objectives.dataList.Count; r++) { SHQuestObjective obj = (SHQuestObjective)quest.Objectives.dataList[r]; szKey = "QUEST_OBJ_DESC_" + quest.id.ToString() + "_" + obj.id.ToString(); if (QuestString.IsValid(szKey)) { obj.desc = QuestString[szKey].ToString(); } } } } }
public void ReplaceStringToKey(ref SHQuestsXml Quests) { foreach (SHQuest quest in Quests.dataList) { // quest.title = "QUEST_TITLE_" + quest.id.ToString(); quest.desc = "QUEST_DESC_" + quest.id.ToString(); quest.category = "QUEST_CATEGORY_" + quest.id.ToString(); if (quest.Objectives != null) { for (int r = 0; r < quest.Objectives.dataList.Count; r++) { SHQuestObjective obj = (SHQuestObjective)quest.Objectives.dataList[r]; obj.desc = "QUEST_OBJ_DESC_" + quest.id.ToString() + "_" + obj.id.ToString(); } } } }