| 
					
				 | 
			
			
				@@ -10,12 +10,13 @@ using Utility; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #if UNITY_WEIXINMINIGAME 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using WeChatWASM; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 public class AccountFileInfo : Singleton<AccountFileInfo> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public string persistentDataPath = Application.persistentDataPath + "/playerData.txt"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public PlayerData playerData = new PlayerData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// 索引,用于快速查找 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// </summary> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -42,7 +43,7 @@ public class AccountFileInfo : Singleton<AccountFileInfo> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// 是否全部阵亡一次 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public bool isAllHeroDie; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// 装备的GUID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// </summary> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -58,7 +59,7 @@ public class AccountFileInfo : Singleton<AccountFileInfo> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // public List<HeroData> HeroListInBackDatas = new List<HeroData>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// 重建索引表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// 主要给道具用,比较多,调用频繁 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -72,7 +73,7 @@ public class AccountFileInfo : Singleton<AccountFileInfo> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// 加载玩家数据,一切数据:从这里开始 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// </summary> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -94,7 +95,7 @@ public class AccountFileInfo : Singleton<AccountFileInfo> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             SavePlayerData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- if (!File.Exists(persistentDataPath)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (!File.Exists(persistentDataPath)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             LogTool.Log("没有文件: " + persistentDataPath); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ClearInitPlayerData(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -154,7 +155,6 @@ public class AccountFileInfo : Singleton<AccountFileInfo> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// <param name="zeroDel">count为0时,是否删除</param> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public void SaveItemData(ItemInfo itemInfo, bool now = true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (itemIndexMap.TryGetValue(itemInfo.guid, out int index)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // //count为零且需要立即删除时,移除Data并移除索引(也有count为0,不删除的情况,就走else的逻辑) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -168,7 +168,7 @@ public class AccountFileInfo : Singleton<AccountFileInfo> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //     // 快速找到索引,直接修改 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //     playerData.ItemListData[index] = itemInfo.ToItemData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 快速找到索引,直接修改 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             playerData.ItemListData[index] = itemInfo.ToItemData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -181,7 +181,7 @@ public class AccountFileInfo : Singleton<AccountFileInfo> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     LogTool.Error("??? guid重复了" + itemInfo.itemID + "-" + itemData.guid); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-             
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // 添加新数据并更新索引表 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             playerData.ItemListData.Add(itemInfo.ToItemData()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             itemIndexMap[itemInfo.guid] = playerData.ItemListData.Count - 1; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -189,10 +189,10 @@ public class AccountFileInfo : Singleton<AccountFileInfo> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (now) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            SavePlayerData();     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            SavePlayerData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // if (itemInfo.guid == playerData.ItemListData[lastItemIdx].guid) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //     playerData.ItemListData[lastItemIdx] = itemInfo.ToItemData(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -212,7 +212,7 @@ public class AccountFileInfo : Singleton<AccountFileInfo> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //         return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         //     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // playerData.ItemListData.Add(itemInfo.ToItemData()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // SavePlayerData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -223,8 +223,6 @@ public class AccountFileInfo : Singleton<AccountFileInfo> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     // } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// 清除空数据,重建索引 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// </summary> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -233,7 +231,7 @@ public class AccountFileInfo : Singleton<AccountFileInfo> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // 从后往前遍历,这样删除元素,可以一般循环,一遍删除 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         for (int i = playerData.ItemListData.Count - 1; i >= 0; i--) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            string ss = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // string ss = ""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             ItemData itemData = playerData.ItemListData[i]; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (itemData.itemCount == 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -241,31 +239,28 @@ public class AccountFileInfo : Singleton<AccountFileInfo> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (itemData.eqData == null || itemData.eqData.zyEqId == 0) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     playerData.ItemListData.RemoveAt(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    ss = "删除道具:" + itemData.guid; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    // ss = "删除道具:" + itemData.guid; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                //是装备,但是没有穿,删除 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                if (itemData.eqData != null && itemData.eqData.zyEqId != 0 && !itemData.eqData.isEquip) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                else if (itemData.eqData != null && itemData.eqData.zyEqId != 0 && !itemData.eqData.isEquip) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    ss = "删除装备:" + itemData.guid; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    // ss = "删除装备:" + itemData.guid; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     playerData.ItemListData.RemoveAt(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                LogTool.Log(ss); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                // LogTool.Log(ss); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         RestoreIndexMap(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public void SavePlayerData(bool clean = false) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (clean) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             CleanEmptyData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if (!string.IsNullOrEmpty(persistentDataPath)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             string playerSettingJson = JsonManager.ToJson(playerData); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -273,7 +268,7 @@ public class AccountFileInfo : Singleton<AccountFileInfo> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             WXFileSystemManager wxFileSystemManager = WX.GetFileSystemManager(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             wxFileSystemManager.WriteFileSync(persistentDataPath, playerSettingJson, "utf8"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- File.WriteAllText(persistentDataPath, playerSettingJson); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            File.WriteAllText(persistentDataPath, playerSettingJson); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #endif 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -285,7 +280,7 @@ public class AccountFileInfo : Singleton<AccountFileInfo> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         SavePlayerData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         ClearInitPlayerData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 #else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- if (File.Exists(filePath)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (File.Exists(filePath)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             File.Delete(filePath); // 删除文件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             LogTool.Log($"文件已删除:{filePath}"); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -320,7 +315,7 @@ public class AccountFileInfo : Singleton<AccountFileInfo> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             isLead = true, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-       
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         playerData.HeroListData.Add(heroData1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // playerData.HeroListData.Add(heroData2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // playerData.HeroListData.Add(heroData3); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -377,7 +372,7 @@ public class AccountFileInfo : Singleton<AccountFileInfo> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             // eqData = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-     
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// 装备数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// </summary> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -390,6 +385,7 @@ public class AccountFileInfo : Singleton<AccountFileInfo> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// HeroBasicEquipConfig ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public int zyEqId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // public int dropLv; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public int quality; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -397,7 +393,7 @@ public class AccountFileInfo : Singleton<AccountFileInfo> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// 是否穿了(职业装备) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public bool isEquip; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-         
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // /// <summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // /// 穿在哪个职业身上 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         // /// </summary> 
			 |