using LitJson; using UnityEngine; using System; using System.IO; using System.Xml; using System.Text; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Security.Cryptography; using Sfs2X.Entities; using Sfs2X.Entities.Data; using Random = UnityEngine.Random; public class ConfigManager : Regist { #region Config public static XmlNode PlayerNode { get { if (PlayerNode_ == null) { PlayerNode_ = PlayerDoc.SelectSingleNode(PlayerConfigLabel.RootNode); } return PlayerNode_; } set { PlayerNode_ = value; } } public static XmlDocument PlayerDoc { get { if (PlayerDoc_ == null) { GetPlayerDoc(); } return PlayerDoc_; } set { PlayerDoc_ = value; } } public static XmlNode PlayerNode_; public static XmlDocument PlayerDoc_; public static float Timer; public static bool DamageLock; public static bool IDDownloadLock; public static bool SerialNumberDownloadLock = true; public static XmlDocument DefaultDoc = new XmlDocument(); public static int PlayerConfigResetVersion = -1000; public static string PlayerConfigPath { get { if (string.IsNullOrEmpty(playerConfigPath)) { playerConfigPath = $"{Application.persistentDataPath}/{ResourceLabel.PlayerConfigXml}"; } return playerConfigPath; } } public static string playerConfigPath; #endregion private static void GetPlayerDoc() { int defaultVersion; int nativeVersion; XmlNode node; XmlDocument nativeDoc = new XmlDocument(); if (File.Exists(PlayerConfigPath)) { try { StreamReader sr = new StreamReader(PlayerConfigPath); nativeDoc.LoadXml(sr.ReadToEnd()); sr.Close(); Auxiliary.DecryptXml(nativeDoc); } catch (Exception) { Debug.LogWarning("Download Archive : MD5 doesn't match"); //ManaDebug.Log("Download Archive"); DamageLock = true; SerialNumberDownloadLock = false; return; } TextAsset textAsset = ResourceManager.Load(ResourceLabel.PlayerConfig, Folder.Config); DefaultDoc.LoadXml(textAsset.text); defaultVersion = int.Parse(DefaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value); node = nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version); if (node == null) { StreamWriter sw = new StreamWriter(PlayerConfigPath); sw.Write(DefaultDoc.OuterXml); sw.Close(); PlayerDoc_ = DefaultDoc; } else { nativeVersion = int.Parse(node.Attributes[0].Value); if (nativeVersion == PlayerConfigResetVersion) { PlayerDoc_ = DefaultDoc; int currentReplayVersion = int.Parse(nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.ReplayVersion).Attributes[0].Value); SavePlayerInt(PlayerConfigLabel.ReplayVersion, currentReplayVersion + 1); //Debug.Log(currentReplayVersion); } else if (nativeVersion < defaultVersion) { byte[] bytes; MD5 md5 = new MD5CryptoServiceProvider(); if (nativeVersion <= 4) { bytes = Encoding.UTF8.GetBytes(nativeDoc.OuterXml); } else { bytes = File.ReadAllBytes(PlayerConfigPath); } if (PlayerPrefs.GetString(Lib.ConfigPrefs) != "" && PlayerPrefs.GetString(Lib.ConfigPrefs) != Auxiliary.ToString(md5.ComputeHash(bytes))) { Debug.LogWarning("Download Archive : MD5 doesn't match"); //ManaDebug.Log("Download Archive"); DamageLock = true; SerialNumberDownloadLock = false; return; } else { PlayerDoc_ = MergeXML(nativeVersion, nativeDoc, DefaultDoc); HttpManager.Save(); } } else if (nativeVersion > defaultVersion) { PlayerDoc_ = DefaultDoc; } else { byte[] bytes = File.ReadAllBytes(PlayerConfigPath); MD5 md5 = new MD5CryptoServiceProvider(); if (PlayerPrefs.GetString(Lib.ConfigPrefs) != "" && PlayerPrefs.GetString(Lib.ConfigPrefs) != Auxiliary.ToString(md5.ComputeHash(bytes))) { Debug.LogWarning("Download Archive : MD5 doesn't match"); //ManaDebug.Log("Download Archive"); DamageLock = true; SerialNumberDownloadLock = false; return; } PlayerDoc_ = nativeDoc; } } } else { TextAsset textAsset = ResourceManager.Load(ResourceLabel.PlayerConfig, Folder.Config); DefaultDoc.LoadXml(textAsset.text); Debug.LogWarning("Download Archive"); //ManaDebug.Log("Download Archive"); DamageLock = true; SerialNumberDownloadLock = false; return; } } public void Update() { if (DamageLock) { Timer += Time.deltaTime; if (Timer >= 30) { DamageLock = false; TextAsset textAsset = ResourceManager.Load(ResourceLabel.PlayerConfig, Folder.Config); PlayerDoc_ = new XmlDocument(); PlayerDoc_.LoadXml(textAsset.text); return; } } if (!SerialNumberDownloadLock) { if (HttpManager.SerialNumber != "Default") { SerialNumberDownloadLock = true; HttpManager.DownloadBySerialNumber(HttpManager.SerialNumber, RecoveXml); } } } public override bool InitAtOnce() { if (base.InitAtOnce()) { return true; } enabled = true; return false; } public static void SaveXml() { if (Initializer.Complete) { XmlDocument doc = new XmlDocument(); doc.LoadXml(PlayerDoc.OuterXml); Auxiliary.EncryptXml(doc); StreamWriter sw = new StreamWriter(PlayerConfigPath); sw.Write(doc.OuterXml); sw.Close(); byte[] bytes = File.ReadAllBytes(PlayerConfigPath); //byte[] bytes = Encoding.UTF8.GetBytes(PlayerDoc.OuterXml); MD5 md5 = new MD5CryptoServiceProvider(); PlayerPrefs.SetString(Lib.ConfigPrefs, Auxiliary.ToString(md5.ComputeHash(bytes))); } } public static void RecoveXml(JsonData jsonData) { if (!DamageLock) { return; } TextAsset textAsset = ResourceManager.Load(ResourceLabel.PlayerConfig, Folder.Config); DefaultDoc.LoadXml(textAsset.text); if (jsonData.Inst_Object.Keys.Contains("l")) { PlayerDoc_ = new XmlDocument(); PlayerDoc_.LoadXml(jsonData["l"].ToString()); int nativeVersion = int.Parse(PlayerDoc_.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value); int defaultVersion = int.Parse(DefaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value); if (nativeVersion < defaultVersion) { MergeXML(nativeVersion, PlayerDoc_, DefaultDoc); HttpManager.Save(); } else if (nativeVersion > defaultVersion) { PlayerDoc_ = DefaultDoc; } DamageLock = false; } else { if (!IDDownloadLock) { if (HttpManager.ID != "Default") { IDDownloadLock = true; Debug.LogWarning("DownloadByID"); HttpManager.DownloadByID(HttpManager.ID, RecoveXml); } else { Debug.LogWarning("Use Default"); PlayerDoc_ = DefaultDoc; DamageLock = false; } } else { Debug.LogWarning("Use Default"); PlayerDoc_ = DefaultDoc; DamageLock = false; } } } public static void SaveSkillList() { if (TutorialManager.NewplayerTutorial || !Manager.Complete) { return; } XmlNode xmlNode; XmlAttribute xmlAttribute; xmlNode = PlayerNode.SelectSingleNode(PlayerConfigLabel.SkillList); xmlNode.RemoveAll(); for (int i = 0; i < Manager.SkillList.Count; i++) { if (Manager.SkillList[i].SkillType == SkillType.Skill) { #region Skill Skill skill = (Skill)Manager.SkillList[i]; xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, PlayerConfigLabel.Skill, "")); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute(PlayerConfigLabel.ID)); xmlAttribute.Value = skill.FullID; xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute(PlayerConfigLabel.SkillType)); xmlAttribute.Value = skill.SkillType.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute(PlayerConfigLabel.ItemStatus)); xmlAttribute.Value = skill.ItemStatus.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute(PlayerConfigLabel.Level)); xmlAttribute.Value = skill.Level.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute(PlayerConfigLabel.CoolTimer)); xmlAttribute.Value = skill.CoolTimer.ToString("0"); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute(PlayerConfigLabel.UseTimer)); xmlAttribute.Value = skill.UseTimer.ToString("0"); xmlNode = PlayerNode.SelectSingleNode(PlayerConfigLabel.SkillList); #endregion } else if (Manager.SkillList[i].SkillType == SkillType.Pack) { #region Pack Pack pack = (Pack)Manager.SkillList[i]; xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, PlayerConfigLabel.Skill, "")); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute(PlayerConfigLabel.ID)); xmlAttribute.Value = pack.FullID; xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute(PlayerConfigLabel.SkillType)); xmlAttribute.Value = pack.SkillType.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute(PlayerConfigLabel.ItemStatus)); xmlAttribute.Value = pack.ItemStatus.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute(PlayerConfigLabel.Level)); xmlAttribute.Value = pack.Level.ToString(); xmlNode = PlayerNode.SelectSingleNode(PlayerConfigLabel.SkillList); #endregion } else if (Manager.SkillList[i].SkillType == SkillType.Ability) { #region Ability Ability ability = (Ability)Manager.SkillList[i]; xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, PlayerConfigLabel.Skill, "")); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute(PlayerConfigLabel.ID)); xmlAttribute.Value = ability.FullID; xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute(PlayerConfigLabel.SkillType)); xmlAttribute.Value = ability.SkillType.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute(PlayerConfigLabel.ItemStatus)); xmlAttribute.Value = ability.ItemStatus.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute(PlayerConfigLabel.Level)); xmlAttribute.Value = ability.Level.ToString(); xmlNode = PlayerNode.SelectSingleNode(PlayerConfigLabel.SkillList); #endregion } else if (Manager.SkillList[i].SkillType == SkillType.BigSkill) { #region BigSkill BigSkill bigSkill = (BigSkill)Manager.SkillList[i]; xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, PlayerConfigLabel.Skill, "")); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute(PlayerConfigLabel.ID)); xmlAttribute.Value = bigSkill.FullID; xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute(PlayerConfigLabel.SkillType)); xmlAttribute.Value = bigSkill.SkillType.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute(PlayerConfigLabel.ItemStatus)); xmlAttribute.Value = bigSkill.ItemStatus.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute(PlayerConfigLabel.BarStatus)); xmlAttribute.Value = bigSkill.BarStatus.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute(PlayerConfigLabel.Level)); xmlAttribute.Value = bigSkill.Level.ToString(); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute(PlayerConfigLabel.CoolTimer)); xmlAttribute.Value = bigSkill.CoolTimer.ToString("0"); xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute(PlayerConfigLabel.UseTimer)); xmlAttribute.Value = bigSkill.UseTimer.ToString("0"); xmlNode = PlayerNode.SelectSingleNode(PlayerConfigLabel.SkillList); #endregion } } } public static void SaveDress() { XmlNode xmlNode = PlayerNode.SelectSingleNode(PlayerConfigLabel.DressList); xmlNode.Attributes[0].Value = ""; for (int i = 0; i < PlayerManager.BoughtCloseList.Count; i++) { xmlNode.Attributes[0].Value += PlayerManager.BoughtCloseList[i] + " "; } xmlNode.Attributes[0].Value = xmlNode.Attributes[0].Value.TrimEnd(' '); xmlNode = PlayerNode.SelectSingleNode(PlayerConfigLabel.DressData); for (int i = 0; i < PlayerManager.DressData.Count; i++) { xmlNode.Attributes[i].Value = PlayerManager.DressData[i]; } } public static void SaveAchieve() { XmlNode xmlNode = PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveList); xmlNode.Attributes[0].Value = ""; foreach (var kv in AchieveManager.AchieveDic) { if (!kv.Value.Lock) { xmlNode.Attributes[0].Value += kv.Value.ID + " "; } } xmlNode.Attributes[0].Value = xmlNode.Attributes[0].Value.TrimEnd(' '); PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[0].Value = Manager.AdAmt.ToString("0"); PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[1].Value = Manager.SkillAmt.ToString("0"); PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[2].Value = Manager.SignAmt.ToString("0"); PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[3].Value = Manager.ShareAmt.ToString("0"); PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[4].Value = Manager.ElfLevel.ToString("0"); PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[5].Value = Manager.MiniGameAmt.ToString("0"); PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[6].Value = Manager.FlowerCoin.ToString("0"); PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[7].Value = Manager.TotalPerson.ToString("0"); PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[8].Value = Manager.CostDiamond.ToString("0"); PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[9].Value = Manager.CreateRoomAmt.ToString("0"); PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[10].Value = Manager.CreateChestAmt.ToString("0"); PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[11].Value = Manager.CreateLuckyChestAmt.ToString("0"); PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[12].Value = Manager.CreateGuessColorChestAmt.ToString("0"); PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[13].Value = Manager.CreateGuessNumberChestAmt.ToString("0"); PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[14].Value = Manager.GetChestAwardAmt.ToString("0"); } public static void SavePlantList() { if (VisitManager.InVisit || TutorialManager.NewplayerTutorial) { return; } XmlAttributeCollection attribute = PlayerNode.SelectSingleNode(PlayerConfigLabel.PlantList).Attributes; attribute[0].Value = ""; for (int i = 0; i < GardenManager.PlantList.Count; i++) { Slot slot = GardenManager.PlantList[i]; attribute[0].Value += slot.ID + "," + slot.Index + " "; } attribute[0].Value = attribute[0].Value.TrimEnd(' '); } public static void SaveCommon() { PlayerNode.SelectSingleNode(PlayerConfigLabel.Coin).Attributes[0].Value = Manager.Coin.ToString("0"); PlayerNode.SelectSingleNode(PlayerConfigLabel.Diamond).Attributes[0].Value = Manager.Diamond.ToString("0"); PlayerNode.SelectSingleNode(PlayerConfigLabel.SignTime).Attributes[0].Value = SignManager.SignTime.ToString(); PlayerNode.SelectSingleNode(PlayerConfigLabel.SignIndex).Attributes[0].Value = SignManager.SignIndex.ToString(); PlayerNode.SelectSingleNode(PlayerConfigLabel.SignRound).Attributes[0].Value = SignManager.SignRound.ToString(); PlayerNode.SelectSingleNode(PlayerConfigLabel.QuitFlag).Attributes[0].Value = HttpManager.Connect.ToInt().ToString(); PlayerNode.SelectSingleNode(PlayerConfigLabel.QuitTime).Attributes[0].Value = HttpManager.Time.ToString(); PlayerNode.SelectSingleNode(PlayerConfigLabel.MiniTimer).Attributes[0].Value = Manager.MiniTimer.ToString("0"); PlayerNode.SelectSingleNode(PlayerConfigLabel.CircleTimer).Attributes[0].Value = Manager.CircleTimer.ToString("0"); PlayerNode.SelectSingleNode(PlayerConfigLabel.ID).Attributes[0].Value = HttpManager.ID; PlayerNode.SelectSingleNode(PlayerConfigLabel.SerialNumber).Attributes[0].Value = HttpManager.SerialNumber; PlayerNode.SelectSingleNode(PlayerConfigLabel.Language).Attributes[0].Value = LanguageManager.CurrentLanguage.ToString(); PlayerNode.SelectSingleNode(PlayerConfigLabel.MiniGameIndex).Attributes[0].Value = MiniGameManager.MiniGameIndex.ToString(); PlayerNode.SelectSingleNode(PlayerConfigLabel.TutorialA).Attributes[0].Value = TutorialManager.NewplayerTutorial.ToInt().ToString(); PlayerNode.SelectSingleNode(PlayerConfigLabel.TutorialB).Attributes[0].Value = TutorialManager.memoryMinigameTutorial.ToInt().ToString(); PlayerNode.SelectSingleNode(PlayerConfigLabel.TutorialC).Attributes[0].Value = TutorialManager.visitTutorial.ToInt().ToString(); PlayerNode.SelectSingleNode(PlayerConfigLabel.TutorialD).Attributes[0].Value = TutorialManager.dressroomTutorial.ToInt().ToString(); PlayerNode.SelectSingleNode(PlayerConfigLabel.TutorialE).Attributes[0].Value = TutorialManager.findMinigameTutorial.ToInt().ToString(); PlayerNode.SelectSingleNode(PlayerConfigLabel.TutorialPlazaRoom).Attributes[0].Value = TutorialManager.plazaRoomTutorial.ToInt().ToString(); PlayerNode.SelectSingleNode(PlayerConfigLabel.TutorialIndexA).Attributes[0].Value = TutorialManager.NewplayerTutorialIndex.ToString(); PlayerNode.SelectSingleNode(PlayerConfigLabel.TutorialIndexB).Attributes[0].Value = TutorialManager.MemoryMinigameTutorialIndex.ToString(); PlayerNode.SelectSingleNode(PlayerConfigLabel.TutorialIndexC).Attributes[0].Value = TutorialManager.VisitTutorialIndex.ToString(); PlayerNode.SelectSingleNode(PlayerConfigLabel.TutorialIndexD).Attributes[0].Value = TutorialManager.DressroomTutorialIndex.ToString(); PlayerNode.SelectSingleNode(PlayerConfigLabel.TutorialIndexE).Attributes[0].Value = TutorialManager.FindMinigameTutorialIndex.ToString(); PlayerNode.SelectSingleNode(PlayerConfigLabel.TutorialIndexPlazaRoom).Attributes[0].Value = TutorialManager.PlazaRoomTutorialIndex.ToString(); } public static void SaveFlowers() { XmlAttribute attribute = PlayerNode.SelectSingleNode(PlayerConfigLabel.FlowerList).Attributes[0]; XmlAttribute attribute1 = PlayerNode.SelectSingleNode(PlayerConfigLabel.FlowerAmtList).Attributes[0]; attribute.Value = ""; attribute1.Value = ""; foreach (var kv in GardenManager.FlowerInfoDic) { if (kv.Value.Unlock) { attribute.Value += kv.Value.ID_ + " "; attribute1.Value += kv.Value.Amount + " "; } } attribute.Value = attribute.Value.Trim(' '); attribute1.Value = attribute1.Value.Trim(' '); } public static void SavePlayerConfig() { if (Initializer.Complete) { SaveSkillList(); SaveAchieve(); SaveDress(); SavePlantList(); SaveCommon(); SaveFlowers(); ChestManager.SaveToConfig(); } } public static void ResetPlayerConfig() { PlayerNode.SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = PlayerConfigResetVersion.ToString(); SavePlayerConfig(); Manager.SaveLock = true; SaveXml(); Application.Quit(); } public static int GetPlayerInt(string node) { return int.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value); } public static bool GetPlayerBool(string node) { return int.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value).ToBool(); } public static float GetPlayerFloat(string node) { return float.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value); } public static string GetPlayerString(string node) { return PlayerNode.SelectSingleNode(node).Attributes[0].Value; } public static double GetPlayerDouble(string node) { return double.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value); } public static void SavePlayerInt(string node, int value) { PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToString(); } public static void SavePlayerBool(string node, bool value) { PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToInt().ToString(); } public static void SavePlayerFloat(string node, float value) { PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToString(); } public static void SavePlayerString(string node, string value) { PlayerNode.SelectSingleNode(node).Attributes[0].Value = value; } public static void SavePlayerDouble(string node, double value) { PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToString(); } public static List GetIntList(char splitChar, string nodeName, List defaultList) { return Auxiliary.StringToInts(splitChar, PlayerNode.SelectSingleNode(nodeName).Attributes[0].Value, defaultList); } public static List GetStringList(char splitChar, string nodeName, List defaultList) { return Auxiliary.StringToStrings(splitChar, PlayerNode.SelectSingleNode(nodeName).Attributes[0].Value, defaultList); } public static List GetDressList() { List list = new List(); XmlAttributeCollection attribute = PlayerNode.SelectSingleNode(PlayerConfigLabel.DressList).Attributes; return Auxiliary.StringToInts(' ', attribute[0].Value, list); } public static List GetDressDataIDs(Player player) { //foreach (var VARIABLE in ManaPlayer.CloseIDDic) //{ // Debug.LogWarning(VARIABLE.Key); //} List dressDataIDs = new List(); dressDataIDs.Add(PlayerManager.CloseIDDic[player.Head]); dressDataIDs.Add(PlayerManager.CloseIDDic[player.Dress]); dressDataIDs.Add(PlayerManager.CloseIDDic[player.Shoe]); dressDataIDs.Add(PlayerManager.CloseIDDic[player.HeadWear]); dressDataIDs.Add(PlayerManager.CloseIDDic[player.Top]); dressDataIDs.Add(PlayerManager.CloseIDDic[player.Eye]); dressDataIDs.Add(PlayerManager.CloseIDDic[player.Mouse]); dressDataIDs.Add(PlayerManager.CloseIDDic[player.Wing]); return dressDataIDs; } public static List GetDressDataIDs(List dressdataNames) { //foreach (var VARIABLE in ManaPlayer.CloseIDDic) //{ // Debug.LogWarning(VARIABLE.Key); //} List dressDataIDs = new List(); int index = 0; dressDataIDs.Add(PlayerManager.CloseIDDic[dressdataNames[index++]]); dressDataIDs.Add(PlayerManager.CloseIDDic[dressdataNames[index++]]); dressDataIDs.Add(PlayerManager.CloseIDDic[dressdataNames[index++]]); dressDataIDs.Add(PlayerManager.CloseIDDic[dressdataNames[index++]]); dressDataIDs.Add(PlayerManager.CloseIDDic[dressdataNames[index++]]); dressDataIDs.Add(PlayerManager.CloseIDDic[dressdataNames[index++]]); dressDataIDs.Add(PlayerManager.CloseIDDic[dressdataNames[index++]]); dressDataIDs.Add(PlayerManager.CloseIDDic[dressdataNames[index++]]); return dressDataIDs; } public static List GetDressDataIDs(ISFSObject parameter) { List ids = parameter.GetIntArray(InfoLabel.Close.GetHashString()).ToList(); return ids; } public static List GetDressData(SFSObject parameter) { List ids = GetDressDataIDs(parameter); List dressData = new List(); foreach (var id in ids) { dressData.Add(PlayerManager.CloseItemDic[id].ArmatureName); } return dressData; } public static List GetDressData(XmlNode node = null) { XmlNode xmlNode; if (node == null) { xmlNode = PlayerNode.SelectSingleNode(PlayerConfigLabel.DressData); } else { xmlNode = node.SelectSingleNode(PlayerConfigLabel.DressData); } List dataList = new List(); if (xmlNode != null && xmlNode.Attributes.Count == 12) { dataList.Add(xmlNode.Attributes[0].Value); dataList.Add(xmlNode.Attributes[1].Value); dataList.Add(xmlNode.Attributes[2].Value); dataList.Add(xmlNode.Attributes[3].Value); dataList.Add(xmlNode.Attributes[4].Value); dataList.Add(xmlNode.Attributes[5].Value); dataList.Add(xmlNode.Attributes[6].Value); dataList.Add(xmlNode.Attributes[7].Value); dataList.Add(xmlNode.Attributes[8].Value); dataList.Add(xmlNode.Attributes[9].Value); dataList.Add(xmlNode.Attributes[10].Value); dataList.Add(xmlNode.Attributes[11].Value); //dataList[8] = "长袖9左"; //dataList[9] = "Empty"; //dataList[10] = "长袖9右"; //dataList[11] = "Empty"; } else if(xmlNode != null && xmlNode.Attributes.Count == 8) { dataList.Add(xmlNode.Attributes[0].Value); dataList.Add(xmlNode.Attributes[1].Value); dataList.Add(xmlNode.Attributes[2].Value); dataList.Add(xmlNode.Attributes[3].Value); dataList.Add(xmlNode.Attributes[4].Value); dataList.Add(xmlNode.Attributes[5].Value); dataList.Add(xmlNode.Attributes[6].Value); dataList.Add(xmlNode.Attributes[7].Value); dataList.AddRange (GetSleeveListByTop(xmlNode.Attributes[4].Value)); } else { float rate = Random.Range(0f, 1f); if (rate < 0.33f) { dataList.Add("脑壳1"); dataList.Add("裙子1"); dataList.Add("鞋子1"); dataList.Add("头饰品1"); dataList.Add("上衣1"); dataList.Add("眼睛1"); dataList.Add("嘴巴1"); dataList.Add("Empty"); dataList.Add("Empty"); dataList.Add("短袖1左"); dataList.Add("Empty"); dataList.Add("短袖1右"); } else if (rate < 0.66f) { dataList.Add("脑壳2"); dataList.Add("裙子2"); dataList.Add("鞋子2"); dataList.Add("头饰品2"); dataList.Add("上衣2"); dataList.Add("眼睛2"); dataList.Add("嘴巴2"); dataList.Add("Empty"); dataList.Add("Empty"); dataList.Add("短袖2左"); dataList.Add("Empty"); dataList.Add("短袖2右"); } else { dataList.Add("脑壳3"); dataList.Add("裙子3"); dataList.Add("鞋子3"); dataList.Add("头饰品3"); dataList.Add("上衣3"); dataList.Add("眼睛3"); dataList.Add("嘴巴3"); dataList.Add("Empty"); dataList.Add("Empty"); dataList.Add("短袖2左"); dataList.Add("Empty"); dataList.Add("短袖2右"); } } return dataList; } public static List GetFlowerList() { List list = new List(); XmlAttributeCollection attribute = PlayerNode.SelectSingleNode(PlayerConfigLabel.FlowerList).Attributes; return Auxiliary.StringToInts(' ', attribute[0].Value, list); } public static List GetAchieveList() { return Auxiliary.StringToInts(' ', GetPlayerString(PlayerConfigLabel.AchieveList), new List()); } public static List GetOfflineConfig() { TextAsset textAsset = ResourceManager.Load(ResourceLabel.OfflineConfig, Folder.Config); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(textAsset.text); XmlNode xmlNode = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectSingleNode(ConfigLabel.ChildNode); List strList = new List() { xmlNode.Attributes[1].Value, xmlNode.Attributes[2].Value, xmlNode.Attributes[3].Value, }; return strList; } public static List GetAchieveData() { List dataList = new List(); dataList.Add(double.Parse(PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[0].Value)); dataList.Add(double.Parse(PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[1].Value)); dataList.Add(double.Parse(PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[2].Value)); dataList.Add(double.Parse(PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[3].Value)); dataList.Add(double.Parse(PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[4].Value)); dataList.Add(double.Parse(PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[5].Value)); dataList.Add(double.Parse(PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[6].Value)); dataList.Add(double.Parse(PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[7].Value)); dataList.Add(double.Parse(PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[8].Value)); dataList.Add(double.Parse(PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[9].Value)); dataList.Add(double.Parse(PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[10].Value)); dataList.Add(double.Parse(PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[11].Value)); dataList.Add(double.Parse(PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[12].Value)); dataList.Add(double.Parse(PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[13].Value)); dataList.Add(double.Parse(PlayerNode.SelectSingleNode(PlayerConfigLabel.AchieveData).Attributes[14].Value)); return dataList; } public static List> GetPlantList(XmlNode node = null) { List> list = new List>(); XmlNode xmlNode; if (node == null) { xmlNode = PlayerNode.SelectSingleNode(PlayerConfigLabel.PlantList); } else { xmlNode = node.SelectSingleNode(PlayerConfigLabel.PlantList); } if (!string.IsNullOrEmpty(xmlNode.Attributes[0].Value)) { string[] strings = xmlNode.Attributes[0].Value.Split(' '); for (int i = 0; i < strings.Length; i++) { list.Add(new KV(int.Parse(strings[i].Split(',')[0]), int.Parse(strings[i].Split(',')[1]))); } } return list; } public static List GetSkillList(XmlNode node = null) { List attributeList = new List(); XmlNodeList xmlNodeList; if (node == null) { xmlNodeList = PlayerNode.SelectSingleNode(PlayerConfigLabel.SkillList).ChildNodes; } else { xmlNodeList = node.SelectSingleNode(PlayerConfigLabel.SkillList).ChildNodes; } for (int i = 0; i < xmlNodeList.Count; i++) { attributeList.Add(xmlNodeList[i].Attributes); } return attributeList; } public static XmlAttributeCollection GetVisitConfig() { TextAsset textAsset = ResourceManager.Load(ResourceLabel.VisitConfig, Folder.Config); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(textAsset.text); XmlNode xmlNode = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectSingleNode(ConfigLabel.ChildNode); return xmlNode.Attributes; } public static XmlAttributeCollection GetPlazaRoomConfig() { TextAsset textAsset = ResourceManager.Load(ResourceLabel.PlazaroomConfig, Folder.Config); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(textAsset.text); XmlNode xmlNode = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectSingleNode(ConfigLabel.ChildNode); return xmlNode.Attributes; } public static XmlAttributeCollection GetAwardConfig() { TextAsset textAsset = ResourceManager.Load(ResourceLabel.AwardConfig, Folder.Config); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(textAsset.text); XmlNode xmlNode = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectSingleNode(ConfigLabel.ChildNode); return xmlNode.Attributes; } public static List GetIAPConfig() { TextAsset textAsset; XmlNodeList xmlNodeList; XmlDocument xmlDoc = new XmlDocument(); List attributeList = new List(); textAsset = ResourceManager.Load(ResourceLabel.IAPConfig, Folder.Config); xmlDoc.LoadXml(textAsset.text); xmlNodeList = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode); for (int i = 0; i < xmlNodeList.Count; i++) { attributeList.Add(xmlNodeList[i].Attributes); } return attributeList; } public static List GetSkillConfig() { TextAsset textAsset; XmlDocument xmlDoc = new XmlDocument(); List xmlNodeList = new List(); List attributeList = new List(); textAsset = ResourceManager.Load(ResourceLabel.PackConfig, Folder.Config); xmlDoc.LoadXml(textAsset.text); xmlNodeList.Add(xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode)); textAsset = ResourceManager.Load(ResourceLabel.SkillConfig, Folder.Config); xmlDoc.LoadXml(textAsset.text); xmlNodeList.Add(xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode)); textAsset = ResourceManager.Load(ResourceLabel.AbilityConfig, Folder.Config); xmlDoc.LoadXml(textAsset.text); xmlNodeList.Add(xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode)); for (int i = 0; i < xmlNodeList.Count; i++) { for (int j = 0; j < xmlNodeList[i].Count; j++) { attributeList.Add(xmlNodeList[i][j].Attributes); } } return attributeList; } public static List GetSignConfig() { TextAsset textAsset; XmlNodeList xmlNodeList; XmlDocument xmlDoc = new XmlDocument(); List attributeList = new List(); textAsset = ResourceManager.Load(ResourceLabel.SigninConfig, Folder.Config); xmlDoc.LoadXml(textAsset.text); xmlNodeList = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode); for (int i = 0; i < xmlNodeList.Count; i++) { attributeList.Add(xmlNodeList[i].Attributes); } return attributeList; } public static List GetFlowerConfig() { TextAsset textAsset; XmlNodeList xmlNodeList; XmlDocument xmlDoc = new XmlDocument(); List attributeList = new List(); textAsset = ResourceManager.Load(ResourceLabel.FlowerConfig, Folder.Config); xmlDoc.LoadXml(textAsset.text); xmlNodeList = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode); for (int i = 0; i < xmlNodeList.Count; i++) { attributeList.Add(xmlNodeList[i].Attributes); } return attributeList; } public static List GetLotteryConfig() { TextAsset textAsset; XmlNodeList xmlNodeList; XmlDocument xmlDoc = new XmlDocument(); List attributeList = new List(); textAsset = ResourceManager.Load(ResourceLabel.LotteryConfig, Folder.Config); xmlDoc.LoadXml(textAsset.text); xmlNodeList = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode); for (int i = 0; i < xmlNodeList.Count; i++) { attributeList.Add(xmlNodeList[i].Attributes); } return attributeList; } public static List GetAchieveConfig() { TextAsset textAsset; XmlNodeList xmlNodeList; XmlDocument xmlDoc = new XmlDocument(); List attributeList = new List(); textAsset = ResourceManager.Load(ResourceLabel.AchieveConfig, Folder.Config); xmlDoc.LoadXml(textAsset.text); xmlNodeList = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode); for (int i = 0; i < xmlNodeList.Count; i++) { attributeList.Add(xmlNodeList[i].Attributes); } return attributeList; } public static List GetDressRoomConfig() { TextAsset textAsset; XmlNodeList xmlNodeList; XmlDocument xmlDoc = new XmlDocument(); List attributeList = new List(); textAsset = ResourceManager.Load(ResourceLabel.DressroomConfig, Folder.Config); xmlDoc.LoadXml(textAsset.text); xmlNodeList = xmlDoc.SelectSingleNode(ConfigLabel.RootNode).SelectNodes(ConfigLabel.ChildNode); for (int i = 0; i < xmlNodeList.Count; i++) { attributeList.Add(xmlNodeList[i].Attributes); } return attributeList; } public static XmlDocument GetXmlDocument(string ConfigName) { TextAsset textAsset = ResourceManager.Load(ConfigName, Folder.Config); XmlDocument xmlDocument = new XmlDocument(); xmlDocument.LoadXml(textAsset.text); return xmlDocument; } //玩家存档版本大于默认存档版本时需要清空 //玩家存档版本小于默认存档版本时需要合并 //玩家存档版本等于PlayerConfigResetVersion时需要标记为重玩 public static XmlDocument MergeXML(int nativeVersion, XmlDocument nativeDoc, XmlDocument defaultDoc) { if (nativeVersion < 0) { Debug.LogWarning("UpdateArchive to 0"); To0(nativeDoc, defaultDoc); } if (nativeVersion < 1) { Debug.LogWarning("UpdateArchive to 1"); To1(nativeDoc, defaultDoc); } if (nativeVersion < 2) { Debug.LogWarning("UpdateArchive to 2"); To2(nativeDoc, defaultDoc); } if (nativeVersion < 3) { Debug.LogWarning("UpdateArchive to 3"); To3(nativeDoc, defaultDoc); } if (nativeVersion < 4) { Debug.LogWarning("UpdateArchive to 4"); To4(nativeDoc, defaultDoc); } if (nativeVersion < 5) { Debug.LogWarning("UpdateArchive to 5"); To5(nativeDoc, defaultDoc); } if (nativeVersion < 6) { Debug.LogWarning("UpdateArchive to 6"); To6(nativeDoc, defaultDoc); } if (nativeVersion < 7) { Debug.LogWarning("UpdateArchive to 7"); To7(nativeDoc, defaultDoc); } if (nativeVersion < 8) { Debug.LogWarning("UpdateArchive to 8"); To8(nativeDoc, defaultDoc); } if (nativeVersion < 9) { Debug.LogWarning("UpdateArchive to 9"); To9(nativeDoc, defaultDoc); } if (nativeVersion < 10) { Debug.LogWarning("UpdateArchive to 10"); To10(nativeDoc, defaultDoc); } if (nativeVersion < 11) { Debug.LogWarning("UpdateArchive to 11"); To11(nativeDoc, defaultDoc); } if (nativeVersion < 12) { Debug.LogWarning("UpdateArchive to 12"); To12(nativeDoc, defaultDoc); } return nativeDoc; } public static XmlDocument To0(XmlDocument nativeDoc, XmlDocument defaultDoc) { nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 0.ToString(); XmlNode xmlNode1 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.ADPlayTime); nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode1, true)); return nativeDoc; } public static XmlDocument To1(XmlDocument nativeDoc, XmlDocument defaultDoc) { nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 1.ToString(); XmlNode xmlNode1 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.SerialNumber); nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode1, true)); return nativeDoc; } public static XmlDocument To2(XmlDocument nativeDoc, XmlDocument defaultDoc) { nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 2.ToString(); XmlNode xmlNode1 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.NotificationIndex); nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode1, true)); return nativeDoc; } public static XmlDocument To3(XmlDocument nativeDoc, XmlDocument defaultDoc) { nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 3.ToString(); XmlNode xmlNode1 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.NickName); nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode1, true)); return nativeDoc; } public static XmlDocument To4(XmlDocument nativeDoc, XmlDocument defaultDoc) { nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 4.ToString(); XmlNode xmlNode = nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.DressData); XmlAttribute attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute (PlayerConfigLabel.LeftLongSleeveSlot)); attribute.Value="Empty"; attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute (PlayerConfigLabel.LeftShortSleeveSlot)); attribute.Value="Empty"; attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute (PlayerConfigLabel.RightLongSleeveSlot)); attribute.Value="Empty"; attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute (PlayerConfigLabel.RightShortSleeveSlot)); attribute.Value="Empty"; List sleeveList = GetSleeveListByTop (xmlNode.Attributes [4].Value); xmlNode.Attributes [8].Value = sleeveList[0]; xmlNode.Attributes [9].Value = sleeveList[1]; xmlNode.Attributes [10].Value = sleeveList[2]; xmlNode.Attributes [11].Value = sleeveList[3]; return nativeDoc; } public static List GetSleeveListByTop(string topName) { List sleeveList = new List() {"Empty", "Empty", "Empty", "Empty"}; if (topName == "上衣1") { sleeveList[1] = "短袖1左"; sleeveList[3] = "短袖1右"; } else if (topName == "上衣2") { sleeveList[1] = "短袖2左"; sleeveList[3] = "短袖2右"; } else if (topName == "上衣3") { sleeveList[1] = "短袖2左"; sleeveList[3] = "短袖2右"; } else if (topName == "上衣5") { sleeveList[1] = "短袖2左"; sleeveList[3] = "短袖2右"; } else if (topName == "上衣6") { sleeveList[1] = "短袖6左"; sleeveList[3] = "短袖6右"; } else if (topName == "上衣7") { sleeveList[1] = "短袖7左"; sleeveList[3] = "短袖7右"; } else if (topName == "上衣7(粉)") { sleeveList[1] = "短袖7粉左"; sleeveList[3] = "短袖7粉右"; } else if (topName == "上衣12") { sleeveList[1] = "短袖12左"; sleeveList[3] = "短袖12右"; } else if (topName == "上衣13") { sleeveList[1] = "短袖13左"; sleeveList[3] = "短袖13右"; } else if (topName == "上衣13(紫)") { sleeveList[1] = "短袖13蓝左"; sleeveList[3] = "短袖13蓝右"; } else { sleeveList[0] = "长袖9左"; sleeveList[2] = "长袖9右"; } return sleeveList; } public static XmlDocument To5(XmlDocument nativeDoc, XmlDocument defaultDoc) { nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 5.ToString(); return nativeDoc; } public static XmlDocument To6(XmlDocument nativeDoc, XmlDocument defaultDoc) { nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 6.ToString(); XmlNode xmlNode1 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.NewFlowerFlag); nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode1, true)); return nativeDoc; } public static XmlDocument To7(XmlDocument nativeDoc, XmlDocument defaultDoc) { nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 7.ToString(); XmlNode xmlNode1 = nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.FlowerList); string[] flowerIDs= xmlNode1.Attributes[0].Value.Split(' '); xmlNode1 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.FlowerAmtList); xmlNode1.Attributes[0].Value = ""; foreach (var flowerID in flowerIDs) { xmlNode1.Attributes[0].Value += " " + "1"; } xmlNode1.Attributes[0].Value = xmlNode1.Attributes[0].Value.TrimStart(); nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode1, true)); return nativeDoc; } public static XmlDocument To8(XmlDocument nativeDoc, XmlDocument defaultDoc) { nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 8.ToString(); XmlNode xmlNode0 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.TutorialPlazaRoom); XmlNode xmlNode1 = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.TutorialIndexPlazaRoom); nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode0, true)); nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode1, true)); return nativeDoc; } public static XmlDocument To9(XmlDocument nativeDoc, XmlDocument defaultDoc) { nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 9.ToString(); XmlNode xmlNode = nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.AchieveData); xmlNode.Attributes.Append(nativeDoc.CreateAttribute(PlayerConfigLabel.CreateRoomAmt)); xmlNode.Attributes.Append(nativeDoc.CreateAttribute(PlayerConfigLabel.CreateChestAmt)); xmlNode.Attributes.Append(nativeDoc.CreateAttribute(PlayerConfigLabel.CreateLuckyChestAmt)); xmlNode.Attributes.Append(nativeDoc.CreateAttribute(PlayerConfigLabel.CreateGuessColorChestAmt)); xmlNode.Attributes.Append(nativeDoc.CreateAttribute(PlayerConfigLabel.CreateGuessNumberChestAmt)); xmlNode.Attributes.Append(nativeDoc.CreateAttribute(PlayerConfigLabel.GetChestAwardAmt)); xmlNode.Attributes[9].Value = "0"; xmlNode.Attributes[10].Value = "0"; xmlNode.Attributes[11].Value = "0"; xmlNode.Attributes[12].Value = "0"; xmlNode.Attributes[13].Value = "0"; xmlNode.Attributes[14].Value = "0"; return nativeDoc; } public static XmlDocument To10(XmlDocument nativeDoc, XmlDocument defaultDoc) { nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 10.ToString(); ChestManager.ClearRefundAndOperateData(nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode)); return nativeDoc; } public static XmlDocument To11(XmlDocument nativeDoc, XmlDocument defaultDoc) { nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 11.ToString(); XmlNode xmlNode = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.ReplayVersion); nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode, true)); return nativeDoc; } public static XmlDocument To12(XmlDocument nativeDoc, XmlDocument defaultDoc) { nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value = 12.ToString(); XmlNode xmlNode = defaultDoc.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.ExtraSlot); nativeDoc.SelectSingleNode(PlayerConfigLabel.RootNode).AppendChild(nativeDoc.ImportNode(xmlNode, true)); return nativeDoc; } }