|
@@ -12,6 +12,7 @@ using System.Linq;
|
|
|
using System.Security.Cryptography;
|
|
|
using Sfs2X.Entities;
|
|
|
using Sfs2X.Entities.Data;
|
|
|
+using UnityEngine.UI;
|
|
|
using Random = UnityEngine.Random;
|
|
|
|
|
|
public class ConfigManager : Regist
|
|
@@ -60,7 +61,7 @@ public class ConfigManager : Regist
|
|
|
{
|
|
|
if (string.IsNullOrEmpty(configPath))
|
|
|
{
|
|
|
- configPath = $"{Application.persistentDataPath}/{ResourceLabel.PlayerConfigXml}";
|
|
|
+ configPath = string.Format("{0}/{1}", Application.persistentDataPath, ResourceLabel.PlayerConfigXml);
|
|
|
}
|
|
|
|
|
|
return configPath;
|
|
@@ -73,6 +74,16 @@ public class ConfigManager : Regist
|
|
|
private static string UnvalidConfigMD5 = "";
|
|
|
private static void LoadConfigDocument()
|
|
|
{
|
|
|
+ //if (!PlayerPrefManager.GetBool(PlayerPrefManager.INTERACT_CONFIG, false))
|
|
|
+ //{
|
|
|
+ // Debug.LogWarning("Download Archive : did not interact");
|
|
|
+
|
|
|
+ // PlayerDocumentDamageFlag = true;
|
|
|
+ // SerialNumberRequestFlag = false;
|
|
|
+
|
|
|
+ // return;
|
|
|
+ //}
|
|
|
+
|
|
|
int defaultVersion;
|
|
|
int nativeVersion;
|
|
|
|
|
@@ -161,7 +172,7 @@ public class ConfigManager : Regist
|
|
|
{
|
|
|
configDocument = UpdateConfigDocument(nativeVersion, nativeDoc, DefaultConfigDocument);
|
|
|
|
|
|
- HttpManager.UploadConfig();
|
|
|
+ //HttpManager.UploadConfig();
|
|
|
}
|
|
|
}
|
|
|
else if (nativeVersion > defaultVersion)
|
|
@@ -264,25 +275,24 @@ public class ConfigManager : Regist
|
|
|
//Debug.Log(jsonData.ToJson());
|
|
|
if (jsonData.Inst_Object.Keys.Contains("l"))
|
|
|
{
|
|
|
- configDocument = new XmlDocument();
|
|
|
+ XmlDocument recoverdDocument = new XmlDocument();
|
|
|
|
|
|
- configDocument.LoadXml(jsonData["l"].ToString());
|
|
|
+ recoverdDocument.LoadXml(jsonData["l"].ToString());
|
|
|
|
|
|
- int nativeVersion = int.Parse(configDocument.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value);
|
|
|
- int defaultVersion = int.Parse(DefaultConfigDocument.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value);
|
|
|
+ int RecoverdVersion = int.Parse(recoverdDocument.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value);
|
|
|
+ int DefaultVersion = int.Parse(DefaultConfigDocument.SelectSingleNode(PlayerConfigLabel.RootNode).SelectSingleNode(PlayerConfigLabel.Version).Attributes[0].Value);
|
|
|
|
|
|
- if (nativeVersion < defaultVersion)
|
|
|
+ PlayerDocumentDamageFlag = false;
|
|
|
+ if (RecoverdVersion <= DefaultVersion)
|
|
|
{
|
|
|
- UpdateConfigDocument(nativeVersion, configDocument, DefaultConfigDocument);
|
|
|
-
|
|
|
- HttpManager.UploadConfig();
|
|
|
+ UpdateConfigDocument(RecoverdVersion, recoverdDocument, DefaultConfigDocument);
|
|
|
+ configDocument = recoverdDocument;
|
|
|
+ PlayerPrefManager.SaveBool(PlayerPrefManager.INTERACT_CONFIG, true);
|
|
|
}
|
|
|
- else if (nativeVersion > defaultVersion)
|
|
|
+ else if (RecoverdVersion > DefaultVersion)
|
|
|
{
|
|
|
configDocument = DefaultConfigDocument;
|
|
|
}
|
|
|
-
|
|
|
- PlayerDocumentDamageFlag = false;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -1182,6 +1192,20 @@ public class ConfigManager : Regist
|
|
|
}
|
|
|
|
|
|
|
|
|
+ public static int GetGardenLevel(XmlDocument xmlDocument)
|
|
|
+ {
|
|
|
+ XmlNodeList nodeList = xmlDocument.SelectNodes(PlayerConfigLabel.RootNode + "/" + PlayerConfigLabel.SkillList + "/" + PlayerConfigLabel.Skill);
|
|
|
+ for (int i = 0; i < nodeList.Count; i++)
|
|
|
+ {
|
|
|
+ if (nodeList[i].Attributes[0].Value == "Ability1")
|
|
|
+ {
|
|
|
+ return int.Parse(nodeList[i].Attributes[3].Value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public static XmlDocument GetXmlDocument(string ConfigName)
|
|
|
{
|
|
|
TextAsset textAsset = ResourceManager.Load<TextAsset>(ConfigName, Folder.Config);
|