private void OnButtonClicked(EButtonId id) { if (!_menuIsActive) { return; } if (_isLoading) { return; } _menuIsActive = false; switch (id) { case EButtonId.NEW_GAME: StartCoroutine(SwitchToLoadingMode()); break; case EButtonId.INFO: StartCoroutine(SwitchToInfoMode()); break; case EButtonId.EXIT: Application.Quit(); break; case EButtonId.INSTA: Application.OpenURL("https://instagram.com/a.dedyulya"); break; case EButtonId.MAIL: Application.OpenURL("mailto:[email protected]"); break; case EButtonId.FB: Application.OpenURL("https://facebook.com/adedyulya"); break; default: throw new ArgumentOutOfRangeException(nameof(id), id, null); } _menuIsActive = true; }
/// <summary> /// @brief 通常のページ用コールバック設定 /// </summary> /// <param name="id">アイテムID</param> /// <param name="tutorialEvent">TutorialEvent.</param> private void DefaultPageCallback(EButtonId id, TutorialEvent tutorialEvent) { // 前のイベントを削除してきれいな状態にする contentRoot.SetActive(false); Delete(Content); switch (id) { // OKボタンの処理 case EButtonId.OK: tutorialEvent.AnimationId += 1; // 次のイベントがなければポップアップを閉じる if (tutorialEvent.AnimationId > tutorialEvent.Animations.Count - 1) { popup.Close(() => { tutorialEvent.ExitEvent(); contentRoot.SetActive(false); }); return; } // 次があるならOKボタンの設置 if (tutorialEvent.AnimationId >= tutorialEvent.Animations.Count - 1) { popup.SetButtonText(EButtonId.OK, "OK"); } var next = New(tutorialEvent.Animations[tutorialEvent.AnimationId]); next.transform.SetParent(contentRoot.transform, false); Content = next; break; // キャンセル(戻る)ボタンの処理 case EButtonId.Cancel: // イベントの状態を1つ戻す tutorialEvent.AnimationId -= 1; EventPrevPage(tutorialEvent); break; } // 表示 contentRoot.SetActive(true); }
/// <summary> /// @brief ポップアップボタンのテキストを指定する関数 /// </summary> /// <param name="id"></param> /// <param name="text"></param> public void SetButtonText(EButtonId id, string text) { switch (id) { case EButtonId.OK: if (popupButton.OkText != null) { popupButton.OkText.text = text; } break; case EButtonId.Cancel: if (popupButton.CancelText != null) { popupButton.CancelText.text = text; } break; } }
/// <summary> /// @brief ポップアップ中のイベントを管理 /// </summary> /// <param name="id"></param> private void PopupAction(EButtonId id) { Close(); }