File was renamed from Assets/Launch/Manager/ResManager.cs |
| | |
| | |
|
| | | using LaunchCommon;
|
| | |
|
| | | public class ResManager : Singleton<ResManager>
|
| | | |
| | | // 热更新前的代码 |
| | | |
| | | public class LocalResManager : Singleton<LocalResManager> |
| | | {
|
| | | |
| | |
|
| | | //不下载时本地安卓测试路径
|
| | | public string assetBundlesPath = Application.dataPath + "/../AssetBundles/Android/";
|
| | | public static string bytesFolderName = "logicbytes/";
|
| | |
| | | }
|
| | |
|
| | | Clock.Init();
|
| | | Debug.Log("ResManager.Init");
|
| | | Debug.Log("LocalResManager.Init"); |
| | | }
|
| | |
|
| | | public void Release()
|
| | |
| | | }
|
| | |
|
| | | 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;
|
| | | }
|
| | |
|
| | |
|
| | |
| | |
|
| | | }
|
| | |
|
| | | public void UnloadAsset(string assetBundleName)
|
| | | {
|
| | | |
| | | }
|
| | |
|
| | | public class VersionInfo
|
| | | {
|
| | | public JsonData notice_flag;
|
| | |
| | | ReadBytes,
|
| | | Completed,
|
| | | }
|
| | |
|
| | |
|
| | | } |