三国卡牌客户端基础资源仓库
yyl
2025-05-19 2769f4c6422de2d85436b38ee7f5ad92236ed0cf
Assets/Launch/Manager/LocalResManager.cs
File was renamed from Assets/Launch/Manager/ResManager.cs
@@ -14,10 +14,11 @@
using LaunchCommon;
public class ResManager : Singleton<ResManager>
//  热更新前的代码
public class LocalResManager : Singleton<LocalResManager>
{
    //不下载时本地安卓测试路径
    public string assetBundlesPath = Application.dataPath + "/../AssetBundles/Android/";
    public static string bytesFolderName = "logicbytes/";
@@ -152,7 +153,7 @@
        }
        Clock.Init();
        Debug.Log("ResManager.Init");
        Debug.Log("LocalResManager.Init");
    }
    public void Release()
@@ -271,54 +272,6 @@
        }
        return prefab;
    }
    private string GetExtension(Type type)
    {
        if (type == typeof(GameObject))
            return ".prefab";
        else if (type == typeof(Sprite))
            return ".png";
        else if (type == typeof(Texture2D))
            return ".png";
        else if (type == typeof(Shader))
            return ".shader";
        else if (type == typeof(TextAsset))
            return ".txt";
        else if (type == typeof(AudioClip))
            return ".wav";
        else if (type == typeof(Font))
            return ".ttf";
        else if (type == typeof(Material))
            return ".mat";
        else
        {
            Debug.LogErrorFormat("GetExtension() => 不支持的资源类型: {0}.", type.Name);
            return "";
        }
    }
    public T LoadAsset<T> (string directory, string name) where T : UnityEngine.Object
    {
        T asset = null;
#if UNITY_EDITOR
        var path = string.Concat($"Assets/ResourcesOut/{directory}/{name}", GetExtension(typeof(T)));
        asset = UnityEditor.AssetDatabase.LoadAssetAtPath<T>(path);
#else
        if (prefabBundle == null)
        {
            // string _path = GetAssetFilePath("builtin/prefabs");
            string _path = GetAssetFilePath($"builtin/{directory}");
            prefabBundle = AssetBundle.LoadFromFile(_path);
        }
        asset = prefabBundle.LoadAsset(name) as t;
#endif
        if (asset == null)
        {
            Debug.LogErrorFormat("LoadBuiltInPrefab() => 加载不到资源: {0}.", name);
        }
        return asset;
    }
@@ -493,11 +446,6 @@
        
    }
    public void UnloadAsset(string assetBundleName)
    {
    }
    public class VersionInfo
    {
        public JsonData notice_flag;
@@ -537,6 +485,4 @@
        ReadBytes,
        Completed,
    }
}