Beispiel #1
0
        public static void LoadAudioClip(string _package, string _file, int _track
                                         , OnLoadReadyDelegate _onReady
                                         , OnLoadObjectSuccessDelegate _onSuccess
                                         , OnErrorDelegate _onError)
        {
            if (string.IsNullOrEmpty(_package))
            {
                _onError("package is null");
                return;
            }
            if (string.IsNullOrEmpty(_file))
            {
                _onError("file is null");
                return;
            }

            _onReady();

            CoroutineMgr.Start(asyncLoadBundle(_package, _file, (_res) =>
            {
                Log.Debug("ResourceMgr", "load audioclip [{0}] finish...", _file);
                _onSuccess(_res);
            },
                                               _onError));
        }
Beispiel #2
0
        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);
            });
        }
Beispiel #3
0
        public static void LoadSkybox(string _package, string _file
                                      , OnLoadReadyDelegate _onReady
                                      , OnLoadObjectSuccessDelegate _onSuccess
                                      , OnErrorDelegate _onError)
        {
            if (string.IsNullOrEmpty(_package))
            {
                _onError("package is null");
                return;
            }

            if (string.IsNullOrEmpty(_file))
            {
                _onError("file is null");
                return;
            }

            _onReady();

            CoroutineMgr.Start(asyncLoadBundle(_package, _file, (_res) =>
            {
                Log.Debug("ResourceMgr", "load skybox [{0}] finish...", _file);
                CameraMgr.ApplySkybox(_res as Material);
                _onSuccess(_res);
            },
                                               _onError));
        }
Beispiel #4
0
        public static void PreloadAnyRes(string _package, string _file
                                         , OnLoadReadyDelegate _onReady
                                         , OnLoadObjectSuccessDelegate _onSuccess
                                         , OnErrorDelegate _onError)
        {
            if (string.IsNullOrEmpty(_package))
            {
                _onError("package is null");
                return;
            }

            if (string.IsNullOrEmpty(_file))
            {
                _onError("file is null");
                return;
            }

            _onReady();
        }
Beispiel #5
0
        public static void PreloadAsset(string _package, string _file
                                        , OnLoadReadyDelegate _onReady
                                        , OnLoadObjectSuccessDelegate _onSuccess
                                        , OnErrorDelegate _onError)
        {
            if (string.IsNullOrEmpty(_package))
            {
                _onError("package is null");
                return;
            }

            if (string.IsNullOrEmpty(_file))
            {
                _onError("file is null");
                return;
            }

            _onReady();
            string assetID = _package + "@" + _file;

            if (!preloadAssets.ContainsKey(assetID))
            {
                preloadAssets.Add(assetID, null);
                CoroutineMgr.Start(asyncLoadBundle(_package, _file, (_res) =>
                {
                    Log.Debug("ResourceMgr", "load res [{0}] finish...", assetID);
                    preloadAssets[assetID] = _res;
                    _onSuccess(_res);
                },
                                                   _onError));
            }
            else
            {
                Log.Debug("ResourceMgr", "res [{0}] is exists...", assetID);
                _onSuccess(preloadAssets[assetID]);
            }
        }