From 862aeae51fdc2c8abd8753ac8d72c2ef2f07c03e Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期二, 31 三月 2026 11:39:32 +0800
Subject: [PATCH] 0312 服务器列表查找增加测试组

---
 Main/ResModule/ResManager.cs |   35 ++++++++++++++++++++++++++++++++++-
 1 files changed, 34 insertions(+), 1 deletions(-)

diff --git a/Main/ResModule/ResManager.cs b/Main/ResModule/ResManager.cs
index 4476aa5..8c8ac21 100644
--- a/Main/ResModule/ResManager.cs
+++ b/Main/ResModule/ResManager.cs
@@ -6,6 +6,8 @@
 using UnityEngine.Video;
 using Spine.Unity;
 using UnityEngine.UI;
+using Cysharp.Threading.Tasks;
+
 
 
 
@@ -129,6 +131,8 @@
     //needExt 鏄惁闇�瑕佸嚱鏁板唴閮ㄦ坊鍔犲悗缂�
     public T LoadAsset<T>(string directory, string name, bool needExt = true) where T : UnityEngine.Object
     {
+        directory = directory.Replace("\\", "/");
+        name = name.Replace("\\", "/");
         T asset = null;
         //  鐗规畩澶勭悊 鍥犱负鏈変竴灞傚浘闆嗙殑鍏崇郴 directory瑕佷紶鍏ョ殑搴旇鏄痑tlas鐨勫悕瀛�
         if (typeof(T) == typeof(Sprite))
@@ -144,7 +148,6 @@
                 name = name.Substring(name.LastIndexOf("/") + 1);
             }
 
-            directory = directory.Replace("\\", "/");
         }
 
         return LoadAssetInternal<T>(directory, name, needExt);
@@ -234,18 +237,48 @@
             return LoadAssetInternal<Sprite>(atlasName, spriteName);
     }
 
+    //needExt 鏄惁闇�瑕佸嚱鏁板唴閮ㄦ坊鍔犲悗缂�
     public void LoadAssetAsync<T>(string directory, string name, Action<bool, UnityEngine.Object> callBack, bool needExt = true) where T : UnityEngine.Object
     {
+        directory = directory.Replace("\\", "/");
+        name = name.Replace("\\", "/");
+
         //  鐗规畩澶勭悊 鍥犱负鏈変竴灞傚浘闆嗙殑鍏崇郴 directory瑕佷紶鍏ョ殑搴旇鏄痑tlas鐨勫悕瀛�
         if (typeof(T) == typeof(Sprite))
         {
             LoadSpriteAsync<T>(directory, name, callBack);
             return;
         }
+        else if (typeof(T) == typeof(SkeletonDataAsset))
+        {
+            //鏂囦欢鐩綍璋冩暣锛宯ame涓寘鍚簡璺緞
+            if (name.Contains("/"))
+            {
+                directory += name.Substring(0, name.LastIndexOf("/"));
+                name = name.Substring(name.LastIndexOf("/") + 1);
+            }
+
+        }
 
         LoadAssetAsyncInternal<T>(directory, name, callBack, needExt);
     }
 
+    public async UniTask<T> LoadAssetAsync<T>(string directory, string name, bool needExt = true) where T : UnityEngine.Object
+    {
+        var tcs = new UniTaskCompletionSource<T>();
+        LoadAssetAsync<T>(directory, name, (isLoaded, asset) => {
+            if (isLoaded)
+            {
+                tcs.TrySetResult(asset as T);
+            }
+            else
+            {
+                tcs.TrySetException(new Exception($"Failed to load asset: {directory}/{name}"));
+            }
+        }, needExt);
+        return await tcs.Task;
+    }
+
     private void LoadSpriteAsync<T>(string atlasName, string spriteName, Action<bool, UnityEngine.Object> callBack) where T : UnityEngine.Object
     {
 #if !UNITY_EDITOR

--
Gitblit v1.8.0