예제 #1
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);
     }
 }
예제 #2
0
        public GameObject Open <T>(string dialogID, T vo)
        {
            GameObject prefab = Array.Find(DialogPrefabs, p => p.DialogID == dialogID).DialogPrefab;

            if (prefab == null)
            {
                return(null);
            }

            GameObject          dialog = Instantiate(prefab, this.gameObject.transform);
            OpenDialogEventArgs arg    = new OpenDialogEventArgs(dialogID, dialog);

            if (arg.ViewComponent != null)
            {
                arg.ViewComponent.Manager = this;
                arg.ViewComponent.ID      = dialogID;
                arg.ViewComponent.OnOpen();
                (arg.ViewComponent as DialogView <T>)?.OnOpen(vo);
            }
            _dialogs.Add(arg);
            dialog.transform.SetParent(transform, false);
            gameObject.SetActive(true);

            OnOpenDialog?.Invoke(this, arg);
            Blocker?.transform.SetSiblingIndex(transform.childCount - 2);
            return(dialog);
        }
예제 #3
0
        private void StartNewOneSecondTurn(GameSession gameSession)
        {
            turn = gameSession.Turn;
            Logger.Debug($"[StartNewOneSecondTurn] {turn}");

            OnEndTurn?.Invoke(gameSession);

            foreach (var message in gameSession.GetCurrentTurnEvents())
            {
                if (message.IsPause)
                {
                    PauseSession();
                }

                if (message.Type == GameEventTypes.AnomalyFound)
                {
                    OnAnomalyFound?.Invoke(message, gameSession);
                }

                if (message.Type == GameEventTypes.OpenDialog)
                {
                    OnOpenDialog?.Invoke(message, gameSession);
                }

                // TODO: LAST - ADD NpcSpaceShipFound logic to Container and open window with message
                if (message.Type == GameEventTypes.NpcSpaceShipFound)
                {
                    OnFoundSpaceship?.Invoke(message, gameSession);
                }
            }
        }
예제 #4
0
    //サーバーから起動する時にネットワークエラーをチェックする
    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);
    }
예제 #5
0
 private protected void OpenDialog(string message)
 {
     OnOpenDialog?.Invoke(message);
 }