From 411470e66bcfd9631c7b6f82b0a00e5e1e1b0004 Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Tue, 27 Jun 2023 18:43:09 +0800 Subject: + stage serialize --- .../Assets/Scripts/Managers/ResourceManager.cs | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'WorldlineKeepers/Assets/Scripts/Managers/ResourceManager.cs') 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 } + /// + /// ¸ù¾Ýfilekey¶Á×ÊÔ´ + /// + /// + /// + /// + public T LoadFile(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) + //{ + + //} + } } -- cgit v1.1-26-g67d0