Esempio n. 1
0
        private void _LoadSelfFromBundleAsync()
        {
            var fullPath = "";

            switch (this.loadType)
            {
            case AssetPackLoadType.STREAMINGASSETS:
                fullPath = PathUtility.ComposeAppPath(this.path);
                break;

            case AssetPackLoadType.PERSISTENTDATAPATH:
                fullPath = PathUtility.ComposeDataPath(this.path);
                if (!File.Exists(fullPath))
                {
                    fullPath      = PathUtility.ComposeAppPath(this.path);
                    this.loadType = AssetPackLoadType.STREAMINGASSETS;
                }
                break;
            }

            Logger <IAssetManager> .L("Load asset pack through assets bundle: " + fullPath);

            new AssetBundleLoadTask(fullPath).Start().Continue(task =>
            {
                var request = task.Result as AssetBundleCreateRequest;
                this.origin = request.assetBundle;
                this.state  = (null != this.origin ? AssetPackState.LOADED : AssetPackState.FAILED);
                _OnAssetPackLoaded();
                return(null);
            });
        }
Esempio n. 2
0
        private object _LoadSelfFromBundle()
        {
            var fullPath = "";

            switch (this.loadType)
            {
            case AssetPackLoadType.STREAMINGASSETS:
                fullPath = PathUtility.ComposeAppPath(this.path);
                break;

            case AssetPackLoadType.PERSISTENTDATAPATH:
                fullPath = PathUtility.ComposeDataPath(this.path);
                if (!File.Exists(fullPath))
                {
                    fullPath      = PathUtility.ComposeAppPath(this.path);
                    this.loadType = AssetPackLoadType.STREAMINGASSETS;
                }
                break;
            }
            Logger <IAssetManager> .L("Load asset pack through assets bundle: " + fullPath);

            return(AssetBundle.LoadFromFile(fullPath));
        }