Example #1
0
        /** CoroutineMain
         */
        public System.Collections.IEnumerator CoroutineMain(Fee.Data.OnDataCoroutine_CallBackInterface a_callback_interface, ListItem a_listitem)
        {
            //result
            this.result = new ResultType();

            AssetBundleList.Item t_assetbundlelist_item = null;
            Fee.File.Item        t_file_item            = null;

            switch (a_listitem.path_type)
            {
            case PathType.AssetBundle_Prefab:
            {
                t_assetbundlelist_item = Fee.AssetBundleList.AssetBundleList.GetInstance().RequestLoadAssetBundleItemPrefabFile(a_listitem.assetbundle_name, a_listitem.id);
                if (t_assetbundlelist_item == null)
                {
                    //失敗。
                    this.result.errorstring = "Coroutine_Load : " + a_listitem.assetbundle_name + " : " + a_listitem.id;
                    yield break;
                }
            } break;

            case PathType.AssetBundle_Texture:
            {
                t_assetbundlelist_item = Fee.AssetBundleList.AssetBundleList.GetInstance().RequestLoadAssetBundleItemTextureFile(a_listitem.assetbundle_name, a_listitem.id);
                if (t_assetbundlelist_item == null)
                {
                    //失敗。
                    this.result.errorstring = "Coroutine_Load : " + a_listitem.assetbundle_name + " : " + a_listitem.id;
                    yield break;
                }
            } break;

            case PathType.AssetBundle_Text:
            {
                t_assetbundlelist_item = Fee.AssetBundleList.AssetBundleList.GetInstance().RequestLoadAssetBundleItemTextFile(a_listitem.assetbundle_name, a_listitem.id);
                if (t_assetbundlelist_item == null)
                {
                    //失敗。
                    this.result.errorstring = "Coroutine_Load : " + a_listitem.assetbundle_name + " : " + a_listitem.id;
                    yield break;
                }
            } break;

            case PathType.Resources_Prefab:
            {
                //リソース。プレハブ。
                t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadResourcesPrefabFile, a_listitem.path);
                if (t_file_item == null)
                {
                    //失敗。
                    this.result.errorstring = "Coroutine_Load : " + a_listitem.path;
                    yield break;
                }
            } break;

            case PathType.Resources_Texture:
            {
                //リソース。テクスチャ。
                t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadResourcesTextureFile, a_listitem.path);
                if (t_file_item == null)
                {
                    //失敗。
                    this.result.errorstring = "Coroutine_Load : " + a_listitem.path;
                    yield break;
                }
            } break;

            case PathType.Resources_Text:
            {
                //リソース。テキスト。
                t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadResourcesTextFile, a_listitem.path);
                if (t_file_item == null)
                {
                    //失敗。
                    this.result.errorstring = "Coroutine_Load : " + a_listitem.path;
                    yield break;
                }
            } break;

            case PathType.StreamingAssets_Texture:
            {
                //ストリーミングアセット。テクスチャ。
                t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadStreamingAssetsTextureFile, a_listitem.path);
                if (t_file_item == null)
                {
                    //失敗。
                    this.result.errorstring = "Coroutine_Load : " + a_listitem.path;
                    yield break;
                }
            } break;

            case PathType.StreamingAssets_Text:
            {
                //ストリーミングアセット。テキスト。
                t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadStreamingAssetsTextFile, a_listitem.path);
                if (t_file_item == null)
                {
                    //失敗。
                    this.result.errorstring = "Coroutine_Load : " + a_listitem.path;
                    yield break;
                }
            } break;

            case PathType.StreamingAssets_Binary:
            {
                //ストリーミングアセット。バイナリ。
                t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadStreamingAssetsBinaryFile, a_listitem.path);
                if (t_file_item == null)
                {
                    //失敗。
                    this.result.errorstring = "Coroutine_Load : " + a_listitem.path;
                    yield break;
                }
            } break;

            case PathType.Url_Texture:
            {
                //URL。テクスチャ。
                t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadUrlTextureFile, a_listitem.path);
                if (t_file_item == null)
                {
                    //失敗。
                    this.result.errorstring = "Coroutine_Load : " + a_listitem.path;
                    yield break;
                }
            } break;

            case PathType.Url_Text:
            {
                //URL。テキスト。
                t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadUrlTextFile, a_listitem.path);
                if (t_file_item == null)
                {
                    //失敗。
                    this.result.errorstring = "Coroutine_Load : " + a_listitem.path;
                    yield break;
                }
            } break;

            case PathType.Url_Binary:
            {
                //URL。バイナリ。
                t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadUrlBinaryFile, a_listitem.path);
                if (t_file_item == null)
                {
                    //失敗。
                    this.result.errorstring = "Coroutine_Load : " + a_listitem.path;
                    yield break;
                }
            } break;

                        #if (UNITY_EDITOR)
            case PathType.AssetsPath_Prefab:
            {
                //TODO:

                /*
                 * //アセット。プレハブ。
                 * t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadAssetsPathTextFile,a_listitem.path);
                 * if(t_file_item == null){
                 *      //失敗。
                 *      this.result.errorstring = "Coroutine_Load : " + a_listitem.path;
                 *      yield break;
                 * }
                 */
            } break;

            case PathType.AssetsPath_Text:
            {
                //アセット。テキスト。
                t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadAssetsPathTextFile, a_listitem.path);
                if (t_file_item == null)
                {
                    //失敗。
                    this.result.errorstring = "Coroutine_Load : " + a_listitem.path;
                    yield break;
                }
            } break;

            case PathType.AssetsPath_Texture:
            {
                //TODO:

                /*
                 * //アセット。テクスチャ。
                 * t_file_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadUrlBinaryFile,a_listitem.path);
                 * if(t_file_item == null){
                 *      //失敗。
                 *      this.result.errorstring = "Coroutine_Load : " + a_listitem.path;
                 *      yield break;
                 * }
                 */
            } break;
                        #endif

            default:
            {
                Tool.Assert(false);
            } break;
            }

            if (t_assetbundlelist_item != null)
            {
                //ロード中。
                do
                {
                    if (a_callback_interface != null)
                    {
                        a_callback_interface.OnDataCoroutine(t_assetbundlelist_item.GetResultProgress());
                    }
                    yield return(null);
                }while(t_assetbundlelist_item.IsBusy() == true);

                switch (a_listitem.path_type)
                {
                case PathType.AssetBundle_Prefab:
                {
                    if (t_assetbundlelist_item.GetResultAssetType() == Asset.AssetType.Prefab)
                    {
                        if (t_assetbundlelist_item.GetResultAssetPrefab() != null)
                        {
                            this.result.asset_file = t_assetbundlelist_item.GetResultAsset();
                            yield break;
                        }
                    }
                } break;

                case PathType.AssetBundle_Texture:
                {
                    if (t_assetbundlelist_item.GetResultAssetType() == Asset.AssetType.Texture)
                    {
                        if (t_assetbundlelist_item.GetResultAssetTexture() != null)
                        {
                            this.result.asset_file = t_assetbundlelist_item.GetResultAsset();
                            yield break;
                        }
                    }
                } break;

                case PathType.AssetBundle_Text:
                {
                    if (t_assetbundlelist_item.GetResultAssetType() == Asset.AssetType.Text)
                    {
                        if (t_assetbundlelist_item.GetResultAssetText() != null)
                        {
                            this.result.asset_file = t_assetbundlelist_item.GetResultAsset();
                            yield break;
                        }
                    }
                } break;

                default:
                {
                    Tool.Assert(false);
                } break;
                }

                //失敗。
                this.result.errorstring = "Coroutine_Load : " + t_assetbundlelist_item.GetResultErrorString();
                yield break;
            }

            if (t_file_item != null)
            {
                //ロード中。
                do
                {
                    if (a_callback_interface != null)
                    {
                        a_callback_interface.OnDataCoroutine(t_file_item.GetResultProgress());
                    }
                    yield return(null);
                }while(t_file_item.IsBusy() == true);

                switch (a_listitem.path_type)
                {
                case PathType.Resources_Prefab:
                {
                    //リソース。プレハブ。
                    if (t_file_item.GetResultAssetType() == Asset.AssetType.Prefab)
                    {
                        if (t_file_item.GetResultAssetPrefab() != null)
                        {
                            this.result.asset_file = t_file_item.GetResultAsset();
                            yield break;
                        }
                    }
                } break;

                case PathType.Resources_Texture:
                case PathType.StreamingAssets_Texture:
                case PathType.Url_Texture:
                {
                    //リソース。テクスチャ。
                    //ストリーミングアセット。テクスチャ。
                    //URL。テクスチャ。

                    if (t_file_item.GetResultAssetType() == Asset.AssetType.Texture)
                    {
                        if (t_file_item.GetResultAssetTexture() != null)
                        {
                            this.result.asset_file = t_file_item.GetResultAsset();
                            yield break;
                        }
                    }
                } break;

                case PathType.Resources_Text:
                case PathType.StreamingAssets_Text:
                case PathType.Url_Text:
                {
                    //リソース。テキスト。
                    //ストリーミングアセット。テキスト。
                    //URL。テキスト。

                    if (t_file_item.GetResultAssetType() == Asset.AssetType.Text)
                    {
                        if (t_file_item.GetResultAssetText() != null)
                        {
                            this.result.asset_file = t_file_item.GetResultAsset();
                            yield break;
                        }
                    }
                } break;

                case PathType.StreamingAssets_Binary:
                case PathType.Url_Binary:
                {
                    //ストリーミングアセット。バイナリ。
                    //URL。バイナリ。

                    if (t_file_item.GetResultAssetType() == Asset.AssetType.Binary)
                    {
                        if (t_file_item.GetResultAssetBinary() != null)
                        {
                            this.result.asset_file = t_file_item.GetResultAsset();
                            yield break;
                        }
                    }
                } break;

                default:
                {
                    Tool.Assert(false);
                } break;
                }

                //失敗。
                this.result.errorstring = "Coroutine_Load : " + t_file_item.GetResultErrorString();
                yield break;
            }

            //不明。
            Tool.Assert(false);
            this.result.errorstring = "Coroutine_Load : " + "Unknown";
            yield break;
        }
Example #2
0
        /** CoroutineMain
         */
        public System.Collections.IEnumerator CoroutineMain(Fee.AssetBundleList.OnAssetBundleListCoroutine_CallBackInterface a_callback_interface, string a_assetbundle_name, string a_asset_name)
        {
            //result
            this.result = new ResultType();

            AssetBundleItem t_assetbundle_item = Fee.AssetBundleList.AssetBundleList.GetInstance().GetAssetBundleItem(a_assetbundle_name);

            if (t_assetbundle_item == null)
            {
                //失敗。
                this.result.errorstring = "Coroutine_LoadAssetBundleItemPrefabFile : assetbundle_item = null : " + a_assetbundle_name + " : " + a_asset_name;
                yield break;
            }

            if (t_assetbundle_item.assetbundle_dummy != null)
            {
                //ダミーアセットバンドルが設定されている。

                string t_path;
                if (t_assetbundle_item.assetbundle_dummy.asset_list.TryGetValue(a_asset_name, out t_path) == true)
                {
                    Fee.File.Item t_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadResourcesPrefabFile, new File.Path(t_path));

                    do
                    {
                        if (a_callback_interface != null)
                        {
                            a_callback_interface.OnAssetBundleListCoroutine(t_item.GetResultProgress());
                        }
                        yield return(null);
                    }while(t_item.IsBusy() == true);

                    UnityEngine.GameObject t_prefab = null;

                    if (t_item.GetResultAssetType() == Asset.AssetType.Prefab)
                    {
                        if (t_item.GetResultAssetPrefab() != null)
                        {
                            t_prefab = t_item.GetResultAssetPrefab();
                        }
                    }

                    if (t_prefab == null)
                    {
                        //失敗。
                        this.result.errorstring = "Coroutine_LoadAssetBundleItemPrefabFile : prefab = null : " + a_assetbundle_name + " : " + a_asset_name;
                        yield break;
                    }

                    this.result.asset_file = new Asset.Asset(Asset.AssetType.Prefab, t_prefab);
                }
                else
                {
                    //失敗。
                    this.result.errorstring = "Coroutine_LoadAssetBundleItemPrefabFile : " + a_assetbundle_name + " : " + a_asset_name;
                    yield break;
                }
            }
            else if (t_assetbundle_item.assetbundle_raw != null)
            {
                //アセットバンドル。

                UnityEngine.AssetBundleRequest t_request = t_assetbundle_item.assetbundle_raw.LoadAssetAsync(a_asset_name);

                if (t_request == null)
                {
                    //失敗。
                    this.result.errorstring = "Coroutine_LoadAssetBundleItemPrefabFile : request = null : " + a_assetbundle_name + " : " + a_asset_name;
                    yield break;
                }

                do
                {
                    if (a_callback_interface != null)
                    {
                        a_callback_interface.OnAssetBundleListCoroutine(t_request.progress);
                    }
                    yield return(null);
                }while(t_request.isDone == false);

                UnityEngine.GameObject t_prefab = t_request.asset as UnityEngine.GameObject;

                if (t_prefab == null)
                {
                    //失敗。
                    this.result.errorstring = "Coroutine_LoadAssetBundleItemPrefabFile : prefab = null : " + a_assetbundle_name + " : " + a_asset_name;
                    yield break;
                }

                this.result.asset_file = new Asset.Asset(Asset.AssetType.Prefab, t_prefab);
            }
            else
            {
                Tool.Assert(false);
            }

            //失敗。
            this.result.errorstring = "Coroutine_LoadAssetBundleItemPrefabFile : " + a_assetbundle_name + " : " + a_asset_name;
            yield break;
        }