/** [シングルトン]constructor
         */
        private AssetBundleList()
        {
            //work_list
            this.work_list = new System.Collections.Generic.List <WorkItem>();

            //add_list
            this.add_list = new System.Collections.Generic.List <WorkItem>();

            //main_assetbundle
            this.main_assetbundle = new Main_AssetBundle();

            //main_asset
            this.main_asset = new Main_Asset();

            //pathlist
            this.pathlist = new PathList();

            //assetbundleitem_list
            this.assetbundleitem_list = new AssetBundleItem_List();
        }
        /** [シングルトン]constructor
         */
        private AssetBundleList()
        {
            //work
            this.work_pool = new List.NodePool <WorkItem>(16);
            this.work_add  = new System.Collections.Generic.LinkedList <WorkItem>();
            this.work_list = new System.Collections.Generic.LinkedList <WorkItem>();

            //main_assetbundle
            this.main_assetbundle = new Main_AssetBundle();

            //main_asset
            this.main_asset = new Main_Asset();

            //pathlist
            this.pathlist = new PathList();

            //assetbundleitem_list
            this.assetbundleitem_list = new AssetBundleItem_List();

            //PlayerLoopType
            this.playerloop_flag = true;
            Fee.PlayerLoopSystem.PlayerLoopSystem.GetInstance().Add(Config.PLAYERLOOP_ADDTYPE, Config.PLAYERLOOP_TARGETTYPE, typeof(PlayerLoopType.Fee_AssetBundleList_Main), this.Main);
        }
Exemple #3
0
        /** 更新。
         *
         *      return == true : 完了。
         *
         */
        public bool Main()
        {
            switch (this.mode)
            {
            case Mode.Start:
            {
                switch (this.request_type)
                {
                case RequestType.LoadPathItemAssetBundleItem:
                {
                    if (Fee.AssetBundleList.AssetBundleList.GetInstance().GetMainAssetBundle().RequestLoadPathItemAssetBundleItem(this.request_assetbundle_name) == true)
                    {
                        this.mode = Mode.Do_AssetBundle;
                    }
                } break;

                case RequestType.UnLoadAssetBundleItem:
                {
                    if (Fee.AssetBundleList.AssetBundleList.GetInstance().GetMainAssetBundle().RequestUnLoadAssetBundleItem(this.request_assetbundle_name) == true)
                    {
                        this.mode = Mode.Do_AssetBundle;
                    }
                } break;

                case RequestType.LoadAssetBundleItemTextFile:
                {
                    if (Fee.AssetBundleList.AssetBundleList.GetInstance().GetMainAsset().RequestLoadAssetBundleItemTextFile(this.request_assetbundle_name, this.request_assetname) == true)
                    {
                        this.mode = Mode.Do_Asset;
                    }
                } break;

                case RequestType.LoadAssetBundleItemTextureFile:
                {
                    if (Fee.AssetBundleList.AssetBundleList.GetInstance().GetMainAsset().RequestLoadAssetBundleItemTextureFile(this.request_assetbundle_name, this.request_assetname) == true)
                    {
                        this.mode = Mode.Do_Asset;
                    }
                } break;

                case RequestType.LoadAssetBundleItemPrefabFile:
                {
                    if (Fee.AssetBundleList.AssetBundleList.GetInstance().GetMainAsset().RequestLoadAssetBundleItemPrefabFile(this.request_assetbundle_name, this.request_assetname) == true)
                    {
                        this.mode = Mode.Do_Asset;
                    }
                } break;

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

            case Mode.End:
            {
            } return(true);

            case Mode.Do_AssetBundle:
            {
                Main_AssetBundle t_main = Fee.AssetBundleList.AssetBundleList.GetInstance().GetMainAssetBundle();

                this.item.SetResultProgress(t_main.GetResultProgress());

                if (t_main.GetResultType() != Main_AssetBundle.ResultType.None)
                {
                    //結果。
                    bool t_success = false;
                    switch (t_main.GetResultType())
                    {
                    case Main_AssetBundle.ResultType.LoadPathItemAssetBundleItem:
                    {
                        //ロードパスアイテム。アセットバンドルアイテム。

                        if (t_main.GetResultAssetBundleItem() != null)
                        {
                            this.item.SetResultAssetBundleItem(t_main.GetResultAssetBundleItem());
                            t_success = true;
                        }
                    } break;

                    case Main_AssetBundle.ResultType.UnLoadAssetBundleItem:
                    {
                        //アンロード。アセットバンドルアイテム。

                        this.item.SetResultUnLoadAssetBundleItem();
                        t_success = true;
                    } break;
                    }

                    if (t_success == false)
                    {
                        this.item.SetResultErrorString(t_main.GetResultErrorString());
                    }

                    //完了。
                    t_main.Fix();

                    this.mode = Mode.End;
                }
                else if (this.item.IsCancel() == true)
                {
                    //キャンセル。
                    t_main.Cancel();
                }
            } break;

            case Mode.Do_Asset:
            {
                Main_Asset t_main = Fee.AssetBundleList.AssetBundleList.GetInstance().GetMainAsset();

                this.item.SetResultProgress(t_main.GetResultProgress());

                if (t_main.GetResultType() != Main_Asset.ResultType.None)
                {
                    //結果。
                    bool t_success = false;
                    switch (t_main.GetResultType())
                    {
                    case Main_Asset.ResultType.Asset:
                    {
                        if (t_main.GetResultAsset() != null)
                        {
                            this.item.SetResultAsset(t_main.GetResultAsset());
                            t_success = true;
                        }
                    } break;
                    }

                    if (t_success == false)
                    {
                        this.item.SetResultErrorString(t_main.GetResultErrorString());
                    }

                    //完了。
                    t_main.Fix();

                    this.mode = Mode.End;
                }
                else if (this.item.IsCancel() == true)
                {
                    //キャンセル。
                    t_main.Cancel();
                }
            } break;
            }

            return(false);
        }