private void OnUserInput(EventData data, ScenarioChoice choice)
        {
            if (data.gameObject != gameObject)
            {
                return;
            }

            //ユーザが質問に答えて、次のIDが指定されている場合
            if ((int)choice > 0 && scenario.dialogs[index].choices[(int)choice - 1].nextID > 0)
            {
                index = scenario.dialogs[index].choices[(int)choice - 1].nextID;
            }
            //そのまま次に進む
            else if (scenario.dialogs[index].nextID < 1)
            {
                index++;
            }
            //次のIDが指定されている場合
            else
            {
                index = scenario.dialogs[index].nextID;
            }

            if (scenario.dialogs.Keys.Max() >= index)
            {
                ShowDialogue(data, index);
            }
            else
            {
                ScenarioEngine.Instance.StopScenario(data);
            }
        }
Example #2
0
        /// <summary>
        /// ユーザーイベント、クリックや選択が発生
        /// </summary>
        /// <param name="choice"></param>
        public void ScenarioSelect(ScenarioChoice choice)
        {
            //Debug.Log("ScenarioSelect" + choice.ToString());
            if (isRunning && currentEventData.scenarioType != ScenarioType.None)
            {
                if (StepScenario && isStepRunning)
                {
                    skipStep = true;
                }
                else
                {
                    scenarioChoice = choice;
#if ENABLE_MoonSharp
                    coroutine?.Coroutine.Resume((int)scenarioChoice);
#endif
                    OnUserInput?.Invoke(currentEventData, scenarioChoice);
                }
            }
            else if (currentEventData.scenarioType != ScenarioType.None)
            {
                currentEventData.Stop();
#if ENABLE_MoonSharp
                coroutine = null;
#endif
                OnMessageEnd?.Invoke(currentEventData);
            }
        }