Ejemplo n.º 1
0
        /** リクエスト。ロードストリーミングアセット。サウンドプール。
         */
        public bool RequestLoadStreamingAssetsSoundPool(Fee.File.Path a_path, uint a_data_version)
        {
            if (this.is_busy == false)
            {
                this.is_busy = true;

                //is_cancel
                this.is_cancel = false;

                //request
                this.request_path                = a_path;
                this.request_post_data           = null;
                this.request_certificate_handler = null;
                this.request_data_version        = a_data_version;

                //result
                this.result_progress       = 0.0f;
                this.result_errorstring    = null;
                this.result_type           = ResultType.None;
                this.result_soundpool      = null;
                this.result_responseheader = null;

                Function.Function.StartCoroutine(this.DoLoadStreamingAssetsSoundPool());
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        /** リクエスト。ロードURL。サウンドプール。
         */
        public bool RequestLoadUrlSoundPool(File.Path a_path, UnityEngine.WWWForm a_post_data, Fee.File.CustomCertificateHandler a_certificate_handler, uint a_data_version)
        {
            if (this.is_busy == false)
            {
                this.is_busy = true;

                //is_cancel
                this.is_cancel = false;

                //request
                this.request_path                = a_path;
                this.request_post_data           = a_post_data;
                this.request_certificate_handler = a_certificate_handler;
                this.request_data_version        = a_data_version;

                //result
                this.result_progress       = 0.0f;
                this.result_errorstring    = null;
                this.result_type           = ResultType.None;
                this.result_soundpool      = null;
                this.result_responseheader = null;

                Function.Function.StartCoroutine(this.DoLoadUrlSoundPool());
                return(true);
            }

            return(false);
        }
Ejemplo n.º 3
0
        /** CoroutineMain
         */
        public System.Collections.IEnumerator CoroutineMain(OnSoundPoolCoroutine_CallBackInterface a_callback_interface, Fee.File.Path a_path)
        {
            //result
            this.result = new ResultType();

            //ローカル、サウンドプール管理ファイルのロード。
            Fee.JsonItem.JsonItem t_local_soundpool_json = null;
            {
                Fee.File.Item t_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadLocalTextFile, a_path);

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

                if (t_item.GetResultAssetType() == Asset.AssetType.Text)
                {
                    t_local_soundpool_json = new JsonItem.JsonItem(t_item.GetResultAssetText());
                    if (t_local_soundpool_json == null)
                    {
                        //コンバート失敗。
                        this.result.errorstring = "Coroutine_LoadLocalSoundPool : local_soundpool_json == null";
                        yield break;
                    }
                }
                else
                {
                    //ローカルにキャッシュなし。
                }
            }

            Fee.Audio.Pack_SoundPool t_local_soundpool = Fee.JsonItem.Convert.JsonItemToObject <Fee.Audio.Pack_SoundPool>(t_local_soundpool_json);
            if (t_local_soundpool == null)
            {
                //コンバート失敗。
                this.result.errorstring = "Coroutine_LoadLocalSoundPool : local_soundpool == null";
                yield break;
            }

            //パス解決。
            {
                t_local_soundpool.fullpath_list = new System.Collections.Generic.List <File.Path>();
                for (int ii = 0; ii < t_local_soundpool.name_list.Count; ii++)
                {
                    t_local_soundpool.fullpath_list.Add(File.Path.CreateLocalPath(t_local_soundpool.name_list[ii]));
                }
            }

            this.result.soundpool = t_local_soundpool;
            yield break;
        }
Ejemplo n.º 4
0
        /** constructor
         */
        public Main_File()
        {
            this.is_busy     = false;
            this.is_cancel   = false;
            this.is_shutdown = false;

            //request
            this.request_path                = null;
            this.request_post_data           = null;
            this.request_certificate_handler = null;
            this.request_data_version        = 0;

            //result
            this.result_progress       = 0.0f;
            this.result_errorstring    = null;
            this.result_type           = ResultType.None;
            this.result_soundpool      = null;
            this.result_responseheader = null;
        }
Ejemplo n.º 5
0
        /** 実行。ロードストリーミングアセット。サウンドプール。
         */
        private System.Collections.IEnumerator DoLoadStreamingAssetsSoundPool()
        {
            Coroutine_LoadSoundPool t_coroutine = new Coroutine_LoadSoundPool();

            yield return(t_coroutine.CoroutineMain(this, this.request_path, null, null, true, this.request_data_version));

            if (t_coroutine.result.soundpool != null)
            {
                this.result_progress  = 1.0f;
                this.result_soundpool = t_coroutine.result.soundpool;
                this.result_type      = ResultType.SoundPool;
                yield break;
            }
            else
            {
                this.result_progress    = 1.0f;
                this.result_errorstring = t_coroutine.result.errorstring;
                this.result_type        = ResultType.Error;
                yield break;
            }
        }
Ejemplo n.º 6
0
        /** 実行。ダウンロード。サウンドプール。
         */
        private System.Collections.IEnumerator DoLoadUrlSoundPool()
        {
            Coroutine_LoadSoundPool t_coroutine = new Coroutine_LoadSoundPool();

            yield return(t_coroutine.CoroutineMain(this, this.request_path, this.request_post_data, this.request_certificate_handler, false, this.request_data_version));

            if (t_coroutine.result.soundpool != null)
            {
                this.result_progress       = 1.0f;
                this.result_soundpool      = t_coroutine.result.soundpool;
                this.result_responseheader = t_coroutine.result.responseheader;
                this.result_type           = ResultType.SoundPool;
                yield break;
            }
            else
            {
                this.result_progress       = 1.0f;
                this.result_errorstring    = t_coroutine.result.errorstring;
                this.result_responseheader = t_coroutine.result.responseheader;
                this.result_type           = ResultType.Error;
                yield break;
            }
        }
Ejemplo n.º 7
0
        /** 結果。サウンドプール。設定。
         */
        public void SetResultSoundPool(Fee.Audio.Pack_SoundPool a_soundpool)
        {
            this.result_type = ResultType.SoundPool;

            this.result_soundpool = a_soundpool;
        }
Ejemplo n.º 8
0
 /** constructor
  */
 public ResultType()
 {
     this.soundpool   = null;
     this.errorstring = null;
 }
        /** CoroutineMain
         */
        public System.Collections.IEnumerator CoroutineMain(OnSoundPoolCoroutine_CallBackInterface a_callback_interface, File.Path a_path, UnityEngine.WWWForm a_post_data, Fee.File.CustomCertificateHandler a_certificate_handler, bool a_is_streamingassets, uint a_data_version)
        {
            //result
            this.result = new ResultType();

            Fee.Pattern.Progress t_progress = new Fee.Pattern.Progress(new float[] {
                0.05f,
                0.1f,
                0.8f,
                0.05f
            });

            //ローカル、サウンロプール管理ファイル。相対パス。
            Fee.File.Path t_local_caoundpool_path = new File.Path(a_path.GetFileName());

            //ローカル、サウンドプール管理ファイルのロード。
            Fee.JsonItem.JsonItem t_local_soundpool_json = null;
            if (Config.USE_LOADURL_SOUNDPOOL_CACHE == true)
            {
                Fee.File.Item t_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadLocalTextFile, t_local_caoundpool_path);

                do
                {
                    //■ステップ0。
                    if (a_callback_interface != null)
                    {
                        t_progress.SetStep((int)Progress_MainStep.Progress_MainStep_0_LoadLocal_SoundPool, 0, 1);
                        a_callback_interface.OnSoundPoolCoroutine(t_progress.CalcProgress(t_item.GetResultProgress()));
                    }
                    yield return(null);
                }while(t_item.IsBusy() == true);

                if (t_item.GetResultAssetType() == Asset.AssetType.Text)
                {
                    t_local_soundpool_json = new JsonItem.JsonItem(t_item.GetResultAssetText());
                    if (t_local_soundpool_json == null)
                    {
                        //コンバート失敗。
                        this.result.errorstring = "Coroutine_LoadSoundPool : local_soundpool_json == null";
                        yield break;
                    }
                }
                else
                {
                    //ローカルにキャッシュなし。
                }
            }

            //チェック。
            if (t_local_soundpool_json != null)
            {
                if ((t_local_soundpool_json.IsAssociativeArray() == true) && (t_local_soundpool_json.IsExistItem("data_version")))
                {
                    uint t_data_version = t_local_soundpool_json.GetItem("data_version").CastToUint16();
                    if (t_data_version == a_data_version)
                    {
                        Fee.Audio.Pack_SoundPool t_local_soundpool = Fee.JsonItem.Convert.JsonItemToObject <Fee.Audio.Pack_SoundPool>(t_local_soundpool_json);
                        if (t_local_soundpool != null)
                        {
                            //最新を取得する必要なし。

                            //パス解決。
                            {
                                t_local_soundpool.fullpath_list = new System.Collections.Generic.List <File.Path>();
                                for (int ii = 0; ii < t_local_soundpool.name_list.Count; ii++)
                                {
                                    t_local_soundpool.fullpath_list.Add(File.Path.CreateLocalPath(t_local_soundpool.name_list[ii]));
                                }
                            }

                            this.result.soundpool      = t_local_soundpool;
                            this.result.responseheader = null;
                            yield break;
                        }
                        else
                        {
                            //コンバート失敗。
                        }
                    }
                    else
                    {
                        //最新のバージョンが必要。
                    }
                }
                else
                {
                    //不明なデータ。
                }

                t_local_soundpool_json = null;
            }

            //ロード。
            string t_load_stringjson = null;

            Fee.Audio.Pack_SoundPool t_load_soundpool = null;

            //サウンドプール管理ファイルのロード。
            {
                Fee.File.Item t_item = null;

                if (a_is_streamingassets == true)
                {
                    t_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadStreamingAssetsTextFile, a_path);
                }
                else
                {
                    t_item = Fee.File.File.GetInstance().RequestLoadUrl(File.File.LoadRequestType.LoadUrlTextFile, a_path, a_post_data, a_certificate_handler);
                }

                do
                {
                    //■ステップ1。
                    if (a_callback_interface != null)
                    {
                        t_progress.SetStep((int)Progress_MainStep.Progress_MainStep_1_Load_SoundPool, 0, 1);
                        a_callback_interface.OnSoundPoolCoroutine(t_progress.CalcProgress(t_item.GetResultProgress()));
                    }
                    yield return(null);
                }while(t_item.IsBusy() == true);

                this.result.responseheader = t_item.GetResultResponseHeader();

                if (t_item.GetResultAssetType() == Asset.AssetType.Text)
                {
                    //成功。
                    t_load_stringjson = t_item.GetResultAssetText();
                }
                else
                {
                    //失敗。
                    this.result.errorstring = t_item.GetResultErrorString();
                    yield break;
                }

                t_load_soundpool = JsonItem.Convert.JsonStringToObject <Fee.Audio.Pack_SoundPool>(t_load_stringjson);

                if (t_load_soundpool == null)
                {
                    //コンバート失敗。
                    this.result.errorstring = "Coroutine_LoadSoundPool : load_soundpool == null";
                    yield break;
                }
                else if (t_load_soundpool.name_list == null)
                {
                    //不明なデータ。
                    this.result.errorstring = "Coroutine_LoadSoundPool : load_soundpool.name_list == null";
                    yield break;
                }
                else if (t_load_soundpool.volume_list == null)
                {
                    //不明なデータ。
                    this.result.errorstring = "Coroutine_LoadSoundPool : load_soundpool.volume_list == null";
                    yield break;
                }
            }

            //登録サウンドのロード。
            {
                for (int ii = 0; ii < t_load_soundpool.name_list.Count; ii++)
                {
                    byte[] t_sound_binary = null;

                    //ロード。
                    {
                        Fee.File.Path t_sound_url = a_path.CreateFileNameChangePath(t_load_soundpool.name_list[ii]);

                        Fee.File.Item t_item = null;

                        if (a_is_streamingassets)
                        {
                            t_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadStreamingAssetsBinaryFile, t_sound_url);
                        }
                        else
                        {
                            t_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadUrlBinaryFile, t_sound_url);
                        }

                        do
                        {
                            //■ステップ2。
                            if (a_callback_interface != null)
                            {
                                t_progress.SetStep((int)Progress_MainStep.Progress_MainStep_2_Sound, ii * 2 + 0, t_load_soundpool.name_list.Count * 2);
                                a_callback_interface.OnSoundPoolCoroutine(t_progress.CalcProgress(t_item.GetResultProgress()));
                            }
                            yield return(null);
                        }while(t_item.IsBusy() == true);

                        if (t_item.GetResultAssetType() == Asset.AssetType.Binary)
                        {
                            //成功。
                            t_sound_binary = t_item.GetResultAssetBinary();
                        }
                        else
                        {
                            //失敗。
                            this.result.errorstring = t_item.GetResultErrorString();
                            yield break;
                        }
                    }

                    //セーブローカル。
                    {
                        Fee.File.Path t_sound_url = new File.Path(t_load_soundpool.name_list[ii]);

                        File.Item t_item = Fee.File.File.GetInstance().RequestSaveBinaryFile(File.File.SaveRequestType.SaveLocalBinaryFile, t_sound_url, t_sound_binary);

                        do
                        {
                            //■ステップ2。
                            if (a_callback_interface != null)
                            {
                                t_progress.SetStep((int)Progress_MainStep.Progress_MainStep_2_Sound, ii * 2 + 1, t_load_soundpool.name_list.Count * 2);
                                a_callback_interface.OnSoundPoolCoroutine(t_progress.CalcProgress(t_item.GetResultProgress()));
                            }
                            yield return(null);
                        }while(t_item.IsBusy() == true);

                        if (t_item.GetResultType() == File.Item.ResultType.SaveEnd)
                        {
                            //成功。
                        }
                        else
                        {
                            //失敗。
                            this.result.errorstring = t_item.GetResultErrorString();
                            yield break;
                        }
                    }
                }
            }

            //ローカル、サウンドプール管理ファイルのセーブ。
            {
                File.Item t_item = Fee.File.File.GetInstance().RequestSaveTextFile(File.File.SaveRequestType.SaveLocalTextFile, t_local_caoundpool_path, t_load_stringjson);

                do
                {
                    //■ステップ3。
                    if (a_callback_interface != null)
                    {
                        t_progress.SetStep((int)Progress_MainStep.Progress_MainStep_3_SaveLocal_SoundPool, 0, 1);
                        a_callback_interface.OnSoundPoolCoroutine(t_progress.CalcProgress(t_item.GetResultProgress()));
                    }
                    yield return(null);
                }while(t_item.IsBusy() == true);

                if (t_item.GetResultType() == File.Item.ResultType.SaveEnd)
                {
                    //成功。
                }
                else
                {
                    //失敗。
                    this.result.errorstring = t_item.GetResultErrorString();
                    yield break;
                }
            }

            //パス解決。
            {
                t_load_soundpool.fullpath_list = new System.Collections.Generic.List <File.Path>();
                for (int ii = 0; ii < t_load_soundpool.name_list.Count; ii++)
                {
                    t_load_soundpool.fullpath_list.Add(Fee.File.Path.CreateLocalPath(t_load_soundpool.name_list[ii]));
                }
            }

            this.result.soundpool = t_load_soundpool;
            yield break;
        }
 /** constructor
  */
 public ResultType()
 {
     this.soundpool      = null;
     this.errorstring    = null;
     this.responseheader = null;
 }