123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780 |
- using UnityEngine;
- using System;
- using System.IO;
- using System.Xml;
- using System.Text;
- using System.Collections;
- using System.Collections.Generic;
- public class Data
- {
- #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 version = 0;
- int nativeVersion = 0;
- XmlNode temoNode;
- XmlDocument tempDoc1;
- XmlDocument tempDoc2;
- FileInfo fileInfo = new FileInfo(Application.persistentDataPath + "/PlayerConfig.xml");
-
- if (fileInfo.Exists)
- {
- StreamReader sr = new StreamReader(Application.persistentDataPath + "/PlayerConfig.xml");
- tempDoc1 = new XmlDocument();
- tempDoc1.LoadXml(sr.ReadToEnd());
- sr.Close();
- TextAsset textAsset = Bundle.Config.LoadAsset<TextAsset>("PlayerConfig");
- tempDoc2 = new XmlDocument();
- tempDoc2.LoadXml(textAsset.text);
-
- version = int.Parse(tempDoc2.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value);
- temoNode = tempDoc1.SelectSingleNode("PlayerConfig").SelectSingleNode("Version");
- if (temoNode == null)
- {
- StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml");
- sw.Write(tempDoc2.OuterXml);
- sw.Close();
- _PlayerDoc = tempDoc2;
- }
- else
- {
- nativeVersion = int.Parse(temoNode.Attributes[0].Value);
- if (nativeVersion != version)
- {
- StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml");
- sw.Write(tempDoc2.OuterXml);
- sw.Close();
- _PlayerDoc = tempDoc2;
- }
- else
- {
- _PlayerDoc = tempDoc1;
- }
- }
- }
- else
- {
- TextAsset textAsset = Bundle.Config.LoadAsset<TextAsset>("PlayerConfig");
- tempDoc2 = new XmlDocument();
- tempDoc2.LoadXml(textAsset.text);
- StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml");
- sw.Write(tempDoc2.OuterXml);
- sw.Close();
- _PlayerDoc = tempDoc2;
- _PlayerDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("QuitTime").Attributes[0].Value = DateTime.Now.ToString();
- }
- }
- return _PlayerDoc;
- }
- set { _PlayerDoc = value; }
- }
- private static XmlNode _PlayerNode;
- private static XmlDocument _PlayerDoc;
- #endregion
- public static void SaveXml()
- {
- StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml");
- sw.Write(PlayerDoc.OuterXml);
- sw.Close();
- }
- private static void SaveSkillList()
- {
- XmlNode xmlNode;
- XmlAttribute xmlAttribute;
- xmlNode = PlayerNode.SelectSingleNode("SkillList");
- xmlNode.RemoveAll();
- for (int i = 0; i < ManaData.SkillList.Count; i++)
- {
- if (ManaData.SkillList[i].SkillType == SkillType.Skill)
- {
- #region Skill
- Skill skill = (Skill)ManaData.SkillList[i];
- xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
- xmlAttribute.Value = skill.ID.ToString();
- 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("CdTimer"));
- xmlAttribute.Value = skill.CoolTimer.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("EffectTimer"));
- xmlAttribute.Value = skill.UseTimer.ToString();
- xmlNode = PlayerNode.SelectSingleNode("SkillList");
- #endregion
- }
- else if (ManaData.SkillList[i].SkillType == SkillType.Pack)
- {
- #region Pack
- Pack pack = (Pack)ManaData.SkillList[i];
- xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
- xmlAttribute.Value = pack.ID.ToString();
- 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 (ManaData.SkillList[i].SkillType == SkillType.Ability)
- {
- #region Ability
- Ability ability = (Ability)ManaData.SkillList[i];
- xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
- xmlAttribute.Value = ability.ID.ToString();
- 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 (ManaData.SkillList[i].SkillType == SkillType.BigSkill)
- {
- #region BigSkill
- BigSkill bigSkill = (BigSkill)ManaData.SkillList[i];
- xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
- xmlAttribute.Value = bigSkill.ID.ToString();
- 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("CdTimer"));
- xmlAttribute.Value = bigSkill.CoolTimer.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("EffectTimer"));
- xmlAttribute.Value = bigSkill.UseTimer.ToString();
- xmlNode = PlayerNode.SelectSingleNode("SkillList");
- #endregion
- }
- }
- }
- private static void SaveAchieve()
- {
- XmlNode xmlNode = PlayerNode.SelectSingleNode("AchieveList");
- xmlNode.Attributes[0].Value = "";
- foreach (var kv in ManaAchieve.AchieveDic)
- {
- if (!kv.Value.Available)
- {
- xmlNode.Attributes[0].Value += kv.Value.ID_ + " ";
- }
- }
- xmlNode.Attributes[0].Value = xmlNode.Attributes[0].Value.TrimEnd(' ');
- PlayerNode.SelectSingleNode("AchieveData").Attributes[0].Value = ManaData.AD.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[1].Value = ManaData.Skill.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[2].Value = ManaData.SignAmt.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[3].Value = ManaData.Share.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[4].Value = ManaData.MiniGameAmt.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[5].Value = ManaData.FlowerCoin.ToString("0");
- PlayerNode.SelectSingleNode("AchieveData").Attributes[6].Value = ManaData.TotalPerson.ToString("0");
- }
- private static void SavePlantList()
- {
- XmlAttributeCollection attribute = PlayerNode.SelectSingleNode("PlantList").Attributes;
- for (int i = 0; i < ManaGarden.PlantList.Count; i++)
- {
- Slot slot = ManaGarden.PlantList[i];
- attribute[0].Value = slot.ID + "," + slot.name;
- if (i < ManaGarden.PlantList.Count - 1)
- {
- attribute[0].Value += " ";
- }
- }
- }
- private static void SaveCommon()
- {
- PlayerNode.SelectSingleNode("SignIndex").Attributes[0].Value = ManaSign.SignIndex.ToString();
- PlayerNode.SelectSingleNode("Coin").Attributes[0].Value = ManaData.Coin.ToString("0");
- PlayerNode.SelectSingleNode("Level").Attributes[0].Value = ManaData.Level.ToString();
- PlayerNode.SelectSingleNode("Diamond").Attributes[0].Value = ManaData.Diamond.ToString();
- PlayerNode.SelectSingleNode("QuitTime").Attributes[0].Value = DateTime.Now.ToString();
- PlayerNode.SelectSingleNode("MiniTimer").Attributes[0].Value = ManaData.MiniTimer.ToString();
- PlayerNode.SelectSingleNode("CircleTimer").Attributes[0].Value = ManaData.CircleTimer.ToString();
- PlayerNode.SelectSingleNode("MiniGameIndex").Attributes[0].Value = ManaMiniGame.MiniGameIndex.ToString();
- PlayerNode.SelectSingleNode("Player").Attributes[0].Value = Tutorial.SelectPlayer;
- }
- private static void SaveFlowerList()
- {
- XmlAttribute attribute = PlayerNode.SelectSingleNode("FlowerList").Attributes[0];
- attribute.Value = "";
- foreach (var kv in ManaGarden.FlowerInfoDic)
- {
- if (kv.Value.Unlock)
- {
- attribute.Value += kv.Value.ID_ + " ";
- }
- }
- attribute.Value = attribute.Value.Trim(' ');
- }
- public static void SavePlayerConfig()
- {
- SaveSkillList();
- SaveAchieve();
- SavePlantList();
- SaveCommon();
- SaveFlowerList();
- SaveXml();
- }
- private static void ResetSkillList()
- {
- XmlNode xmlNode;
- XmlAttribute xmlAttribute;
- xmlNode = PlayerNode.SelectSingleNode("SkillList");
- xmlNode.RemoveAll();
- for (int i = 0; i < ManaData.SkillList.Count; i++)
- {
- if (ManaData.SkillList[i].SkillType == SkillType.Skill)
- {
- #region Skill
- Skill skill = (Skill)ManaData.SkillList[i];
- xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
- xmlAttribute.Value = skill.ID.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
- xmlAttribute.Value = skill.SkillType.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
- xmlAttribute.Value = SkillStatus.Lock.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
- xmlAttribute.Value = 0.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("CdTimer"));
- xmlAttribute.Value = 0.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("EffectTimer"));
- xmlAttribute.Value = 0.ToString();
- xmlNode = PlayerNode.SelectSingleNode("SkillList");
- #endregion
- }
- else if (ManaData.SkillList[i].SkillType == SkillType.Pack)
- {
- #region Pack
- Pack pack = (Pack)ManaData.SkillList[i];
- xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
- xmlAttribute.Value = pack.ID.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
- xmlAttribute.Value = pack.SkillType.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
- xmlAttribute.Value = SkillStatus.Lock.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
- xmlAttribute.Value = 0.ToString();
- xmlNode = PlayerNode.SelectSingleNode("SkillList");
- #endregion
- }
- else if (ManaData.SkillList[i].SkillType == SkillType.Ability)
- {
- #region Ability
- Ability ability = (Ability)ManaData.SkillList[i];
- xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
- xmlAttribute.Value = ability.ID.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
- xmlAttribute.Value = ability.SkillType.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
- xmlAttribute.Value = SkillStatus.Lock.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
- xmlAttribute.Value = 0.ToString();
- xmlNode = PlayerNode.SelectSingleNode("SkillList");
- #endregion
- }
- else if (ManaData.SkillList[i].SkillType == SkillType.BigSkill)
- {
- #region BigSkill
- BigSkill bigSkill = (BigSkill)ManaData.SkillList[i];
- xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, "Skill", ""));
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ID"));
- xmlAttribute.Value = bigSkill.ID.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("SkillType"));
- xmlAttribute.Value = bigSkill.SkillType.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("ItemStatus"));
- xmlAttribute.Value = SkillStatus.Lock.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("BarStatus"));
- xmlAttribute.Value = SkillStatus.Buy.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("Level"));
- xmlAttribute.Value = 0.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("CdTimer"));
- xmlAttribute.Value = 0.ToString();
- xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("EffectTimer"));
- xmlAttribute.Value = 0.ToString();
- xmlNode = PlayerNode.SelectSingleNode("SkillList");
- #endregion
- }
- }
- }
- private static void ResetAchieve()
- {
- XmlNode xmlNode = PlayerNode.SelectSingleNode("AchieveList");
- xmlNode.Attributes[0].Value = "";
- PlayerNode.SelectSingleNode("AchieveData").Attributes[0].Value = "0";
- PlayerNode.SelectSingleNode("AchieveData").Attributes[1].Value = "0";
- PlayerNode.SelectSingleNode("AchieveData").Attributes[2].Value = "0";
- PlayerNode.SelectSingleNode("AchieveData").Attributes[3].Value = "0";
- PlayerNode.SelectSingleNode("AchieveData").Attributes[4].Value = "0";
- PlayerNode.SelectSingleNode("AchieveData").Attributes[5].Value = "0";
- PlayerNode.SelectSingleNode("AchieveData").Attributes[6].Value = "0";
- }
- private static void ResetPlantList()
- {
- XmlNode xmlNode = PlayerNode.SelectSingleNode("PlantList");
- xmlNode.Attributes[0].Value = "";
- }
- private static void ResetCommon()
- {
- PlayerNode.SelectSingleNode("Slot").Attributes[0].Value = "1";
- PlayerNode.SelectSingleNode("SignIndex").Attributes[0].Value = "1";
- PlayerNode.SelectSingleNode("Coin").Attributes[0].Value = "0";
- PlayerNode.SelectSingleNode("Level").Attributes[0].Value = "0";
- PlayerNode.SelectSingleNode("Diamond").Attributes[0].Value = "0";
- PlayerNode.SelectSingleNode("QuitTime").Attributes[0].Value = DateTime.Now.ToString();
- PlayerNode.SelectSingleNode("MiniTimer").Attributes[0].Value = "0";
- PlayerNode.SelectSingleNode("CircleTimer").Attributes[0].Value = "10";
- PlayerNode.SelectSingleNode("MiniGameIndex").Attributes[0].Value = "0";
- PlayerNode.SelectSingleNode("Player").Attributes[0].Value = "PlayerBlond";
- PlayerNode.SelectSingleNode("TutorialA").Attributes[0].Value = "0";
- PlayerNode.SelectSingleNode("TutorialB").Attributes[0].Value = "0";
- PlayerNode.SelectSingleNode("TutorialIndexA").Attributes[0].Value = "1";
- PlayerNode.SelectSingleNode("TutorialIndexB").Attributes[0].Value = "1";
- }
- private static void ResetFlowerList()
- {
- XmlAttribute attribute = PlayerNode.SelectSingleNode("FlowerList").Attributes[0];
- attribute.Value = "1";
- }
- public static void ResetPlayerConfig()
- {
- ResetSkillList();
- ResetAchieve();
- ResetPlantList();
- ResetCommon();
- ResetFlowerList();
- SaveXml();
- }
- public static int GetPlayerInt(string node)
- {
- return int.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value);
- }
- public static bool GetPlayerBool(string node)
- {
- return Convert.ToBoolean(int.Parse(PlayerNode.SelectSingleNode(node).Attributes[0].Value));
- }
- 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();
- SaveXml();
- }
- public static void SavePlayerBool(string node, bool value)
- {
- string str;
- if (value)
- {
- str = "1";
- }
- else
- {
- str = "0";
- }
- PlayerNode.SelectSingleNode(node).Attributes[0].Value = str;
- SaveXml();
- }
- public static void SavePlayerFloat(string node, float value)
- {
- PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToString();
- SaveXml();
- }
- public static void SavePlayerString(string node, string value)
- {
- PlayerNode.SelectSingleNode(node).Attributes[0].Value = value;
- SaveXml();
- }
- public static void SavePlayerDouble(string node, double value)
- {
- PlayerNode.SelectSingleNode(node).Attributes[0].Value = value.ToString();
- SaveXml();
- }
- public static List<int> GetFlowerList()
- {
- List<int> list = new List<int>();
- XmlAttributeCollection attribute = PlayerNode.SelectSingleNode("FlowerList").Attributes;
- if (!string.IsNullOrEmpty(attribute[0].Value))
- {
- string[] strings = attribute[0].Value.Split(' ');
- for (int i = 0; i < strings.Length; i++)
- {
- list.Add(int.Parse(strings[i]));
- }
- }
- return list;
- }
- public static List<int> GetAchieveList()
- {
- return Auxiliary.IntListParse(' ', GetPlayerString("AchieveList"), new List<int>());
- }
- 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));
- return dataList;
- }
- public static List<KV<int, string>> GetPlantList()
- {
- List<KV<int, string>> list = new List<KV<int, string>>();
- XmlNode xmlNode = PlayerNode.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, string>(int.Parse(strings[i].Split(',')[0]), strings[i].Split(',')[1]));
- }
- }
- return list;
- }
- public static List<XmlAttributeCollection> GetSkillList()
- {
- List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
- XmlNodeList xmlNodeList = PlayerNode.SelectSingleNode("SkillList").ChildNodes;
- for (int i = 0; i < xmlNodeList.Count; i++)
- {
- attributeList.Add(xmlNodeList[i].Attributes);
- }
- return attributeList;
- }
- public static XmlAttributeCollection GetAwardConfig()
- {
- TextAsset textAsset;
- XmlDocument xmlDoc = new XmlDocument();
-
- textAsset = Bundle.Config.LoadAsset<TextAsset>("award_config");
- xmlDoc.LoadXml(textAsset.text);
- XmlNode xmlNode = xmlDoc.SelectSingleNode("data").SelectSingleNode("item");
- return xmlNode.Attributes;
- }
- public static List<XmlAttributeCollection> GetSkillConfig()
- {
- TextAsset textAsset;
- XmlDocument xmlDoc = new XmlDocument();
- List<XmlNodeList> xmlNodeLists = new List<XmlNodeList>();
- List<XmlAttributeCollection> attributeList = new List<XmlAttributeCollection>();
-
- textAsset = Bundle.Config.LoadAsset<TextAsset>("pack_config");
- xmlDoc.LoadXml(textAsset.text);
- xmlNodeLists.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
-
- textAsset = Bundle.Config.LoadAsset<TextAsset>("skill_config");
- xmlDoc.LoadXml(textAsset.text);
- xmlNodeLists.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
-
- textAsset = Bundle.Config.LoadAsset<TextAsset>("ability_config");
- xmlDoc.LoadXml(textAsset.text);
- xmlNodeLists.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
- for (int i = 0; i < xmlNodeLists.Count; i++)
- {
- for (int j = 0; j < xmlNodeLists[i].Count; j++)
- {
- attributeList.Add(xmlNodeLists[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 = Bundle.Config.LoadAsset<TextAsset>("signin_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 = Bundle.Config.LoadAsset<TextAsset>("flower_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 = Bundle.Config.LoadAsset<TextAsset>("achieve_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;
- }
- }
|