public EventSelectionPanel CreateSelectionPanel()
        {
            EventSelectionPanel selectionPanel =
                Instantiate(selectionPanelPrefab, battleCanvas)
                .AddComponent <EventSelectionPanel>();

            return(selectionPanel);
        }
        public CommandPhase OnUpdate(LinkedListNode <UIActionType> input)
        {
            switch (input.Value)
            {
            case UIActionType.SubmitUICommand:
                commandData.battleManager.PauseRequested(BattleTimer.PauseRequestType.ChooseCommand, commandData.playerController);
                EventSelectionPanel sp = commandData.battleHUD.CreateSelectionPanel();
                sp.SetOptionList(commandData.playerController.GetCommandList(), "Command");
                commandData.commandStack.Push(sp);
                return(CommandPhase.SelectingCommand);
            }

            return(CommandPhase.WaitingForInput);
        }
        public CommandPhase OnUpdate(LinkedListNode <UIActionType> input)
        {
            EventSelectionPanel currentUIPanel = null;

            if (commandData.commandStack.Count > 0)
            {
                currentUIPanel = commandData.commandStack.Peek();
            }
            else
            {
                throw new System.Exception("Invalid CommandPhase State - " +
                                           "Currently in SelectingCommandPhase but there are no command panels");
            }

            switch (input.Value)
            {
            case UIActionType.Down:
                currentUIPanel.NavigateDown();
                break;

            case UIActionType.Up:
                currentUIPanel.NavigateUp();
                break;

            case UIActionType.Right:
                currentUIPanel.NavigateRight();
                break;

            case UIActionType.Left:
                currentUIPanel.NavigateLeft();
                break;

            case UIActionType.CancelUICommand:
                currentUIPanel.Hide();
                currentUIPanel.DestroyPanel();
                commandData.commandStack.Pop();
                if (commandData.commandStack.Count == 0)
                {
                    return(CommandPhase.WaitingForInput);
                }
                break;

            case UIActionType.SubmitUICommand:

                ISelectionItem command = currentUIPanel.GetSelectedItem();
                switch (command.GetSelectionType())
                {
                case ISelectionType.ItemSelected:
                    return(CommandPhase.SelectingTarget);

                case ISelectionType.OpenSubMenu:
                    EventSelectionPanel esp = commandData.battleHUD.CreateSelectionPanel();
                    esp.SetOptionList(((SubMenuSelectionItem)command).subList, command.GetName());
                    commandData.commandStack.Push(esp);
                    break;
                }

                break;
            }

            return(CommandPhase.SelectingCommand);
        }