예제 #1
0
 public void ShowSubMenu(ActionMenu subMenu)
 {
     subMenu.Position = new Squid.Point(this.Position.x + this.Size.x, this.Position.y + 20);
     subMenu.Visible = true;
     subMenu.Parent = this.Parent;
     subMenu.TitleBar.Button.OnMouseClick += (c, e) =>
                                                 {
                                                     subMenu.Visible = false;
                                                     subMenu.Parent = null;
                                                 };
 }
예제 #2
0
        public override void OnEnter()
        {
            base.OnEnter();

            if (GameState.IsAIControlled(_actionActor))
            {
                NextState = new StateTransition(() => new AIDecision(GameState, _actionActor));
                return;
            }

            GameState.Desktop.Visible = true;
            GameState.Desktop.ShowCursor = true;

            if (_actionSubMenu == null)
            {
                var menuBuilder = new ActionMenuBuilder().AsSubMenu();
                foreach (var ability in _actionActor.AbilityList)
                {
                    var selectedAbility = ability;
                    menuBuilder.Action(ability.AbilityDetails.AbilityName, (ctl, e) => SwitchToTargetSelection(selectedAbility.AbilityMethod(GameState.Level, ability.AbilityDetails)));
                }
                menuBuilder.Size(200, 200);
                _actionSubMenu = menuBuilder.Build();
            }
            if (_actionMenu == null)
            {
                var actionMenuBuilder = new ActionMenuBuilder()
                    .ActorName(_actionActor.ActorId);

                if (_actionActor.CanAction())
                {
                    actionMenuBuilder
                        .Action("Action", (ctl, e) => _actionMenu.ShowSubMenu(_actionSubMenu));
                }
                if (_actionActor.CanMove())
                {
                    actionMenuBuilder
                        .Action("Move", (ctl, e) => SwitchToTargetSelection(_actionActor.MoveToTile(GameState.Level)));
                }

                actionMenuBuilder
                    .Action("Wait", (ctl, e) => SwitchToWaitDirection())
                    .Position(50, 100)
                    .Size(200, 200)
                    .Parent(GameState.Desktop);

                _actionMenu = actionMenuBuilder.Build();
            }
            _actionMenu.Visible = true;
            _actionSubMenu.Visible = true;
        }