/// <summary> /// チュートリアルのフェイズを設定(BattleLogic側から設定される) /// </summary> /// <param name="phase"></param> public void setTutorialPhase(TutorialBattlePhase phase) { m_TutorialBattlePhaseReq = phase; // チュートリアルをスキップされた場合は、初めての戦闘でチュートリアルダイアログを表示する. if (phase == TutorialBattlePhase.INPUT && BattleParam.IsTutorial() == false ) { m_IsShowingTutorialDialog = true; new SerialProcess().Add((System.Action nextProcess) => { showFirstTutorialDialog(TutorialDialog.FLAG_TYPE.BATTLE1, nextProcess); }) .Add((System.Action nextProcess) => { showFirstTutorialDialog(TutorialDialog.FLAG_TYPE.AUTO_PLAY, nextProcess); }) .Add((System.Action nextProcess) => { m_IsNextCommand = true; m_IsShowingTutorialDialog = false; }) .Flush(); } if (BattleParam.IsTutorial()) { m_IsForbidButton = true; } }
public void updateTutorial(float delta_time) { if (BattleParam.IsTutorial() == false) { return; } m_IsForbidButton = m_IsWaitSend; bool is_continue = true; while (is_continue) { is_continue = false; bool is_update_phase = false; if (m_TutorialBattlePhaseCurrent != m_TutorialBattlePhaseReq) { m_TutorialBattlePhaseCurrent = m_TutorialBattlePhaseReq; is_update_phase = true; initPhase(); } // 場面別のコマンドを設定 if (is_update_phase) { if (m_BattleRound >= 0 && m_BattleRound < m_TutorialCommands.GetLength(0)) { if (m_TutorialBattlePhaseCurrent == TutorialBattlePhase.INPUT && m_BattleTurn != 1) { m_CommandTexts = m_TutorialCommands[m_BattleRound, (int)TutorialBattlePhase.INPUT2]; } else { m_CommandTexts = m_TutorialCommands[m_BattleRound, (int)m_TutorialBattlePhaseCurrent]; } } } // コマンドに応じて処理(ダイアログの表示など)を実行 if (m_CurrentCommandText == null && m_CommandTexts != null ) { execCommand(m_CommandTexts[0]); // 実行した分のコマンドを削除 if (m_CommandTexts.Length >= 2) { string[] dialog_texts = new string[m_CommandTexts.Length - 1]; for (int idx = 0; idx < dialog_texts.Length; idx++) { dialog_texts[idx] = m_CommandTexts[idx + 1]; } m_CommandTexts = dialog_texts; } else { m_CommandTexts = null; } } DialogButtonEventType dialog_button_event_type = DialogButtonEventType.NONE; // ユーザー入力によりダイアログ閉じる if (m_CurrentCommandText != null) { if (m_Dialog != null) { dialog_button_event_type = m_Dialog.PushButton; switch (dialog_button_event_type) { case DialogButtonEventType.OK: case DialogButtonEventType.YES: m_Dialog.Hide(); m_Dialog = null; m_CurrentCommandText = null; if (m_CommandTexts != null) { is_continue = true; } break; case DialogButtonEventType.CANCEL: case DialogButtonEventType.NO: m_Dialog.Hide(); m_Dialog = null; m_CurrentCommandText = null; if (m_CommandTexts != null) { is_continue = true; } break; } } else if (m_IsNextCommand) { is_continue = true; // 連続しているコマンドを一気に実行 m_IsNextCommand = false; dialog_button_event_type = DialogButtonEventType.OK; m_CurrentCommandText = null; } } // その他の制御 if (m_CurrentCommandText == null && m_TutorialBattlePhaseCurrent == TutorialBattlePhase.INPUT ) { switch (m_BattleRound) { case 0: if (m_TeacherProgress < teacher_data.Length) { Vector2 hand_pos = Vector2.zero; bool is_touching = updateTeacherHandPosition(delta_time, ref hand_pos); BattleSceneManager.Instance.setOverrideTouchMode(hand_pos, is_touching); } // お手本をもう一度見ますか? if (dialog_button_event_type == DialogButtonEventType.YES) { // もう一度お手本 initTeacher(); } if (dialog_button_event_type == DialogButtonEventType.NO) { // 敵を殺して次の戦闘へ m_IsAllDeadEnemy = true; } break; case 1: break; case 2: break; } } } }