diff options
author | chai <215380520@qq.com> | 2023-06-27 18:43:09 +0800 |
---|---|---|
committer | chai <215380520@qq.com> | 2023-06-27 18:43:09 +0800 |
commit | 411470e66bcfd9631c7b6f82b0a00e5e1e1b0004 (patch) | |
tree | 9a3d3b453702834eb4ad6a4b7eabb6a7b5422880 /WorldlineKeepers/Assets/Scripts/Managers/ResourceManager.cs | |
parent | 3d1e930feed19641f0f386463f4de33385f24c51 (diff) |
+ stage serialize
Diffstat (limited to 'WorldlineKeepers/Assets/Scripts/Managers/ResourceManager.cs')
-rw-r--r-- | WorldlineKeepers/Assets/Scripts/Managers/ResourceManager.cs | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/WorldlineKeepers/Assets/Scripts/Managers/ResourceManager.cs b/WorldlineKeepers/Assets/Scripts/Managers/ResourceManager.cs index 4b318ca..0fd18df 100644 --- a/WorldlineKeepers/Assets/Scripts/Managers/ResourceManager.cs +++ b/WorldlineKeepers/Assets/Scripts/Managers/ResourceManager.cs @@ -1,9 +1,12 @@ +using LitJson; using System.Collections; using System.Collections.Generic; +using System.IO; #if UNITY_EDITOR using UnityEditor; #endif using UnityEngine; +using WK.Data; namespace WK { @@ -25,7 +28,36 @@ namespace WK #endif } + /// <summary> + /// ¸ù¾Ýfilekey¶Á×ÊÔ´ + /// </summary> + /// <typeparam name="T"></typeparam> + /// <param name="fileKey"></param> + /// <returns></returns> + public T LoadFile<T>(string fileKey) where T : UnityEngine.Object + { + FileDescriptor file = DataManager.Instance.GetFile(fileKey); + if (file == null) + return default(T); + if(file.root == FileRoot.Bundle) + { +#if UNITY_EDITOR + string tmp = kAssetRoot + file.path; + T obj = AssetDatabase.LoadAssetAtPath(tmp, typeof(T)) as T; + return obj; +#endif + } + return null; + //else if(file.root == FileRoot.Persistent) + //{ + // string tmp = Application.persistentDataPath + "/" + file.path; + //} + //else if(file.root == FileRoot.Streaming) + //{ + + //} + } } |