private void UpdateInput(bool active)
        {
            bool cancel =
                CancelButton.consume_trigger(MouseButtons.Left) ||
                CancelButton.consume_trigger(TouchGestures.Tap);

            bool changeDifficulty =
                active && Global.Input.triggered(Inputs.X);

            changeDifficulty |=
                DifficultyButton.consume_trigger(MouseButtons.Left) ||
                DifficultyButton.consume_trigger(TouchGestures.Tap);

            // Selecting chapter
            if (this.SelectingChapter)
            {
                cancel |= CommandWindow.is_canceled();
                bool left = false, right = false;
                if (active && MenuData.MultipleArcs && ModeSwitchTimer <= 0)
                {
                    if (Global.Input.triggered(Inputs.Left) ||
                        Global.Input.gesture_triggered(TouchGestures.SwipeRight))
                    {
                        left = true;
                    }
                    else if (Global.Input.triggered(Inputs.Right) ||
                             Global.Input.gesture_triggered(TouchGestures.SwipeLeft))
                    {
                        right = true;
                    }
                }

                if (cancel)
                {
                    OnCanceled(new EventArgs());
                }
                else if (changeDifficulty)
                {
                    SwitchDifficulty(true);
                }
                else if (left || right)
                {
                    Global.game_system.play_se(System_Sounds.Status_Page_Change);
                    MenuData.ChangeArc(right);
                    MenuData.Index = MenuData.IndexRedirect[0];
                    CreateCommandWindow();
                    Refresh();
                    ModeSwitchTimer = Constants.WorldMap.WORLDMAP_MODE_SWITCH_DELAY;
                }
                else if (CommandWindow.is_selected())
                {
                    OnChapterSelected(new EventArgs());
                }
            }
            // Chapter selected
            else
            {
                cancel |= ChapterCommandWindow.is_canceled();

                if (cancel)
                {
                    Global.game_system.play_se(System_Sounds.Cancel);
                    CloseChapterCommands();
                }
                else if (changeDifficulty)
                {
                    SwitchDifficulty(true);
                }
                else if (ChapterCommandWindow.is_selected())
                {
                    OnChapterCommandSelected(new EventArgs());
                }
            }
        }
    void SpawnButton(Difficulty d)
    {
        DifficultyButton b = Instantiate(buttonPrefab, transform);

        b.SetDifficulty(d);
    }
 public TriggerClickedHandler(DifficultyButton difficultyButton, TextMesh textMesh)
 {
     this.difficultyButton = difficultyButton;
     this.textMesh         = textMesh;
 }