1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438 |
- 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 ManaData : Regist
- {
- #region 变量
- public static XmlNode PlayerNode
- {
- get
- {
- if (PlayerNode_ == null)
- {
- PlayerNode_ = PlayerDoc.SelectSingleNode("PlayerConfig");
- }
- return PlayerNode_;
- }
- set { PlayerNode_ = value; }
- }
- public static XmlDocument PlayerDoc
- {
- get
- {
- if (PlayerDoc_ == null)
- {
- int defaultVersion;
- int nativeVersion;
- XmlNode node;
- XmlDocument nativeDoc = new XmlDocument();
- string configPath = Application.persistentDataPath + "/PlayerConfig.xml";
- if (File.Exists(configPath))
- {
- try
- {
- StreamReader sr = new StreamReader(configPath);
- 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 null;
- }
-
- TextAsset textAsset = ManaReso.Load<TextAsset>("PlayerConfig", Folder.Config);
- DefaultDoc.LoadXml(textAsset.text);
-
- defaultVersion = int.Parse(DefaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value);
-
- node = nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version");
- if (node == null)
- {
- StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml");
- sw.Write(DefaultDoc.OuterXml);
- sw.Close();
- PlayerDoc_ = DefaultDoc;
- }
- else
- {
- nativeVersion = int.Parse(node.Attributes[0].Value);
-
- if (nativeVersion < defaultVersion)
- {
- byte[] bytes;
- MD5 md5 = new MD5CryptoServiceProvider();
- if (nativeVersion <= 4)
- {
- bytes = Encoding.UTF8.GetBytes(nativeDoc.OuterXml);
- }
- else
- {
- bytes = File.ReadAllBytes(configPath);
- }
- if (PlayerPrefs.GetString(Lib.ConfigPrefs) != "" && PlayerPrefs.GetString("config") != Auxiliary.ToString(md5.ComputeHash(bytes)))
- {
- Debug.LogWarning("Download Archive : MD5 doesn't match");
- //ManaDebug.Log("Download Archive");
- DamageLock = true;
- SerialNumberDownloadLock = false;
- return null;
- }
- else
- {
- PlayerDoc_ = MergeXML(nativeVersion, nativeDoc, DefaultDoc);
- ManaServer.Save();
- }
- }
- else if (nativeVersion > defaultVersion)
- {
- PlayerDoc_ = DefaultDoc;
- }
- else
- {
- byte[] bytes = File.ReadAllBytes(configPath);
- 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 null;
- }
- PlayerDoc_ = nativeDoc;
- }
- }
- }
- else
- {
- TextAsset textAsset = ManaReso.Load<TextAsset>("PlayerConfig", Folder.Config);
- DefaultDoc.LoadXml(textAsset.text);
- Debug.LogWarning("Download Archive");
- //ManaDebug.Log("Download Archive");
- DamageLock = true;
- SerialNumberDownloadLock = false;
- return null;
- }
- }
- 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();
- #endregion
- public void Update()
- {
- if (DamageLock)
- {
- Timer += Time.deltaTime;
- if (Timer >= 30)
- {
- DamageLock = false;
- TextAsset textAsset = ManaReso.Load<TextAsset>("PlayerConfig", Folder.Config);
- PlayerDoc_ = new XmlDocument();
- PlayerDoc_.LoadXml(textAsset.text);
- return;
- }
- }
- if (!SerialNumberDownloadLock)
- {
- if (ManaServer.SerialNumber != "Default")
- {
- SerialNumberDownloadLock = true;
- ManaServer.DownloadBySerialNumber(ManaServer.SerialNumber, RecoveXml);
- }
- }
- }
- public override bool RegistImmed()
- {
- if (base.RegistImmed())
- {
- 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(Application.persistentDataPath + "/PlayerConfig.xml");
-
- sw.Write(doc.OuterXml);
- sw.Close();
- byte[] bytes = File.ReadAllBytes(Application.persistentDataPath + "/PlayerConfig.xml");
- //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 = ManaReso.Load<TextAsset>("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("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value);
- int defaultVersion = int.Parse(DefaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value);
- if (nativeVersion < defaultVersion)
- {
- MergeXML(nativeVersion, PlayerDoc_, DefaultDoc);
- ManaServer.Save();
- }
- else if (nativeVersion > defaultVersion)
- {
- PlayerDoc_ = DefaultDoc;
- }
- DamageLock = false;
- }
- else
- {
- if (!IDDownloadLock)
- {
- if (ManaServer.ID != "Default")
- {
- IDDownloadLock = true;
- Debug.LogWarning("DownloadByID");
- ManaServer.DownloadByID(ManaServer.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 (ManaTutorial.TutorialA || !ManaCenter.Complete)
- {
- return;
- }
-
- XmlNode xmlNode;
- XmlAttribute xmlAttribute;
- xmlNode = PlayerNode.SelectSingleNode("SkillList");
- xmlNode.RemoveAll();
- for (int i = 0; i < ManaCenter.SkillList.Count; i++)
- {
- if (ManaCenter.SkillList[i].SkillType == SkillType.Skill)
- {
- #region Skill
- Skill skill = (Skill)ManaCenter.SkillList[i];
- xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
- xmlAttribute.Value = skill.ID;
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
- xmlAttribute.Value = skill.SkillType.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
- xmlAttribute.Value = skill.ItemStatus.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
- xmlAttribute.Value = skill.Level.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("CoolTimer"));
- xmlAttribute.Value = skill.CoolTimer.ToString("0");
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("UseTimer"));
- xmlAttribute.Value = skill.UseTimer.ToString("0");
- xmlNode = PlayerNode.SelectSingleNode("SkillList");
- #endregion
- }
- else if (ManaCenter.SkillList[i].SkillType == SkillType.Pack)
- {
- #region Pack
- Pack pack = (Pack)ManaCenter.SkillList[i];
- xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
- xmlAttribute.Value = pack.ID;
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
- xmlAttribute.Value = pack.SkillType.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
- xmlAttribute.Value = pack.ItemStatus.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
- xmlAttribute.Value = pack.Level.ToString();
- xmlNode = PlayerNode.SelectSingleNode("SkillList");
- #endregion
- }
- else if (ManaCenter.SkillList[i].SkillType == SkillType.Ability)
- {
- #region Ability
- Ability ability = (Ability)ManaCenter.SkillList[i];
- xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
- xmlAttribute.Value = ability.ID;
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
- xmlAttribute.Value = ability.SkillType.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
- xmlAttribute.Value = ability.ItemStatus.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
- xmlAttribute.Value = ability.Level.ToString();
- xmlNode = PlayerNode.SelectSingleNode("SkillList");
- #endregion
- }
- else if (ManaCenter.SkillList[i].SkillType == SkillType.BigSkill)
- {
- #region BigSkill
- BigSkill bigSkill = (BigSkill)ManaCenter.SkillList[i];
- xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
- xmlAttribute.Value = bigSkill.ID;
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
- xmlAttribute.Value = bigSkill.SkillType.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
- xmlAttribute.Value = bigSkill.ItemStatus.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("BarStatus"));
- xmlAttribute.Value = bigSkill.BarStatus.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
- xmlAttribute.Value = bigSkill.Level.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("CoolTimer"));
- xmlAttribute.Value = bigSkill.CoolTimer.ToString("0");
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("UseTimer"));
- xmlAttribute.Value = bigSkill.UseTimer.ToString("0");
- xmlNode = PlayerNode.SelectSingleNode("SkillList");
- #endregion
- }
- }
- }
- public static void SaveDress()
- {
- XmlNode xmlNode = PlayerNode.SelectSingleNode("DressList");
- xmlNode.Attributes[0].Value = "";
- for (int i = 0; i < ManaPlayer.BoughtCloseList.Count; i++)
- {
- xmlNode.Attributes[0].Value += ManaPlayer.BoughtCloseList[i] + " ";
- }
- xmlNode.Attributes[0].Value = xmlNode.Attributes[0].Value.TrimEnd(' ');
- xmlNode = PlayerNode.SelectSingleNode("DressData");
- for (int i = 0; i < ManaPlayer.DressData.Count; i++)
- {
- xmlNode.Attributes[i].Value = ManaPlayer.DressData[i];
- }
- }
- public static void SaveAchieve()
- {
- XmlNode xmlNode = PlayerNode.SelectSingleNode("AchieveList");
- xmlNode.Attributes[0].Value = "";
- foreach (var kv in ManaAchieve.AchieveDic)
- {
- if (!kv.Value.Lock)
- {
- xmlNode.Attributes[0].Value += kv.Value.ID_ + " ";
- }
- }
- xmlNode.Attributes[0].Value = xmlNode.Attributes[0].Value.TrimEnd(' ');
- PlayerNode.SelectSingleNode("AchieveData").Attributes[0].Value = ManaCenter.AdAmt.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[1].Value = ManaCenter.SkillAmt.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[2].Value = ManaCenter.SignAmt.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[3].Value = ManaCenter.ShareAmt.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[4].Value = ManaCenter.ElfLevel.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[5].Value = ManaCenter.MiniGameAmt.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[6].Value = ManaCenter.FlowerCoin.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[7].Value = ManaCenter.TotalPerson.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[8].Value = ManaCenter.CostDiamond.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[9].Value = ManaCenter.CreateRoomAmt.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[10].Value = ManaCenter.CreateChestAmt.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[11].Value = ManaCenter.CreateLuckyChestAmt.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[12].Value = ManaCenter.CreateGuessColorChestAmt.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[13].Value = ManaCenter.CreateGuessNumberChestAmt.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[14].Value = ManaCenter.GetChestAwardAmt.ToString("0");
- }
- public static void SavePlantList()
- {
- if (ManaVisit.InVisit || ManaTutorial.TutorialA)
- {
- return;
- }
-
- XmlAttributeCollection attribute = PlayerNode.SelectSingleNode("PlantList").Attributes;
- attribute[0].Value = "";
- for (int i = 0; i < ManaGarden.PlantList.Count; i++)
- {
- Slot slot = ManaGarden.PlantList[i];
-
- attribute[0].Value += slot.ID + "," + slot.Index + " ";
- }
- attribute[0].Value = attribute[0].Value.TrimEnd(' ');
- }
- public static void SaveCommon()
- {
- PlayerNode.SelectSingleNode("Coin").Attributes[0].Value = ManaCenter.Coin.ToString("0");
- PlayerNode.SelectSingleNode("Diamond").Attributes[0].Value = ManaCenter.Diamond.ToString("0");
-
- PlayerNode.SelectSingleNode("SignTime").Attributes[0].Value = ManaSign.SignTime.ToString();
- PlayerNode.SelectSingleNode("SignIndex").Attributes[0].Value = ManaSign.SignIndex.ToString();
- PlayerNode.SelectSingleNode("SignRound").Attributes[0].Value = ManaSign.SignRound.ToString();
-
- PlayerNode.SelectSingleNode("QuitFlag").Attributes[0].Value = ManaServer.Connect.ToInt().ToString();
- PlayerNode.SelectSingleNode("QuitTime").Attributes[0].Value = ManaServer.Time.ToString();
- PlayerNode.SelectSingleNode("MiniTimer").Attributes[0].Value = ManaCenter.MiniTimer.ToString("0");
- PlayerNode.SelectSingleNode("CircleTimer").Attributes[0].Value = ManaCenter.CircleTimer.ToString("0");
- PlayerNode.SelectSingleNode("ID").Attributes[0].Value = ManaServer.ID;
- PlayerNode.SelectSingleNode("SerialNumber").Attributes[0].Value = ManaServer.SerialNumber;
- PlayerNode.SelectSingleNode("Language").Attributes[0].Value = ManaLan.CurrentLan.ToString();
- PlayerNode.SelectSingleNode("MiniGameIndex").Attributes[0].Value = ManaMiniGame.MiniGameIndex.ToString();
- PlayerNode.SelectSingleNode("TutorialA").Attributes[0].Value = ManaTutorial.TutorialA.ToInt().ToString();
- PlayerNode.SelectSingleNode("TutorialB").Attributes[0].Value = ManaTutorial.TutorialB_.ToInt().ToString();
- PlayerNode.SelectSingleNode("TutorialC").Attributes[0].Value = ManaTutorial.TutorialC_.ToInt().ToString();
- PlayerNode.SelectSingleNode("TutorialD").Attributes[0].Value = ManaTutorial.TutorialD_.ToInt().ToString();
- PlayerNode.SelectSingleNode("TutorialE").Attributes[0].Value = ManaTutorial.TutorialE_.ToInt().ToString();
- PlayerNode.SelectSingleNode("TutorialPlazaRoom").Attributes[0].Value = ManaTutorial.TutorialPlazaRoom_.ToInt().ToString();
- PlayerNode.SelectSingleNode("TutorialIndexA").Attributes[0].Value = ManaTutorial.TutorialIndexA.ToString();
- PlayerNode.SelectSingleNode("TutorialIndexB").Attributes[0].Value = ManaTutorial.TutorialIndexB.ToString();
- PlayerNode.SelectSingleNode("TutorialIndexC").Attributes[0].Value = ManaTutorial.TutorialIndexC.ToString();
- PlayerNode.SelectSingleNode("TutorialIndexD").Attributes[0].Value = ManaTutorial.TutorialIndexD.ToString();
- PlayerNode.SelectSingleNode("TutorialIndexE").Attributes[0].Value = ManaTutorial.TutorialIndexE.ToString();
- PlayerNode.SelectSingleNode("TutorialIndexPlazaRoom").Attributes[0].Value = ManaTutorial.TutorialIndexPlazaRoom.ToString();
- }
- public static void SaveFlowers()
- {
- XmlAttribute attribute = PlayerNode.SelectSingleNode("FlowerList").Attributes[0];
- XmlAttribute attribute1 = PlayerNode.SelectSingleNode("FlowerAmtList").Attributes[0];
- attribute.Value = "";
- attribute1.Value = "";
- foreach (var kv in ManaGarden.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();
- ChestMge.Save();
- }
- }
- public static void ResetPlayerConfig()
- {
- PlayerNode.SelectSingleNode("Version").Attributes[0].Value = "10000";
- SavePlayerConfig();
- ManaCenter.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<int> GetIntList(char splitChar, string nodeName, List<int> defaultList)
- {
- return Auxiliary.IntListParse(splitChar, PlayerNode.SelectSingleNode(nodeName).Attributes[0].Value, defaultList);
- }
- public static List<string> GetStringList(char splitChar, string nodeName, List<string> defaultList)
- {
- return Auxiliary.StringListParse(splitChar, PlayerNode.SelectSingleNode(nodeName).Attributes[0].Value, defaultList);
- }
- public static List<int> GetDressList()
- {
- List<int> list = new List<int>();
- XmlAttributeCollection attribute = PlayerNode.SelectSingleNode("DressList").Attributes;
- return Auxiliary.IntListParse(' ', attribute[0].Value, list);
- }
- public static List<int> GetDressDataIDs(Player player)
- {
- //foreach (var VARIABLE in ManaPlayer.CloseIDDic)
- //{
- // Debug.LogWarning(VARIABLE.Key);
- //}
- List<int> dressDataIDs = new List<int>();
- dressDataIDs.Add(ManaPlayer.CloseIDDic[player.Head]);
- dressDataIDs.Add(ManaPlayer.CloseIDDic[player.Dress]);
- dressDataIDs.Add(ManaPlayer.CloseIDDic[player.Shoe]);
- dressDataIDs.Add(ManaPlayer.CloseIDDic[player.HeadWear]);
- dressDataIDs.Add(ManaPlayer.CloseIDDic[player.Top]);
- dressDataIDs.Add(ManaPlayer.CloseIDDic[player.Eye]);
- dressDataIDs.Add(ManaPlayer.CloseIDDic[player.Mouse]);
- dressDataIDs.Add(ManaPlayer.CloseIDDic[player.Wing]);
- return dressDataIDs;
- }
- public static List<int> GetDressDataIDs(ISFSObject parameter)
- {
- List<int> ids = parameter.GetIntArray(InfoLabel.Close.GetHashString()).ToList();
- return ids;
- }
- public static List<string> GetDressData(SFSObject parameter)
- {
- List<int> ids = GetDressDataIDs(parameter);
- List<string> dressData = new List<string>();
- foreach (var id in ids)
- {
- dressData.Add(ManaPlayer.CloseUnitDic[id].ArmatureName);
- }
- return dressData;
- }
- public static List<string> GetDressData(XmlNode node = null)
- {
- XmlNode xmlNode;
- if (node == null)
- {
- xmlNode = PlayerNode.SelectSingleNode("DressData");
- }
- else
- {
- xmlNode = node.SelectSingleNode("DressData");
- }
- List<string> dataList = new List<string>();
- 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<int> GetFlowerList()
- {
- List<int> list = new List<int>();
- XmlAttributeCollection attribute = PlayerNode.SelectSingleNode("FlowerList").Attributes;
- return Auxiliary.IntListParse(' ', attribute[0].Value, list);
- }
- public static List<int> GetAchieveList()
- {
- return Auxiliary.IntListParse(' ', GetPlayerString("AchieveList"), new List<int>());
- }
- public static List<string> GetOfflineConfig()
- {
- TextAsset textAsset = ManaReso.Load<TextAsset>("offline_config", Folder.Config);
- XmlDocument xmlDoc = new XmlDocument();
- xmlDoc.LoadXml(textAsset.text);
- XmlNode xmlNode = xmlDoc.SelectSingleNode("data").SelectSingleNode("item");
- List<string> strList = new List<string>()
- {
- xmlNode.Attributes[1].Value,
- xmlNode.Attributes[2].Value,
- xmlNode.Attributes[3].Value,
- };
- return strList;
- }
- public static List<double> GetAchieveData()
- {
- List<double> dataList = new List<double>();
- dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[0].Value));
- dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[1].Value));
- dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[2].Value));
- dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[3].Value));
- dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[4].Value));
- dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[5].Value));
- dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[6].Value));
- dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[7].Value));
- dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[8].Value));
- dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[9].Value));
- dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[10].Value));
- dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[11].Value));
- dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[12].Value));
- dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[13].Value));
- dataList.Add(double.Parse(PlayerNode.SelectSingleNode("AchieveData").Attributes[14].Value));
- return dataList;
- }
- public static List<KV<int, int>> GetPlantList(XmlNode node = null)
- {
- List<KV<int, int>> list = new List<KV<int, int>>();
- XmlNode xmlNode;
- if (node == null)
- {
- xmlNode = PlayerNode.SelectSingleNode("PlantList");
- }
- else
- {
- xmlNode = node.SelectSingleNode("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, int>(int.Parse(strings[i].Split(',')[0]), int.Parse(strings[i].Split(',')[1])));
- }
- }
- return list;
- }
- public static List<XmlAttributeCollection> GetSkillList(XmlNode node = null)
- {
- List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
- XmlNodeList xmlNodeList;
- if (node == null)
- {
- xmlNodeList = PlayerNode.SelectSingleNode("SkillList").ChildNodes;
- }
- else
- {
- xmlNodeList = node.SelectSingleNode("SkillList").ChildNodes;
- }
- for (int i = 0; i < xmlNodeList.Count; i++)
- {
- attributeList.Add(xmlNodeList[i].Attributes);
- }
- return attributeList;
- }
- public static XmlAttributeCollection GetVisitConfig()
- {
- TextAsset textAsset = ManaReso.Load<TextAsset>("visit_config", Folder.Config);
- XmlDocument xmlDoc = new XmlDocument();
- xmlDoc.LoadXml(textAsset.text);
- XmlNode xmlNode = xmlDoc.SelectSingleNode("data").SelectSingleNode("item");
- return xmlNode.Attributes;
- }
- public static XmlAttributeCollection GetPlazaRoomConfig()
- {
- TextAsset textAsset = ManaReso.Load<TextAsset>("plaza_room_config", Folder.Config);
- XmlDocument xmlDoc = new XmlDocument();
- xmlDoc.LoadXml(textAsset.text);
- XmlNode xmlNode = xmlDoc.SelectSingleNode("data").SelectSingleNode("item");
- return xmlNode.Attributes;
- }
- public static XmlAttributeCollection GetAwardConfig()
- {
- TextAsset textAsset = ManaReso.Load<TextAsset>("award_config", Folder.Config);
- XmlDocument xmlDoc = new XmlDocument();
- xmlDoc.LoadXml(textAsset.text);
- XmlNode xmlNode = xmlDoc.SelectSingleNode("data").SelectSingleNode("item");
- return xmlNode.Attributes;
- }
- public static List<XmlAttributeCollection> GetIAPConfig()
- {
- TextAsset textAsset;
- XmlNodeList xmlNodeList;
- XmlDocument xmlDoc = new XmlDocument();
- List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
- textAsset = ManaReso.Load<TextAsset>("iap_config", Folder.Config);
- xmlDoc.LoadXml(textAsset.text);
- xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
- for (int i = 0; i < xmlNodeList.Count; i++)
- {
- attributeList.Add(xmlNodeList[i].Attributes);
- }
- return attributeList;
- }
- public static List<XmlAttributeCollection> GetSkillConfig()
- {
- TextAsset textAsset;
- XmlDocument xmlDoc = new XmlDocument();
- List<XmlNodeList> xmlNodeList = new List<XmlNodeList>();
- List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
-
- textAsset = ManaReso.Load<TextAsset>("pack_config", Folder.Config);
- xmlDoc.LoadXml(textAsset.text);
- xmlNodeList.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
-
- textAsset = ManaReso.Load<TextAsset>("skill_config", Folder.Config);
- xmlDoc.LoadXml(textAsset.text);
- xmlNodeList.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
-
- textAsset = ManaReso.Load<TextAsset>("ability_config", Folder.Config);
- xmlDoc.LoadXml(textAsset.text);
- xmlNodeList.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
- 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<XmlAttributeCollection> GetSignConfig()
- {
- TextAsset textAsset;
- XmlNodeList xmlNodeList;
- XmlDocument xmlDoc = new XmlDocument();
- List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
-
- textAsset = ManaReso.Load<TextAsset>("signin_config", Folder.Config);
- xmlDoc.LoadXml(textAsset.text);
- xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
-
- for (int i = 0; i < xmlNodeList.Count; i++)
- {
- attributeList.Add(xmlNodeList[i].Attributes);
- }
- return attributeList;
- }
- public static List<XmlAttributeCollection> GetFlowerConfig()
- {
- TextAsset textAsset;
- XmlNodeList xmlNodeList;
- XmlDocument xmlDoc = new XmlDocument();
- List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
-
- textAsset = ManaReso.Load<TextAsset>("flower_config", Folder.Config);
- xmlDoc.LoadXml(textAsset.text);
- xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
- for (int i = 0; i < xmlNodeList.Count; i++)
- {
- attributeList.Add(xmlNodeList[i].Attributes);
- }
- return attributeList;
- }
- public static List<XmlAttributeCollection> GetLotteryConfig()
- {
- TextAsset textAsset;
- XmlNodeList xmlNodeList;
- XmlDocument xmlDoc = new XmlDocument();
- List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
- textAsset = ManaReso.Load<TextAsset>("lottery_config", Folder.Config);
- xmlDoc.LoadXml(textAsset.text);
- xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
- for (int i = 0; i < xmlNodeList.Count; i++)
- {
- attributeList.Add(xmlNodeList[i].Attributes);
- }
- return attributeList;
- }
- public static List<XmlAttributeCollection> GetAchieveConfig()
- {
- TextAsset textAsset;
- XmlNodeList xmlNodeList;
- XmlDocument xmlDoc = new XmlDocument();
- List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
- textAsset = ManaReso.Load<TextAsset>("achieve_config", Folder.Config);
- xmlDoc.LoadXml(textAsset.text);
- xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
- for (int i = 0; i < xmlNodeList.Count; i++)
- {
- attributeList.Add(xmlNodeList[i].Attributes);
- }
- return attributeList;
- }
- public static List<XmlAttributeCollection> GetDressRoomConfig()
- {
- TextAsset textAsset;
- XmlNodeList xmlNodeList;
- XmlDocument xmlDoc = new XmlDocument();
- List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
- textAsset = ManaReso.Load<TextAsset>("dressRoom_config", Folder.Config);
- xmlDoc.LoadXml(textAsset.text);
- xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
- for (int i = 0; i < xmlNodeList.Count; i++)
- {
- attributeList.Add(xmlNodeList[i].Attributes);
- }
- return attributeList;
- }
- public static XmlDocument GetXmlDocument(string ConfigName)
- {
- TextAsset textAsset = ManaReso.Load<TextAsset>(ConfigName, Folder.Config);
- XmlDocument xmlDocument = new XmlDocument();
- xmlDocument.LoadXml(textAsset.text);
- return xmlDocument;
- }
- 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);
- }
- return nativeDoc;
- }
- public static XmlDocument To0(XmlDocument nativeDoc, XmlDocument defaultDoc)
- {
- nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 0.ToString();
- XmlNode xmlNode1 = defaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("ADPlayTime");
- nativeDoc.SelectSingleNode("PlayerConfig").AppendChild(nativeDoc.ImportNode(xmlNode1, true));
- return nativeDoc;
- }
- public static XmlDocument To1(XmlDocument nativeDoc, XmlDocument defaultDoc)
- {
- nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 1.ToString();
- XmlNode xmlNode1 = defaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("SerialNumber");
- nativeDoc.SelectSingleNode("PlayerConfig").AppendChild(nativeDoc.ImportNode(xmlNode1, true));
- return nativeDoc;
- }
- public static XmlDocument To2(XmlDocument nativeDoc, XmlDocument defaultDoc)
- {
- nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 2.ToString();
- XmlNode xmlNode1 = defaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("NotificationIndex");
- nativeDoc.SelectSingleNode("PlayerConfig").AppendChild(nativeDoc.ImportNode(xmlNode1, true));
- return nativeDoc;
- }
- public static XmlDocument To3(XmlDocument nativeDoc, XmlDocument defaultDoc)
- {
- nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 3.ToString();
- XmlNode xmlNode1 = defaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("NickName");
- nativeDoc.SelectSingleNode("PlayerConfig").AppendChild(nativeDoc.ImportNode(xmlNode1, true));
- return nativeDoc;
- }
- public static XmlDocument To4(XmlDocument nativeDoc, XmlDocument defaultDoc)
- {
- nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 4.ToString();
- XmlNode xmlNode = nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("DressData");
- XmlAttribute attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute ("LeftLongSleeveSlot"));
- attribute.Value="Empty";
- attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute ("LeftShortSleeveSlot"));
- attribute.Value="Empty";
- attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute ("RightLongSleeveSlot"));
- attribute.Value="Empty";
- attribute = xmlNode.Attributes.Append (nativeDoc.CreateAttribute ("RightShortSleeveSlot"));
- attribute.Value="Empty";
- List<string> 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<string> GetSleeveListByTop(string topName)
- {
- List<string> sleeveList = new List<string>() {"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("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 5.ToString();
- return nativeDoc;
- }
- public static XmlDocument To6(XmlDocument nativeDoc, XmlDocument defaultDoc)
- {
- nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 6.ToString();
- XmlNode xmlNode1 = defaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("NewFlowerFlag");
- nativeDoc.SelectSingleNode("PlayerConfig").AppendChild(nativeDoc.ImportNode(xmlNode1, true));
- return nativeDoc;
- }
- public static XmlDocument To7(XmlDocument nativeDoc, XmlDocument defaultDoc)
- {
- nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 7.ToString();
- XmlNode xmlNode1 = nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("FlowerList");
- string[] flowerIDs= xmlNode1.Attributes[0].Value.Split(' ');
- xmlNode1 = defaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("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("PlayerConfig").AppendChild(nativeDoc.ImportNode(xmlNode1, true));
- return nativeDoc;
- }
- public static XmlDocument To8(XmlDocument nativeDoc, XmlDocument defaultDoc)
- {
- nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 8.ToString();
- XmlNode xmlNode0 = defaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("TutorialPlazaRoom");
- XmlNode xmlNode1 = defaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("TutorialIndexPlazaRoom");
- nativeDoc.SelectSingleNode("PlayerConfig").AppendChild(nativeDoc.ImportNode(xmlNode0, true));
- nativeDoc.SelectSingleNode("PlayerConfig").AppendChild(nativeDoc.ImportNode(xmlNode1, true));
- return nativeDoc;
- }
- public static XmlDocument To9(XmlDocument nativeDoc, XmlDocument defaultDoc)
- {
- nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 9.ToString();
- XmlNode xmlNode = nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("AchieveData");
- xmlNode.Attributes.Append(nativeDoc.CreateAttribute("CreateRoomAmt"));
- xmlNode.Attributes.Append(nativeDoc.CreateAttribute("CreateChestAmt"));
- xmlNode.Attributes.Append(nativeDoc.CreateAttribute("CreateLuckyChestAmt"));
- xmlNode.Attributes.Append(nativeDoc.CreateAttribute("CreateGuessColorChestAmt"));
- xmlNode.Attributes.Append(nativeDoc.CreateAttribute("CreateGuessNumberChestAmt"));
- xmlNode.Attributes.Append(nativeDoc.CreateAttribute("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("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value = 10.ToString();
- ChestMge.ClearRefundAndOperateData(nativeDoc.SelectSingleNode("PlayerConfig"));
- return nativeDoc;
- }
- }
|