void Start() { //BGM再生 GameObject bgmManager = GameObject.Find("BGMManager"); if (bgmManager == null) { bgmManager = (Instantiate(Resources.Load("Prefabs/BGMManager")) as GameObject); bgmManager.name = bgmManager.name.Replace("(Clone)", ""); } bgmPlayer = bgmManager.GetComponent <BGMPlayer>(); //210206 BGM変更 既にステータス画面の曲が流れてる場合は再生しない if (BGMType.TITLE != bgmPlayer.playingBGM) { bgmPlayer.ChangeBGM(BGMType.TITLE); bgmPlayer.PlayBGM(); } //効果音再生用 audioSource = GameObject.Find("BGMManager").GetComponent <AudioSource>(); //210514 キーコンフィグを初期化 if (KeyConfigManager.configMap == null) { string configFilePath = Application.persistentDataPath + "/keyConfig"; KeyConfigManager.InitKeyConfig(configFilePath); } //フェードイン fadeInOutManager.FadeinStart(); //状態 まずはルート設定 prepareGameStartMode = PrepareGameStartMode.ROUTE; }
/// <summary> /// 210220 難易度選択ボタンが押された時 /// </summary> public void OnClickDifficulty(string difficultyStr) { //UnityのInspectorは列挙型が使えないので引数はString if ("normal" == difficultyStr) { ModeManager.difficulty = Difficulty.NORMAL; selectedDifficulty = menuWindow.transform.Find("DifficultyView/NormalButton").gameObject; } else if ("hard" == difficultyStr) { ModeManager.difficulty = Difficulty.HARD; selectedDifficulty = menuWindow.transform.Find("DifficultyView/HardButton").gameObject; } else if ("lunatic" == difficultyStr) { ModeManager.difficulty = Difficulty.LUNATIC; selectedDifficulty = menuWindow.transform.Find("DifficultyView/LunaticButton").gameObject; } //難易度を設定 Debug.Log($"難易度:{ModeManager.difficulty}に設定しました"); //表示テキスト変更 modeText.text = "モード設定"; //UI制御 difficultyView.SetActive(false); modeView.SetActive(true); //フォーカス設定 EventSystem.current.SetSelectedGameObject(menuWindow.transform.Find("ModeView/CasualButton").gameObject); //モード選択へ prepareGameStartMode = PrepareGameStartMode.MODE; }
// Update is called once per frame void Update() { //210207 暗転中は操作しない if (fadeInOutManager.isFadeinFadeout()) { return; } //初期化完了時のみメニューウィンドウ表示 if (!isInitFinish) { menuWindow.SetActive(true); textPanel.SetActive(true); EventSystem.current.SetSelectedGameObject(menuWindow.transform.Find("RouteView/ReimuButton").gameObject); isInitFinish = true; } //210513 決定ボタンを押したらUGUIのボタンをクリック if (KeyConfigManager.GetKeyDown(KeyConfigType.SUBMIT)) { KeyConfigManager.ButtonClick(); } //キャンセルボタン if (KeyConfigManager.GetKeyDown(KeyConfigType.CANCEL)) { //ルート選択の時にキャンセルボタンでタイトル if (prepareGameStartMode == PrepareGameStartMode.ROUTE) { fadeInOutManager.ChangeScene("title"); } else if (prepareGameStartMode == PrepareGameStartMode.DIFFICULTY) { //難易度選択の時 //ルート選択に戻る prepareGameStartMode = PrepareGameStartMode.ROUTE; difficultyView.SetActive(false); routeView.SetActive(true); modeText.text = "ルート選択"; EventSystem.current.SetSelectedGameObject(selectedRoute); } else if (prepareGameStartMode == PrepareGameStartMode.MODE) { //モード選択の時 //難易度選択に戻る prepareGameStartMode = PrepareGameStartMode.DIFFICULTY; modeText.text = "難易度設定"; modeView.SetActive(false); difficultyView.SetActive(true); EventSystem.current.SetSelectedGameObject(selectedDifficulty); } } }
//ルート確定時、モードを難易度設定に変更 private void ChangeModeToDifficulty() { prepareGameStartMode = PrepareGameStartMode.DIFFICULTY; //テキスト更新 modeText.text = "難易度設定"; //UI表示切替 routeView.SetActive(false); difficultyView.SetActive(true); //フォーカス設定 EventSystem.current.SetSelectedGameObject(menuWindow.transform.Find("DifficultyView/NormalButton").gameObject); }