From 1ab047b5fdd933c38ba0519ec2e83a44512ea8d7 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期四, 26 三月 2026 17:46:11 +0800
Subject: [PATCH] webgl代码合并 1

---
 Main/System/KnapSack/PackManager.cs |   45 ++++++++++++++++++++++++---------------------
 1 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/Main/System/KnapSack/PackManager.cs b/Main/System/KnapSack/PackManager.cs
index 3d7279b..e35cb16 100644
--- a/Main/System/KnapSack/PackManager.cs
+++ b/Main/System/KnapSack/PackManager.cs
@@ -5,6 +5,7 @@
 using LitJson;
 using System.Collections;
 using System.IO;
+using Cysharp.Threading.Tasks;
 
 public class PackManager : GameSystemManager<PackManager>
 {
@@ -54,11 +55,11 @@
 
     public int[] noRedpointComposeItemIDs;
 
-    public override void Init()
+    public async override void Init()
     {
         DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += OnBeforePlayerDataInitialize;
         DTC0403_tagPlayerLoginLoadOK.playerLoginOkEvent += OnPlayerLoginOk;
-        ParseConfig();
+        await ParseConfig();
         //SysNotifyMgr.Instance.sysNotifyEvent += RefreshSysInfo;
         
 
@@ -497,10 +498,10 @@
 
 
     #region 鐜╁瑁呭鐗规畩閫昏緫
-    void ParseConfig()
+    async UniTask ParseConfig()
     {
 
-        ParsePackConfigIni();
+        await ParsePackConfigIni();
         autoUseItemIDs = JsonMapper.ToObject<int[]>(FuncConfigConfig.Get("AutoUseItem").Numerical1);
         var config= FuncConfigConfig.Get("InitBagCellCount");
         initBagGridCount = int.Parse(config.Numerical1);
@@ -520,9 +521,9 @@
         noRedpointComposeItemIDs = JsonMapper.ToObject<int[]>(config.Numerical1);
     }
 
-    void ParsePackConfigIni()
+    async UniTask ParsePackConfigIni()
     {
-        string[] lines = LoadConfigIni("MapServerConfig");
+        string[] lines = await LoadConfigIni("MapServerConfig.ini");
         foreach (string line in lines)
         {
             if (line.StartsWith("PackCnt") && line.Contains("="))
@@ -540,22 +541,24 @@
         }
     }
 
-    public string[] LoadConfigIni(string name)
+    public async UniTask<string[]> LoadConfigIni(string name)
     {
-        string path = string.Empty;
-#if UNITY_EDITOR
-        if (!AssetSource.isUseAssetBundle)
-        {
-            path = ResourcesPath.CONFIG_FODLER + "/" + name + ".ini";
-        }
-        else
-#endif
-        {
-            //浠庢湇鍔$鎷疯礉鏄痠ni锛屾墦鍖呯敤txt缁熶竴澶勭悊
-            path = AssetVersionUtility.GetAssetFilePath($"Config/{name}.txt");
-        }
+//         string path = string.Empty;
+// #if UNITY_EDITOR
+//         if (!AssetSource.isUseAssetBundle)
+//         {
+//             path = ResourcesPath.CONFIG_FODLER + "/" + name + ".ini";
+//         }
+//         else
+// #endif
+//         {
+//             //浠庢湇鍔$鎷疯礉鏄痠ni锛屾墦鍖呯敤txt缁熶竴澶勭悊
+//             path = AssetVersionUtility.GetAssetFilePath($"Config/{name}.txt");
+//         }
 
-        return File.ReadAllLines(path);
+        return await ResManager.Instance.LoadConfigAsync(name, false);
+
+        // return File.ReadAllLines(path);
     }
 
     public int GetCanBuyPackGirdCount(PackType type)
@@ -669,7 +672,7 @@
         {
             return null;
         }
-
+ 
         ItemModel itemModel = null;
         itemGUIDDict.TryGetValue(guid, out itemModel);
         return itemModel;

--
Gitblit v1.8.0