Kaynağa Gözat

Update 3.25

LiuQilin 8 yıl önce
ebeveyn
işleme
c14ec121cb

BIN
.vs/MyLovelyGarden/v14/.suo


+ 0 - 46
Assets/Resources/XML/Config/PlayerConfig.xml

@@ -1,46 +0,0 @@
-<PlayerConfig>
-  <Sign value="0" />
-  <Coin value="0" />
-  <Level value="0" />
-  <Person value="1" />
-  <Diamond value="0" />
-  <QuitTime value="3/24/2017 8:18:12 PM" />
-  <CoinPerson value="1" />
-  <CircleTimer value="0" />
-  <PlantList FlowerTraA1="1" FlowerTraA2="2" FlowerTraA3="3" FlowerTraA4="4" FlowerTraA5="5" FlowerTraA6="6" FlowerTraA7="7" FlowerTraA8="8" FlowerTraA9="9" />
-  <FlowerList ID="1 2 3 4 5 6 7 8 9 10" />
-  <SkillList>
-    <免费获取金币 SkillType="Skill" ItemStatus="Lock" Level="0" CdTimer="0" EffectTimer="0" />
-    <免费获取钻石 SkillType="Skill" ItemStatus="Lock" Level="0" CdTimer="0" EffectTimer="0" />
-    <技能冷却 SkillType="BigSkill" ItemStatus="Lock" BarStatus="Buy" Level="0" CdTimer="0" EffectTimer="0" />
-    <花园 SkillType="Ability" ItemStatus="Lock" Level="0" />
-    <繁花似锦 SkillType="Skill" ItemStatus="Lock" Level="0" CdTimer="0" EffectTimer="0" />
-    <黄色小蜜蜂 SkillType="Ability" ItemStatus="Lock" Level="0" />
-    <人潮涌动 SkillType="BigSkill" ItemStatus="Lock" BarStatus="Buy" Level="0" CdTimer="0" EffectTimer="0" />
-    <紫色小蜜蜂 SkillType="Ability" ItemStatus="Lock" Level="0" />
-    <礼包 SkillType="Pack" Name="金币大礼包" ItemStatus="Lock" Level="0" />
-    <礼包 SkillType="Pack" Name="新手礼包" ItemStatus="Lock" Level="0" />
-    <大亨光临 SkillType="BigSkill" ItemStatus="Lock" BarStatus="Buy" Level="0" CdTimer="0" EffectTimer="0" />
-    <礼包 SkillType="Pack" Name="天赐大礼包" ItemStatus="Lock" Level="0" />
-    <礼包 SkillType="Pack" Name="中级礼包" ItemStatus="Lock" Level="0" />
-    <蓝色小蜜蜂 SkillType="Ability" ItemStatus="Lock" Level="0" />
-    <礼包 SkillType="Pack" Name="高级礼包" ItemStatus="Lock" Level="0" />
-    <礼包 SkillType="Pack" Name="花神大礼包" ItemStatus="Lock" Level="0" />
-    <红色小蜜蜂 SkillType="Ability" ItemStatus="Lock" Level="0" />
-    <花之祝福 SkillType="BigSkill" ItemStatus="Lock" BarStatus="Buy" Level="0" CdTimer="0" EffectTimer="0" />
-    <白色小蜜蜂 SkillType="Ability" ItemStatus="Lock" Level="0" />
-    <缤纷彩虹 SkillType="Ability" ItemStatus="Lock" Level="0" />
-    <礼包 SkillType="Pack" Name="钻石100" ItemStatus="Lock" Level="0" />
-    <黄色小蝴蝶 SkillType="Ability" ItemStatus="Lock" Level="0" />
-    <礼包 SkillType="Pack" Name="钻石500 赠送50" ItemStatus="Lock" Level="0" />
-    <玉树樱花 SkillType="Ability" ItemStatus="Lock" Level="0" />
-    <紫色小蝴蝶 SkillType="Ability" ItemStatus="Lock" Level="0" />
-    <礼包 SkillType="Pack" Name="钻石2000 赠送500" ItemStatus="Lock" Level="0" />
-    <滴哩哩的小黄鹂 SkillType="Ability" ItemStatus="Lock" Level="0" />
-    <蓝色小蝴蝶 SkillType="Ability" ItemStatus="Lock" Level="0" />
-    <礼包 SkillType="Pack" Name="钻石6000 赠送600" ItemStatus="Lock" Level="0" />
-    <红色小蝴蝶 SkillType="Ability" ItemStatus="Lock" Level="0" />
-    <礼包 SkillType="Pack" Name="钻石10000 赠送2000" ItemStatus="Lock" Level="0" />
-    <白色小蝴蝶 SkillType="Ability" ItemStatus="Lock" Level="0" />
-  </SkillList>
-</PlayerConfig>

+ 1 - 0
Assets/Resources/XML/Config/XMLFile1.xml

@@ -0,0 +1 @@
+

+ 2 - 2
Assets/Resources/XML/Config/PlayerConfig.xml.meta → Assets/Resources/XML/Config/XMLFile1.xml.meta

@@ -1,6 +1,6 @@
 fileFormatVersion: 2
-guid: 50171b234d04e534580d2cccfdf235da
-timeCreated: 1489126665
+guid: 97fe166b53ce44849a2332f45a912bfd
+timeCreated: 1490364201
 licenseType: Pro
 TextScriptImporter:
   userData: 

+ 58 - 2
Assets/Script/Manage/Initializer.cs

@@ -1,12 +1,16 @@
-using LitJson;
+using System;
+using LitJson;
 
 using UnityEngine;
 using UnityEngine.EventSystems;
 
+using System.Xml;
 using System.Collections;
 using System.Collections.Generic;
+using System.IO;
+using System.Text;
 
-public class Initializer : MonoBehaviour 
+public class Initializer : MonoBehaviour
 {
     #region
 
@@ -16,6 +20,58 @@ public class Initializer : MonoBehaviour
 
     private void Start()
     {
+        StartCoroutine(IStart());
+    }
+
+    private IEnumerator IStart()
+    {
+        string path;
+        WWW www;
+
+        FileInfo fileInfo = new FileInfo(Application.persistentDataPath + "/PlayerConfig.xml");
+
+        if (fileInfo.Exists)
+        {
+            if (Application.platform == RuntimePlatform.Android)
+            {
+                path = "file://" + Application.persistentDataPath + "/PlayerConfig.xml";
+            }
+            else
+            {
+                path = "file:///" + Application.persistentDataPath + "/PlayerConfig.xml";
+            }
+
+            www = new WWW(path);
+
+            yield return www;
+        }
+        else
+        {
+            if (Application.platform == RuntimePlatform.Android)
+            {
+                path = Application.streamingAssetsPath + "/PlayerConfig.xml";
+            }
+            else
+            {
+                path = "file:///" + Application.streamingAssetsPath + "/PlayerConfig.xml";
+            }
+
+            www = new WWW(path);
+
+            yield return www;
+
+            StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml");
+
+            sw.Write(www.text);
+
+            sw.Close();
+        }
+
+        Data.PlayerDoc = new XmlDocument();
+        Data.PlayerDoc.LoadXml(www.text);
+
+        Data.PlayerNode = Data.PlayerDoc.SelectSingleNode("PlayerConfig");
+
         RegistList = new List<Regist>();
 
         gameObject.AddScript<ManaReso>();

+ 5 - 5
Assets/Script/Manage/ManaMiniGame.cs

@@ -377,6 +377,11 @@ public class ManaMiniGame : Regist
     {
         Award.GetAward(Score);
 
+        ManaReso.SetActive("Da_Info", true);
+        ManaReso.SetActive("Da_Quit", false);
+        ManaReso.SetActive("Da_Cancel", false);
+        ManaReso.SetActive("Da_GetAward", true);
+
         GameAbort();
     }
 
@@ -413,11 +418,6 @@ public class ManaMiniGame : Regist
         ManaReso.SetText("Da_Tit", string.Format(Language.GetStr("UI", "Da_Tit1")));
         ManaReso.SetText("Da_Lab", string.Format("{0}{1}", Language.GetStr("UI", "Da_Lab1"), Score));
 
-        ManaReso.SetActive("Da_Info", true);
-        ManaReso.SetActive("Da_Quit", false);
-        ManaReso.SetActive("Da_Cancel", false);
-        ManaReso.SetActive("Da_GetAward", true);
-
         Score = 0;
 
         Game = false;

+ 5 - 1
Assets/Script/Manage/ManaUI.cs

@@ -394,6 +394,10 @@ public class ManaUI : Regist
             ManaReso.SetActive("E_Debug", false);
 
             ManaData.Main++;
+
+            ManaReso.SetActive("Da_Quit", true);
+            ManaReso.SetActive("Da_Cancel", true);
+            ManaReso.SetActive("Da_GetAward", false);
         };
 
         tween.OnForwardFinish += () =>
@@ -431,7 +435,7 @@ public class ManaUI : Regist
                 ManaReso.Get("GardenMini").TweenBacVec();
 
                 ManaReso.SetActive("Da_Info", false);
-
+                
                 ManaMiniGame.GameAbort();
             }
         );

+ 15 - 51
Assets/Script/Tool/Data.cs

@@ -4,45 +4,15 @@ using UnityEngine;
 using System.Xml;
 using System.Collections;
 using System.Collections.Generic;
+using System.IO;
 using System.Text;
 
 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)
-            {
-                TextAsset textAsset = (TextAsset)Resources.Load(@"XML\Config\PlayerConfig");
-
-                _PlayerDoc = new XmlDocument();
-                _PlayerDoc.LoadXml(textAsset.text);
-                
-            }
-
-            return _PlayerDoc;
-        }
-        set { _PlayerDoc = value; }
-    }
-
-    private static XmlNode _PlayerNode;
-    private static XmlDocument _PlayerDoc;
+    public static XmlNode PlayerNode;
+    public static XmlDocument PlayerDoc;
 
     #endregion
 
@@ -158,8 +128,6 @@ public class Data
                 #endregion
             }
         }
-
-        PlayerDoc.Save(Application.dataPath + @"\Resources\XML\Config\PlayerConfig.xml");
     }
 
     private static void SavePlantList()
@@ -172,8 +140,6 @@ public class Data
             attributes.Append(PlayerDoc.CreateAttribute(ManaGarden.PlantList[i].ParTra.name));
             attributes[i].Value = ManaGarden.PlantList[i].Id.ToString();
         }
-
-        PlayerDoc.Save(Application.dataPath + @"\Resources\XML\Config\PlayerConfig.xml");
     }
 
     private static void SaveCommon()
@@ -186,8 +152,6 @@ public class Data
         PlayerNode.SelectSingleNode("QuitTime").Attributes[0].Value = DateTime.Now.ToString();
         PlayerNode.SelectSingleNode("CoinPerson").Attributes[0].Value = ManaData.CoinPerson.ToString();
         PlayerNode.SelectSingleNode("CircleTimer").Attributes[0].Value = ManaData.CircleTimer.ToString();
-
-        PlayerDoc.Save(Application.dataPath + @"\Resources\XML\Config\PlayerConfig.xml");
     }
 
     private static void SaveFlowerList()
@@ -206,8 +170,6 @@ public class Data
         }
 
         xmlAttribute.Value = xmlAttribute.Value.Trim(' ');
-
-        PlayerDoc.Save(Application.dataPath + @"\Resources\XML\Config\PlayerConfig.xml");
     }
 
     public  static void SavePlayerConfig()
@@ -216,6 +178,12 @@ public class Data
         SavePlantList();
         SaveCommon();
         SaveFlowerList();
+
+        StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml");
+
+        sw.Write(PlayerDoc.OuterXml);
+
+        sw.Close();
     }
 
 
@@ -331,8 +299,6 @@ public class Data
                 #endregion
             }
         }
-
-        PlayerDoc.Save(Application.dataPath + @"\Resources\XML\Config\PlayerConfig.xml");
     }
 
     private static void ResetPlantList()
@@ -366,8 +332,6 @@ public class Data
 
         xmlAttribute = xmlNode.Attributes.Append(PlayerDoc.CreateAttribute("FlowerTraA9"));
         xmlAttribute.Value = 9.ToString();
-
-        PlayerDoc.Save(Application.dataPath + @"\Resources\XML\Config\PlayerConfig.xml");
     }
 
     private static void ResetCommon()
@@ -380,8 +344,6 @@ public class Data
         PlayerNode.SelectSingleNode("QuitTime").Attributes[0].Value = DateTime.Now.ToString();
         PlayerNode.SelectSingleNode("CoinPerson").Attributes[0].Value = "1";
         PlayerNode.SelectSingleNode("CircleTimer").Attributes[0].Value = "0";
-
-        PlayerDoc.Save(Application.dataPath + @"\Resources\XML\Config\PlayerConfig.xml");
     }
 
     private static void ResetFlowerList()
@@ -391,8 +353,6 @@ public class Data
 
         XmlAttribute xmlAttribute = attributes.Append(PlayerDoc.CreateAttribute("ID"));
         xmlAttribute.Value = "1 2 3 4 5 6 7 8 9 10";
-
-        PlayerDoc.Save(Application.dataPath + @"\Resources\XML\Config\PlayerConfig.xml");
     }
 
     public  static void ResetPlayerConfig()
@@ -402,7 +362,11 @@ public class Data
         ResetCommon();
         ResetFlowerList();
 
-        PlayerDoc.Save(Application.dataPath + @"\Resources\XML\Config\PlayerConfig.xml");
+        StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml");
+
+        sw.Write(PlayerDoc.OuterXml);
+
+        sw.Close();
     }
 
 
@@ -472,7 +436,7 @@ public class Data
         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);
 

+ 2 - 1
MyLovelyGarden.Editor.csproj

@@ -158,7 +158,7 @@
   </ItemGroup>
   <ItemGroup>
     <None Include="Assets\Resources\Shader\Gray.shader" />
-    <None Include="Assets\Resources\XML\Config\PlayerConfig.xml" />
+    <None Include="Assets\Resources\XML\Config\XMLFile1.xml" />
     <None Include="Assets\Resources\XML\Config\ability_config.xml" />
     <None Include="Assets\Resources\XML\Config\flower_config.xml" />
     <None Include="Assets\Resources\XML\Config\minigame_config.xml" />
@@ -169,6 +169,7 @@
     <None Include="Assets\Resources\XML\lan\ChineseSimplified.xml" />
     <None Include="Assets\Resources\XML\lan\ChineseTraditional.xml" />
     <None Include="Assets\Resources\XML\lan\English.xml" />
+    <None Include="Assets\StreamingAssets\PlayerConfig.xml" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Target Name="GenerateTargetFrameworkMonikerAttribute" />

+ 2 - 1
MyLovelyGarden.csproj

@@ -152,7 +152,7 @@
   </ItemGroup>
   <ItemGroup>
     <None Include="Assets\Resources\Shader\Gray.shader" />
-    <None Include="Assets\Resources\XML\Config\PlayerConfig.xml" />
+    <None Include="Assets\Resources\XML\Config\XMLFile1.xml" />
     <None Include="Assets\Resources\XML\Config\ability_config.xml" />
     <None Include="Assets\Resources\XML\Config\flower_config.xml" />
     <None Include="Assets\Resources\XML\Config\minigame_config.xml" />
@@ -163,6 +163,7 @@
     <None Include="Assets\Resources\XML\lan\ChineseSimplified.xml" />
     <None Include="Assets\Resources\XML\lan\ChineseTraditional.xml" />
     <None Include="Assets\Resources\XML\lan\English.xml" />
+    <None Include="Assets\StreamingAssets\PlayerConfig.xml" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Target Name="GenerateTargetFrameworkMonikerAttribute" />

+ 6 - 0
MyLovelyGarden.txt

@@ -1,3 +1,9 @@
+异步加载场景
+
+找不到存档时怎么办
+
+不同设备下的存档
+
 技能使用时间处在边缘时有Bug
 
 图文混排

BIN
ProjectSettings/ProjectSettings.asset