|
@@ -38,7 +38,6 @@ public class ManaData
|
|
|
|
|
|
XmlNode node;
|
|
|
XmlDocument nativeDoc = new XmlDocument();
|
|
|
- XmlDocument bundleDoc = new XmlDocument();
|
|
|
|
|
|
string configPath = Application.persistentDataPath + "/PlayerConfig.xml";
|
|
|
|
|
@@ -56,9 +55,9 @@ public class ManaData
|
|
|
|
|
|
TextAsset textAsset = ManaReso.Load<TextAsset>("PlayerConfig", Folder.Config);
|
|
|
|
|
|
- bundleDoc.LoadXml(textAsset.text);
|
|
|
+ DefaultDoc.LoadXml(textAsset.text);
|
|
|
|
|
|
- version = int.Parse(bundleDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value);
|
|
|
+ version = int.Parse(DefaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value);
|
|
|
|
|
|
node = nativeDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version");
|
|
|
|
|
@@ -66,11 +65,11 @@ public class ManaData
|
|
|
{
|
|
|
StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml");
|
|
|
|
|
|
- sw.Write(bundleDoc.OuterXml);
|
|
|
+ sw.Write(DefaultDoc.OuterXml);
|
|
|
|
|
|
sw.Close();
|
|
|
|
|
|
- PlayerDoc_ = bundleDoc;
|
|
|
+ PlayerDoc_ = DefaultDoc;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -80,11 +79,11 @@ public class ManaData
|
|
|
{
|
|
|
StreamWriter sw = new StreamWriter(Application.persistentDataPath + "/PlayerConfig.xml");
|
|
|
|
|
|
- sw.Write(bundleDoc.OuterXml);
|
|
|
+ sw.Write(DefaultDoc.OuterXml);
|
|
|
|
|
|
sw.Close();
|
|
|
|
|
|
- PlayerDoc_ = bundleDoc;
|
|
|
+ PlayerDoc_ = DefaultDoc;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -112,11 +111,23 @@ public class ManaData
|
|
|
{
|
|
|
TextAsset textAsset = ManaReso.Load<TextAsset>("PlayerConfig", Folder.Config);
|
|
|
|
|
|
- PlayerDoc_ = new XmlDocument();
|
|
|
+ DefaultDoc.LoadXml(textAsset.text);
|
|
|
|
|
|
- PlayerDoc_.LoadXml(textAsset.text);
|
|
|
-
|
|
|
- PlayerDoc_.SelectSingleNode("PlayerConfig").SelectSingleNode("QuitTime").Attributes[0].Value = DateTime.Now.ToString();
|
|
|
+ if (!string.IsNullOrEmpty(PlayerPrefs.GetString("id")))
|
|
|
+ {
|
|
|
+ Debug.LogWarning("Damage");
|
|
|
+ ManaDebug.Log("Damage");
|
|
|
+
|
|
|
+ DamageLock = true;
|
|
|
+
|
|
|
+ ManaServer.Download(PlayerPrefs.GetString("id"), RecoveXml);
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ PlayerDoc_ = DefaultDoc;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -129,6 +140,7 @@ public class ManaData
|
|
|
public static XmlDocument PlayerDoc_;
|
|
|
|
|
|
public static bool DamageLock;
|
|
|
+ public static XmlDocument DefaultDoc = new XmlDocument();
|
|
|
|
|
|
#endregion
|
|
|
|
|
@@ -163,6 +175,8 @@ public class ManaData
|
|
|
PlayerDoc_ = new XmlDocument();
|
|
|
|
|
|
PlayerDoc_.LoadXml(jsonData["l"].ToString());
|
|
|
+
|
|
|
+ SavePlayerInt("Version", int.Parse(DefaultDoc.SelectSingleNode("PlayerConfig").SelectSingleNode("Version").Attributes[0].Value));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -414,6 +428,8 @@ public class ManaData
|
|
|
|
|
|
public static void ResetPlayerConfig()
|
|
|
{
|
|
|
+ PlayerPrefs.SetString("id", "");
|
|
|
+
|
|
|
PlayerNode.SelectSingleNode("Version").Attributes[0].Value = "0";
|
|
|
|
|
|
SavePlayerConfig();
|