LiuQilin 8 سال پیش
والد
کامیت
ca745eb16b

BIN
.vs/MyLovelyGarden/v14/.suo


+ 36 - 15
Assets/Resources/XML/Config/PlayerConfig.xml

@@ -1,18 +1,39 @@
-<PlayerConfig>
-  <Coin></Coin>
-  <Level></Level>
-  <Person></Person>
-  <Diamond></Diamond>
-  <QuitTime></QuitTime>
-  <CoinPerson></CoinPerson>
-
-  <技能>
-    <人潮涌动 Status="" Level=""/>
-  </技能>
-
-  <ProcessorList>
-  </ProcessorList>
-
+<PlayerConfig>
+  <Coin value="0" />
+  <Level value="0" />
+  <Person value="1" />
+  <Diamond value="0" />
+  <QuitTime value="" />
+  <CoinPerson value="1" />
+  <Skill>
+    <免费获取钻石 status="Lock" level="Level" />
+    <免费获取金币 status="Lock" level="Level" />
+    <繁花似锦 status="Lock" level="Level" />
+  </Skill>
+  <Ability>
+    <黄色小蜜蜂 status="Lock" level="Level" />
+    <花园 status="Lock" level="Level" />
+    <紫色小蜜蜂 status="Lock" level="Level" />
+    <蓝色小蜜蜂 status="Lock" level="Level" />
+    <红色小蜜蜂 status="Lock" level="Level" />
+    <白色小蜜蜂 status="Lock" level="Level" />
+    <炼金石 status="Lock" level="Level" />
+    <黄色小蝴蝶 status="Lock" level="Level" />
+    <神秘灌木 status="Lock" level="Level" />
+    <紫色小蝴蝶 status="Lock" level="Level" />
+    <滴哩哩的小黄鹂 status="Lock" level="Level" />
+    <蓝色小蝴蝶 status="Lock" level="Level" />
+    <红色小蝴蝶 status="Lock" level="Level" />
+    <白色小蝴蝶 status="Lock" level="Level" />
+  </Ability>
+  <BigSkill>
+    <技能冷却 status="Lock" level="Level" />
+    <人潮涌动 status="Lock" level="Level" />
+    <大亨光临 status="Lock" level="Level" />
+    <花之祝福 status="Lock" level="Level" />
+  </BigSkill>
   <CoolList>
   </CoolList>
+  <ProcessorList>
+  </ProcessorList>
 </PlayerConfig>

+ 1 - 1
Assets/Resources/XML/Config/skill_config.xml

@@ -1,5 +1,5 @@
 <data>
-  <item id="1" name="人潮涌动" class="1" class_id="2" skill_index="1" reduce_cd="1" coin_person="" person="1" coin_once="" diamond_once="" skill_cd="" duration="300" cd="1800" unlock_lv="100" unlock_ahead_cur="" unlock_ahead_amt="" unlock_cur="" unlock_amnt="" unlock_pos="" use__cur="" use_amnt="" upgrade_cur="1" upgrade_amnt="200" upgrade_fml="a" upgrade_plus="" upgrade_person="" upgrade_coin_once="" upgrade_duration="60" upgrade_cd="" desc="每分钟增加[&amp;person&amp;*60],持续[&amp;duration&amp;/60][lv]分钟" icon="4大技能1" anim="" label="" />
+  <item id="1" name="人潮涌动" class="1" class_id="2" skill_index="1" reduce_cd="1" coin_person="" person="1" coin_once="" diamond_once="" skill_cd="" duration="10" cd="1800" unlock_lv="100" unlock_ahead_cur="" unlock_ahead_amt="" unlock_cur="" unlock_amnt="" unlock_pos="" use__cur="" use_amnt="" upgrade_cur="1" upgrade_amnt="200" upgrade_fml="a" upgrade_plus="" upgrade_person="" upgrade_coin_once="" upgrade_duration="60" upgrade_cd="" desc="每分钟增加[&amp;person&amp;*60],持续[&amp;duration&amp;/60][lv]分钟" icon="4大技能1" anim="" label="" />
   <item id="2" name="大亨光临" class="1" class_id="3" skill_index="2" reduce_cd="1" coin_person="" person="" coin_once="50000%" diamond_once="" skill_cd="" duration="" cd="3600" unlock_lv="100" unlock_ahead_cur="2" unlock_ahead_amt="200" unlock_cur="" unlock_amnt="" unlock_pos="" use__cur="" use_amnt="" upgrade_cur="2" upgrade_amnt="300" upgrade_fml="a" upgrade_plus="" upgrade_person="" upgrade_coin_once="5000%" upgrade_duration="" upgrade_cd="" desc="" icon="4大技能2" anim="" label="" />
   <item id="3" name="花之祝福" class="1" class_id="4" skill_index="3" reduce_cd="1" coin_person="500%" person="" coin_once="" diamond_once="" skill_cd="" duration="300" cd="3600" unlock_lv="300" unlock_ahead_cur="2" unlock_ahead_amt="300" unlock_cur="" unlock_amnt="" unlock_pos="" use__cur="" use_amnt="" upgrade_cur="2" upgrade_amnt="300" upgrade_fml="a" upgrade_plus="" upgrade_person="" upgrade_coin_once="" upgrade_duration="60" upgrade_cd="" desc="" icon="4大技能3" anim="" label="" />
   <item id="4" name="繁花似锦" class="4" class_id="1" skill_index="" reduce_cd="" coin_person="200%" person="" coin_once="" diamond_once="" skill_cd="" duration="900" cd="900" unlock_lv="100" unlock_ahead_cur="2" unlock_ahead_amt="100" unlock_cur="" unlock_amnt="" unlock_pos="" use__cur="2" use_amnt="150" upgrade_cur="" upgrade_amnt="" upgrade_fml="" upgrade_plus="" upgrade_person="" upgrade_coin_once="" upgrade_duration="" upgrade_cd="" desc="" icon="绿-繁花似锦" anim="" label="" />

+ 19 - 33
Assets/Script/Manage/ManaData.cs

@@ -104,42 +104,33 @@ public class ManaData : MonoBehaviour
         BigSkillList = new List<BigSkill>();
         ProcessorList = new List<SkillProcessor>();
 
-        XmlNodeList xmlNodeList;
-        List<XmlNodeList> xmlNodeLists = Data.GetSkillConfig();
-        XmlAttributeCollection attributes;
+        List<XmlAttributeCollection> attributesList = Data.GetSkillConfig();
 
-        for (int i = 0; i < xmlNodeLists.Count; i++)
+        for (int i = 0; i < attributesList.Count; i++)
         {
-            xmlNodeList = xmlNodeLists[i];
-
-            for (int j = 0; j < xmlNodeList.Count; j++)
+            if (attributesList[i].Count == 17) //Pack配置
             {
-                attributes = xmlNodeList[j].Attributes;
-
-                if (attributes.Count == 17) //Pack配置
-                {
-                    PackList.Add(new Pack(attributes)); 
-                }
-                else if (attributes.Count == 23) //Ability配置
-                {
-                    AbilityList.Add(new Ability(attributes));
-                }
-                else if (attributes.Count == 33) //Skill配置
+                PackList.Add(new Pack(attributesList[i]));
+            }
+            else if (attributesList[i].Count == 23) //Ability配置
+            {
+                AbilityList.Add(new Ability(attributesList[i]));
+            }
+            else if (attributesList[i].Count == 33) //Skill配置
+            {
+                if (string.IsNullOrEmpty(attributesList[i][4].Value)) //普通Skill
                 {
-                    if (string.IsNullOrEmpty(attributes[4].Value)) //普通Skill
-                    {
-                        SkillList.Add(new Skill(attributes));
-                    }
-                    else //BigSkill
-                    {
-                        BigSkillList.Add(new BigSkill(attributes));
-                    }
+                    SkillList.Add(new Skill(attributesList[i]));
                 }
-                else
+                else //BigSkill
                 {
-                    throw new Exception(attributes.Count.ToString());
+                    BigSkillList.Add(new BigSkill(attributesList[i]));
                 }
             }
+            else
+            {
+                throw new Exception(attributesList[i].Count.ToString());
+            }
         }
 
         SkillList.Sort();
@@ -255,11 +246,6 @@ public class ManaData : MonoBehaviour
 
     }
 
-    private void OnApplicationQuit()
-    {
-        Data.SavePlayerConfig();
-    }
-
 
     public static void UpdateSkillStatus()
     {

+ 3 - 6
Assets/Script/Manage/ManaGarden.cs

@@ -61,14 +61,11 @@ public class ManaGarden : MonoBehaviour
         #region 生成FlowerItem
 
         FlowerInfo flowerInfo;
-        XmlNodeList xmlNodeList = Data.GetFlowerConfig();
-        XmlAttributeCollection attributes;
+        List<XmlAttributeCollection> attributesList = Data.GetFlowerConfig();
 
-        for (int i = 0; i < xmlNodeList.Count; i++)
+        for (int i = 0; i < attributesList.Count; i++)
         {
-            attributes = xmlNodeList[i].Attributes;
-
-            flowerInfo = new FlowerInfo(attributes);
+            flowerInfo = new FlowerInfo(attributesList[i]);
 
             FlowerDic.Add(flowerInfo.Id, flowerInfo);
         }

+ 0 - 8
Assets/Script/Object/Garden.cs

@@ -41,15 +41,7 @@ public class Garden : MonoBehaviour, IDragHandler, IPointerClickHandler, IEndDra
 
     private void Update()
     {
-        if (Input.GetKeyDown(KeyCode.U))
-        {
-            NextPage();
-        }
 
-        if (Input.GetKeyDown(KeyCode.Y))
-        {
-            PrevPage();
-        }
     }
 
 

+ 3 - 4
Assets/Script/Object/Skill/Ability.cs

@@ -33,7 +33,6 @@ public class Ability : SkillRoot
     protected string Desc;
     protected string Label;
     protected string Anim;
-    protected string Name;
 
     protected string UpgradeCD;
     protected string UpgradeFml;
@@ -50,9 +49,7 @@ public class Ability : SkillRoot
     protected float NewCoinPerson;
     protected double NewUpgradeAmt;
 
-    protected SkillStatus _ItemSkillStatus;
-
-    protected SkillStatus ItemSkillStatus
+    public SkillStatus ItemSkillStatus
     {
         get { return _ItemSkillStatus; }
         set
@@ -78,6 +75,8 @@ public class Ability : SkillRoot
         }
     }
 
+    protected SkillStatus _ItemSkillStatus;
+
     #endregion
 
     public Ability(XmlAttributeCollection attributes)

+ 4 - 4
Assets/Script/Object/Skill/BigSkill.cs

@@ -21,9 +21,7 @@ public class BigSkill : Skill
     public Image BarBk1;
     public Button BarBtn;
 
-    protected SkillStatus _BarSkillStatus;
-
-    protected SkillStatus BarSkillStatus
+    public SkillStatus BarSkillStatus
     {
         get { return _BarSkillStatus; }
         set
@@ -95,7 +93,7 @@ public class BigSkill : Skill
         }
     }
 
-    protected new SkillStatus ItemSkillStatus
+    public new SkillStatus ItemSkillStatus
     {
         get { return _ItemSkillStatus; }
         set
@@ -128,6 +126,8 @@ public class BigSkill : Skill
         }
     }
 
+    protected SkillStatus _BarSkillStatus;
+
     #endregion
 
     public BigSkill(XmlAttributeCollection attributes) : base(attributes)

+ 0 - 1
Assets/Script/Object/Skill/Pack.cs

@@ -30,7 +30,6 @@ public class Pack : SkillRoot
     protected string Desc;
     protected string Label;
     protected string Anim;
-    protected string Name;
     protected Current UseCur;
 
     #endregion

+ 6 - 7
Assets/Script/Object/Skill/Skill.cs

@@ -43,7 +43,6 @@ public class Skill : SkillRoot
     protected string Desc;
     protected string Label;
     protected string Anim;
-    protected string Name;
 
     protected string UpgradeCD;
     protected string UpgradeFml;
@@ -66,9 +65,7 @@ public class Skill : SkillRoot
     protected float NewCoinOnceBuff;
     protected double NewUpgradeAmt;
 
-    protected SkillStatus _ItemSkillStatus;
-
-    protected SkillStatus ItemSkillStatus
+    public SkillStatus ItemSkillStatus
     {
         get { return _ItemSkillStatus; }
         set
@@ -82,8 +79,8 @@ public class Skill : SkillRoot
 
             if (_ItemSkillStatus == SkillStatus.CD)
             {
-                Timer = CD*(1 + CdBuff);
-                
+                Timer = CD * (1 + CdBuff);
+
                 ManaData.CoolList.Add(this);
             }
             else if (_ItemSkillStatus == SkillStatus.Buy)
@@ -92,7 +89,7 @@ public class Skill : SkillRoot
             }
             else if (_ItemSkillStatus == SkillStatus.Use)
             {
-                
+
             }
             else if (_ItemSkillStatus == SkillStatus.Lock)
             {
@@ -113,6 +110,8 @@ public class Skill : SkillRoot
         }
     }
 
+    protected SkillStatus _ItemSkillStatus;
+
     #endregion
 
     public Skill(XmlAttributeCollection attributes)

+ 1 - 0
Assets/Script/Object/Skill/SkillRoot.cs

@@ -44,6 +44,7 @@ public abstract class SkillRoot : IComparable
 
     public int ClassId;
     public string Icon;
+    public string Name;
     public SkillClass Class;
 
     #endregion

+ 10 - 0
Assets/Script/Tool/Auxiliary.cs

@@ -49,6 +49,16 @@ public class Auxiliary : MonoBehaviour
             ManaData.Coin += 1000;
             ManaData.Diamond += 1000;
         }
+
+        if (Input.GetKeyDown(KeyCode.U))
+        {
+            Data.SavePlayerConfig();
+        }
+
+        if (Input.GetKeyDown(KeyCode.Y))
+        {
+            Data.ResetPlayerConfig();
+        }
     }
 
 

+ 177 - 12
Assets/Script/Tool/Data.cs

@@ -4,24 +4,21 @@ using System.Xml;
 using System.Collections;
 using System.Collections.Generic;
 
-public class Data : MonoBehaviour
+public class Data
 {
-    public static XmlNodeList GetFlowerConfig()
-    {
-        XmlDocument xmlDoc = new XmlDocument();
+    #region
 
-        TextAsset textAsset = (TextAsset) Resources.Load(@"XML\Config\flower_config");
-        
-        xmlDoc.LoadXml(textAsset.text);
+    public static XmlNode PlayerConfig;
+    public static XmlDocument PlayerDoc;
 
-        return xmlDoc.SelectSingleNode("data").SelectNodes("item");
-    }
+    #endregion
 
-    public static List<XmlNodeList> GetSkillConfig()
+    public static List<XmlAttributeCollection> GetSkillConfig()
     {
         TextAsset textAsset;
         XmlDocument xmlDoc = new XmlDocument();
         List<XmlNodeList> xmlNodeLists = new List<XmlNodeList>();
+        List<XmlAttributeCollection> attributesList = new List<XmlAttributeCollection>();
 
         textAsset = (TextAsset)Resources.Load(@"XML\Config\pack_config");
         xmlDoc.LoadXml(textAsset.text);
@@ -35,12 +32,180 @@ public class Data : MonoBehaviour
         xmlDoc.LoadXml(textAsset.text);
         xmlNodeLists.Add(xmlDoc.SelectSingleNode("data").SelectNodes("item"));
 
-        return xmlNodeLists;
+        for (int i = 0; i < xmlNodeLists.Count; i++)
+        {
+
+            for (int j = 0; j < xmlNodeLists[i].Count; j++)
+            {
+                attributesList.Add(xmlNodeLists[i][j].Attributes);
+            }
+        }
+
+        return attributesList;
     }
 
+    public static List<XmlAttributeCollection> GetFlowerConfig()
+    {
+        XmlNodeList xmlNodeList;
+        XmlDocument xmlDoc = new XmlDocument();
+        List<XmlAttributeCollection> attributesList = new List<XmlAttributeCollection>();
+
+        TextAsset textAsset = (TextAsset) Resources.Load(@"XML\Config\flower_config");
+        xmlDoc.LoadXml(textAsset.text);
+
+        xmlNodeList = xmlDoc.SelectSingleNode("data").SelectNodes("item");
+
+        for (int i = 0; i < xmlNodeList.Count; i++)
+        {
+            attributesList.Add(xmlNodeList[i].Attributes);
+        }
 
+        return attributesList;
+    }
+
+    
     public static void SavePlayerConfig()
     {
-        
+        if (PlayerConfig == null)
+        {
+            TextAsset textAsset = (TextAsset)Resources.Load(@"XML\Config\PlayerConfig");
+
+            PlayerDoc = new XmlDocument();
+            PlayerDoc.LoadXml(textAsset.text);
+            
+            PlayerConfig = PlayerDoc.SelectSingleNode("PlayerConfig");
+        }
+
+        XmlNode xmlNode;
+        XmlAttribute xmlAttribute;
+
+        PlayerConfig.SelectSingleNode("Coin").Attributes[0].Value = ManaData.Coin.ToString("0");
+        PlayerConfig.SelectSingleNode("Level").Attributes[0].Value = ManaData.Level.ToString();
+        PlayerConfig.SelectSingleNode("Person").Attributes[0].Value = ManaData.Person.ToString();
+        PlayerConfig.SelectSingleNode("Diamond").Attributes[0].Value = ManaData.Diamond.ToString();
+        PlayerConfig.SelectSingleNode("CoinPerson").Attributes[0].Value = ManaData.CoinPerson.ToString();
+
+        PlayerConfig.SelectSingleNode("QuitTime").Attributes[0].Value = System.DateTime.Now.ToString();
+
+        xmlNode = PlayerConfig.SelectSingleNode("Skill");
+        xmlNode.RemoveAll();
+        for (int i = 0; i < ManaData.SkillList.Count; i++)
+        {
+            xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, ManaData.SkillList[i].Name, ""));
+
+            xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("status"));
+            xmlAttribute.Value = ManaData.SkillList[i].ItemSkillStatus.ToString();
+
+            xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("level"));
+            xmlAttribute.Value = ManaData.SkillList[i].Level.ToString();
+
+            xmlNode = PlayerConfig.SelectSingleNode("Skill");
+        }
+
+        xmlNode = PlayerConfig.SelectSingleNode("BigSkill");
+        xmlNode.RemoveAll();
+        for (int i = 0; i < ManaData.BigSkillList.Count; i++)
+        {
+            xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, ManaData.BigSkillList[i].Name, ""));
+
+            xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("status"));
+            xmlAttribute.Value = ManaData.BigSkillList[i].ItemSkillStatus.ToString();
+
+            xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("level"));
+            xmlAttribute.Value = ManaData.BigSkillList[i].Level.ToString();
+
+            xmlNode = PlayerConfig.SelectSingleNode("BigSkill");
+        }
+
+        xmlNode = PlayerConfig.SelectSingleNode("Ability");
+        xmlNode.RemoveAll();
+        for (int i = 0; i < ManaData.AbilityList.Count; i++)
+        {
+            xmlNode = xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, ManaData.AbilityList[i].Name, ""));
+
+            xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("status"));
+            xmlAttribute.Value = ManaData.AbilityList[i].ItemSkillStatus.ToString();
+
+            xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("level"));
+            xmlAttribute.Value = ManaData.AbilityList[i].Level.ToString();
+
+            xmlNode = PlayerConfig.SelectSingleNode("Ability");
+        }
+
+        xmlNode = PlayerConfig.SelectSingleNode("CoolList");
+        xmlNode.RemoveAll();
+        for (int i = 0; i < ManaData.CoolList.Count; i++)
+        {
+            xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, ManaData.CoolList[i].Name, ""));
+
+            xmlNode = PlayerConfig.SelectSingleNode("CoolList");
+        }
+
+        xmlNode = PlayerConfig.SelectSingleNode("ProcessorList");
+        xmlNode.RemoveAll();
+        for (int i = 0; i < ManaData.ProcessorList.Count; i++)
+        {
+            xmlNode.AppendChild(PlayerDoc.CreateNode(XmlNodeType.Element, ManaData.ProcessorList[i].Name, ""));
+
+            xmlNode = PlayerConfig.SelectSingleNode("ProcessorList");
+        }
+
+        PlayerDoc.Save(Application.dataPath + @"\Resources\XML\Config\PlayerConfig.xml");
+    }
+
+    public static void ResetPlayerConfig()
+    {
+        if (PlayerConfig == null)
+        {
+            TextAsset textAsset = (TextAsset)Resources.Load(@"XML\Config\PlayerConfig");
+
+            PlayerDoc = new XmlDocument();
+            PlayerDoc.LoadXml(textAsset.text);
+
+            PlayerConfig = PlayerDoc.SelectSingleNode("PlayerConfig");
+        }
+
+        XmlNode xmlNode;
+        XmlAttribute xmlAttribute;
+
+        PlayerConfig.SelectSingleNode("Coin").Attributes[0].Value = "0";
+        PlayerConfig.SelectSingleNode("Level").Attributes[0].Value = "0";
+        PlayerConfig.SelectSingleNode("Person").Attributes[0].Value = "1";
+        PlayerConfig.SelectSingleNode("Diamond").Attributes[0].Value = "0";
+        PlayerConfig.SelectSingleNode("CoinPerson").Attributes[0].Value = "1";
+
+        PlayerConfig.SelectSingleNode("QuitTime").Attributes[0].Value = "";
+
+        xmlNode = PlayerConfig.SelectSingleNode("Skill");
+
+        for (int i = 0; i < xmlNode.ChildNodes.Count; i++)
+        {
+            xmlNode.ChildNodes[i].Attributes[0].Value = "Lock";
+            xmlNode.ChildNodes[i].Attributes[1].Value = "0";
+        }
+
+        xmlNode = PlayerConfig.SelectSingleNode("BigSkill");
+
+        for (int i = 0; i < xmlNode.ChildNodes.Count; i++)
+        {
+            xmlNode.ChildNodes[i].Attributes[0].Value = "Lock";
+            xmlNode.ChildNodes[i].Attributes[1].Value = "0";
+        }
+
+        xmlNode = PlayerConfig.SelectSingleNode("Ability");
+
+        for (int i = 0; i < xmlNode.ChildNodes.Count; i++)
+        {
+            xmlNode.ChildNodes[i].Attributes[0].Value = "Lock";
+            xmlNode.ChildNodes[i].Attributes[1].Value = "0";
+        }
+
+        xmlNode = PlayerConfig.SelectSingleNode("CoolList");
+        xmlNode.RemoveAll();
+
+        xmlNode = PlayerConfig.SelectSingleNode("ProcessorList");
+        xmlNode.RemoveAll();
+
+        PlayerDoc.Save(Application.dataPath + @"\Resources\XML\Config\PlayerConfig.xml");
     }
 }