using System; using UnityEngine; using System.IO; using UnityEditor; using UnityEngine.SceneManagement; using Object = UnityEngine.Object; namespace XPlugin.Update { public static class UResources { /// /// 请求一个文件 /// /// /// public static FileInfo ReqFile(string path) { if (ResManager.Ins.DownloadedFiles.ContainsKey(path)) { return ResManager.Ins.DownloadedFiles[path]; } return null; } /// /// 请求场景 /// /// /// /// public static bool ReqScene(string path) { return ResManager.Ins.ReqScene(path); } /// /// 异步请求场景 /// /// /// /// public static void ReqSceneAsync(string path, Action onDone) { ResManager.Ins.ReqSceneAsync(path, onDone); } /// /// 加载物体 /// /// /// public static Object Load(string path) { return UResources.Load(path, typeof(Object)); } public static T Load(string path) where T : Object { return (T)((object)UResources.Load(path, typeof(T))); } public static Object Load(string path, Type type) { return ResManager.Ins.Load(path, type); } /// /// 异步加载物体 /// /// /// public static void LoadAsync(string path, Action onDone) { LoadAsync(path, typeof(Object), onDone); } public static void LoadAsync(string path, Action onDone) where T : Object { LoadAsync(path, typeof(T), onDone); } public static void LoadAsync(string path, Type type, Action onDone) { ResManager.Ins.LoadAsync(path, type, onDone); } /// /// 加载StreamingAssets物体(可更新) /// /// /// public static WWW LoadStreamingAsset(string path) { return ResManager.Ins.LoadStreamingAsset(path); } /// /// 异步加载StreamingAssets物体(可更新) /// /// /// public static void LoadStreamingAssetAsync(string path, Action onDone) { ResManager.Ins.LoadStreamingAssetAsync(path, onDone); } /// /// 加载资源 /// /// The asset. /// Dir. /// URL. public static WWW LoadAsset(string dir, string url) { return ResManager.Ins.LoadAsset(dir, url); } /// /// 异步加载资源 /// /// The asset. /// Dir. /// URL. /// public static void LoadAssetAsync(string dir, string url, Action onDone) { ResManager.Ins.LoadAssetAsync(dir, url, onDone); } /// /// 保存资源 /// /// true, if image asset was saved, false otherwise. /// Dir. /// URL. /// Image. public static bool SaveAsset(string dir, string url, WWW www) { return ResManager.Ins.SaveAsset(dir, url, www); } /// /// 移除资源 /// /// true, if asset was removed, false otherwise. /// Dir. /// URL. public static bool RemoveAsset(string dir, string url) { return ResManager.Ins.RemoveAsset(dir, url); } } }