From b97ca7fc69d2cddeaf1af2d4e59ba4b413034784 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期四, 12 三月 2026 16:51:46 +0800
Subject: [PATCH] 59 邮件系统-客户端  邮件标题支持参数匹配

---
 Main/ResModule/ResManager.cs |   43 ++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 38 insertions(+), 5 deletions(-)

diff --git a/Main/ResModule/ResManager.cs b/Main/ResModule/ResManager.cs
index 7445d6b..b4c7112 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;
+
 
 
 
@@ -70,7 +72,7 @@
         {typeof(Sprite), "png"},
         {typeof(Texture2D), "jpg"},
         {typeof(Texture), "jpg"},
-        { typeof(Shader), "shader"},
+        {typeof(Shader), "shader"},
         {typeof(TextAsset), "txt"},
         {typeof(AudioClip), "wav"},
         {typeof(Font), "ttf"},
@@ -126,8 +128,11 @@
     }
 #endif
 
-    public T LoadAsset<T> (string directory, string name, bool needExt = true) where T : UnityEngine.Object
+    //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))
@@ -143,12 +148,12 @@
                 name = name.Substring(name.LastIndexOf("/") + 1);
             }
 
-            directory = directory.Replace("\\", "/");
         }
 
         return LoadAssetInternal<T>(directory, name, needExt);
     }
 
+    //needExt 鏄惁闇�瑕佸嚱鏁板唴閮ㄦ坊鍔犲悗缂�
     private T LoadAssetInternal<T>(string directory, string name, bool needExt = true) where T : UnityEngine.Object
     {
         T asset = null;
@@ -167,7 +172,7 @@
                 //澶栭儴鐢ㄥ埌鐨勮嚜宸卞姞鍚庣紑锛屽唴閮ㄧ粺涓�鍘婚櫎鍚庣紑鍚�
                 name = name.Substring(0, name.LastIndexOf("."));
             }
-
+            //TODO: 涓存椂鐗规畩澶勭悊鎵撳寘鍚庣殑璺緞璇诲彇
             if (directory == "UI" || directory == "UIComp" || directory.StartsWith("Sprite")
             || directory == "Battle/Prefabs" || directory == "Materials")
             {
@@ -181,6 +186,10 @@
             else if (directory.Contains("Texture"))
             {
                 directory = "maps/" + name;
+            }
+            else if (directory.Contains("Shader"))
+            {
+                directory = "graphic/shader";
             }
 
 
@@ -216,16 +225,24 @@
     private Sprite LoadSprite(string atlasName, string spriteName)
     {
         if (!AssetSource.isUseAssetBundle)
-        { 
+        {
             SpriteAtlas atlas = LoadAsset<SpriteAtlas>("Sprite", atlasName.Replace("Sprite/", ""));
+            if (null == atlas)
+            {
+                return null;
+            }
             return atlas.GetSprite(spriteName);
         }
         else
             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))
         {
@@ -236,6 +253,22 @@
         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