public static void LoadScene(string _package, string _file , OnLoadReadyDelegate _onReady , OnLoadSceneSuccessDelegate _onSuccess , OnErrorDelegate _onError) { if (string.IsNullOrEmpty(_package)) { _onError("package is null"); return; } if (string.IsNullOrEmpty(_file)) { _onError("file is null"); return; } if (SceneManager.GetActiveScene().name.Equals(_file)) { return; } _onReady(); resLoader.AppendExternalBundle(_package); ResBundle.AsyncLoadBundle(_package, (_bundle) => { _onSuccess(_file); }); }
public static void Preload() { root_ = new GameObject("__ResourceMgr__").transform; GameObject.DontDestroyOnLoad(root_.gameObject); resLoader = new UniResLoader(CoroutineMgr.mono); ResBundle.UseLoader(resLoader); Log.Info("ResourceMgr", "Preload ResourceMgr finish"); }
public T Load <T>(string path) where T : IResource, new() { ResBundle bundle; if (!_resources.TryGetValue(path, out bundle)) { T res = new T { ResourceKey = path }; res.Load(this); bundle = new ResBundle(path, res); _resources.Add(path, bundle); } bundle.AddRef(); return((T)bundle.Resource); }