コード例 #1
0
ファイル: UtageUguiLoadWait.cs プロジェクト: TUmedu/Utage-GVR
    //ローディング中の表示
    IEnumerator CoUpdateLoading()
    {
        int maxCountDownLoad = 0;
        int countDownLoading = 0;

        loadingBarRoot.SetActive(true);
        loadingBar.fillAmount = 0.0f;
        textMain.text         = LanguageSystemText.LocalizeText(SystemText.Downloading);
        textCount.text        = string.Format(LanguageSystemText.LocalizeText(SystemText.DownloadCount), 0, 1);
        while (Engine.IsWaitBootLoading)
        {
            yield return(0);
        }

        yield return(0);

        while (!AssetFileManager.IsDownloadEnd())
        {
            yield return(0);

            countDownLoading = AssetFileManager.CountDownloading();
            maxCountDownLoad = Mathf.Max(maxCountDownLoad, countDownLoading);
            int countDownLoaded = maxCountDownLoad - countDownLoading;
            textCount.text = string.Format(LanguageSystemText.LocalizeText(SystemText.DownloadCount), countDownLoaded, maxCountDownLoad);
            if (maxCountDownLoad > 0)
            {
                loadingBar.fillAmount = (1.0f * (maxCountDownLoad - countDownLoading) / maxCountDownLoad);
            }
        }
        loadingBarRoot.gameObject.SetActive(false);
        ChangeState(State.DownlodFinished);
    }
コード例 #2
0
 //ロード失敗
 protected virtual void OnFailedLoadEngine()
 {
     //キャッシュファイルから起動する
     if (isAutoCacheFileLoad && !AreadyTryReadCache)
     {
         AreadyTryReadCache = true;
         StartCoroutine(Starter.LoadEngineAsyncFromCacheManifest(OnFailedLoadEngine));
     }
     else
     {
         string text = LanguageSystemText.LocalizeText(SystemText.WarningNotOnline);
         List <ButtonEventInfo> buttons = new List <ButtonEventInfo>
         {
             new ButtonEventInfo(
                 LanguageSystemText.LocalizeText(SystemText.Yes),
                 () =>
             {
                 StartCoroutine(Starter.LoadEngineAsyncFromCacheManifest(OnFailedLoadEngine));
             }
                 ),
             new ButtonEventInfo(
                 LanguageSystemText.LocalizeText(SystemText.Retry),
                 () =>
             {
                 StartCoroutine(Starter.LoadEngineAsync(OnFailedLoadEngine));
             }
                 ),
         };
         OnOpenDialog.Invoke(text, buttons);
     }
 }
コード例 #3
0
    void CustomCallbackFileLoadError(AssetFile file)
    {
        string errorMsg = "インターネットに接続した状況でプレイしてください";

        if (SystemUi.GetInstance() != null)
        {
            if (isWaitingRetry)
            {
                StartCoroutine(CoWaitRetry(file));
            }
            else
            {
                isWaitingRetry = true;
                //リロードを促すダイアログを表示
                SystemUi.GetInstance().OpenDialog1Button(
                    errorMsg, LanguageSystemText.LocalizeText(SystemText.Retry),
                    () =>
                {
                    isWaitingRetry = false;
                    OnRetry(file);
                });
            }
        }
        else
        {
            OnRetry(file);
        }
    }
コード例 #4
0
    void ChangeState(State state)
    {
        this.CurrentState = state;
        switch (state)
        {
        case State.Start:
            buttonDownload.SetActive(true);
            loadingBarRoot.SetActive(false);
            textMain.text  = "";
            textCount.text = "";
            StartLoadEngine();
            break;

        case State.Downloding:
            buttonDownload.SetActive(false);
            StartCoroutine(CoUpdateLoading());
            break;

        case State.DownlodFinished:
            if (isOpenOnBoot)
            {
                this.Close();
                title.Open();
            }
            else
            {
                buttonDownload.SetActive(false);
                loadingBarRoot.SetActive(false);
                textMain.text  = LanguageSystemText.LocalizeText(SystemText.DownloadFinished);
                textCount.text = "";
            }
            break;
        }
    }
コード例 #5
0
ファイル: UtageUguiLoadWait.cs プロジェクト: TUmedu/Utage-GVR
    //サーバーから起動する時にネットワークエラーをチェックする
    IEnumerator CoStartFromServer()
    {
        string url             = Starter.UrlScenarioData;
        int    scenarioVersion = Starter.ScenarioVersion;

        int version = scenarioVersion;

        bool isRetry = false;

        do
        {
            bool isWaiting = false;
            isRetry = false;
            version = scenarioVersion;
            //ネットワークのチェック(モバイルのみ)
            switch (Application.internetReachability)
            {
            case NetworkReachability.NotReachable:                          //ネットにつながらない
                if (scenarioVersion < 0)
                {
                    AssetFile file = AssetFileManager.GetFileCreateIfMissing(url);
                    if (file.CacheVersion >= 0)
                    {
                        version = 0;
                        if (!isAutoCacheFileLoad)
                        {
                            isWaiting = true;
                            string text = LanguageSystemText.LocalizeText(SystemText.WarningNotOnline);
                            List <ButtonEventInfo> buttons = new List <ButtonEventInfo>
                            {
                                new ButtonEventInfo(
                                    LanguageSystemText.LocalizeText(SystemText.Yes)
                                    , () => isWaiting = false
                                    ),
                                new ButtonEventInfo(
                                    LanguageSystemText.LocalizeText(SystemText.Retry)
                                    , () => { isWaiting = false; isRetry = true; }
                                    ),
                            };
                            OnOpenDialog.Invoke(text, buttons);
                        }
                    }
                }
                break;

            case NetworkReachability.ReachableViaCarrierDataNetwork:        //キャリア
            case NetworkReachability.ReachableViaLocalAreaNetwork:          //Wifi
            default:
                break;
            }
            while (isWaiting)
            {
                yield return(0);
            }
        } while (isRetry);

        Starter.LoadEngine(version);
        ChangeState(State.Downloding);
    }
コード例 #6
0
ファイル: SampleLoadError.cs プロジェクト: TUmedu/Utage-GVR
    void CustomCallbackFileLoadError(AssetFile file)
    {
        string errorMsg = "インターネットに接続した状況でプレイしてください";

        if (SystemUi.GetInstance() != null)
        {
            //リロードを促すダイアログを表示
            SystemUi.GetInstance().OpenDialog1Button(
                errorMsg, LanguageSystemText.LocalizeText(SystemText.Retry),
                () => OnRetry(file));
            this.gameObject.SetActive(false);
        }
        else
        {
            OnRetry(file);
        }
    }
コード例 #7
0
    protected virtual void OnFinished()
    {
        switch (DownloadType)
        {
        case Type.Boot:
            this.Close();
            title.Open();
            break;

        case Type.Default:
            buttonDownload.SetActive(false);
            loadingBarRoot.SetActive(false);
            textMain.text  = LanguageSystemText.LocalizeText(SystemText.DownloadFinished);
            textCount.text = "";
            break;

        case Type.ChapterDownload:
            this.Close();
            break;
        }
    }
コード例 #8
0
 /// <summary>
 /// ロード画面を開く
 /// </summary>
 /// <param name="prev">前の画面</param>
 public void OpenLoad(UtageUiView prev)
 {
     isSave     = false;
     title.text = LanguageSystemText.LocalizeText(SystemText.Load);
     Open(prev);
 }
コード例 #9
0
 /// <summary>
 /// セーブ画面を開く
 /// </summary>
 /// <param name="prev">前の画面</param>
 public void OpenSave(UtageUiView prev)
 {
     isSave     = true;
     title.text = LanguageSystemText.LocalizeText(SystemText.Save);
     Open(prev);
 }