示例#1
0
        public static void SaveToolDataStatus(ToolSaveData saveData)
        {
            List <ToolSaveData> oldDatas = LoadToolDataStatus();

            ToolSaveData oldData = oldDatas.Find(y => saveData.name == y.name);

            if (oldData != null)
            {
                oldData.SetValue(saveData);
            }
            else
            {
                oldDatas.Add(saveData);
            }

            SaveDataList(oldDatas);
        }
示例#2
0
        public static void SaveToolDataStatus(List <ToolSaveData> saveDataList)
        {
            List <ToolSaveData> oldDatas = LoadToolDataStatus();

            saveDataList.ForEach(x =>
            {
                ToolSaveData oldData = oldDatas.Find(y => x.name == y.name);

                if (oldData != null)
                {
                    oldData.SetValue(x);
                }
                else
                {
                    oldDatas.Add(x);
                }
            });

            SaveDataList(oldDatas);
        }
示例#3
0
        public static List <ToolSaveData> LoadToolDataStatus()
        {
            List <ToolSaveData> saveDataList = new List <ToolSaveData>();

            string str = PlayerPrefs.GetString(SaveKey);

            string[] strArray = str.Split('|');

            for (int i = 0; i < strArray.Length; i++)
            {
                if (string.IsNullOrEmpty(strArray[i]))
                {
                    continue;
                }

                ToolSaveData saveData = JsonUtility.FromJson <ToolSaveData>(strArray[i]);

                saveDataList.Add(saveData);
            }

            return(saveDataList);
        }
示例#4
0
 public void SetValue(ToolSaveData data)
 {
     name   = data.name;
     isShow = data.isShow;
 }