Esempio n. 1
0
        public override void DoUpdate(GameTime gameTime)
        {
            if (ActiveInputManager.InputUpPressed())
            {
                ActionMenuCursor -= (ActionMenuCursor > 0) ? 1 : 0;
                sndSelection.Play();
            }
            else if (ActiveInputManager.InputDownPressed())
            {
                ActionMenuCursor += ActionMenuCursor < ListNextChoice.Count ? 1 : 0;
                sndSelection.Play();
            }
            else if (ActiveInputManager.InputMovePressed())
            {
                int X = 490;

                for (int C = 0; C < ListNextChoice.Count; ++C)
                {
                    int Y = 10 + C * fntFinlanderFont.LineSpacing;
                    if (ActiveInputManager.IsInZone(X, Y + 6, X + MinActionMenuWidth, Y + fntFinlanderFont.LineSpacing))
                    {
                        if (ActionMenuCursor != C)
                        {
                            ActionMenuCursor = C;
                            sndSelection.Play();
                        }
                        break;
                    }
                }
            }
            else if (ActiveInputManager.InputConfirmPressed())
            {
                AddToPanelListAndSelect(ListNextChoice[ActionMenuCursor]);
            }
        }
        public override void DoUpdate(GameTime gameTime)
        {
            int YStep  = 25;
            int YStart = 122;

            //Move the cursor.
            if (ActiveInputManager.InputUpPressed())
            {
                --ActiveSquad.CurrentLeader.AttackIndex;
                if (ActiveSquad.CurrentLeader.AttackIndex < 0)
                {
                    ActiveSquad.CurrentLeader.AttackIndex = ListAttack.Count - 1;
                }

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputDownPressed())
            {
                ++ActiveSquad.CurrentLeader.AttackIndex;
                if (ActiveSquad.CurrentLeader.AttackIndex >= ListAttack.Count)
                {
                    ActiveSquad.CurrentLeader.AttackIndex = 0;
                }

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputMovePressed())
            {
                for (int A = 0; A < ListAttack.Count; A++)
                {
                    if (ActiveInputManager.IsInZone(0, YStart + A * YStep, Constants.Width, YStart + (A + 1) * YStep))
                    {
                        ActiveSquad.CurrentLeader.AttackIndex = A;
                        break;
                    }
                }
            }
            //Exit the weapon panel.
            if (ActiveInputManager.InputConfirmPressed(0, YStart + ActiveSquad.CurrentLeader.AttackIndex * YStep, Constants.Width, YStart + (ActiveSquad.CurrentLeader.AttackIndex + 1) * YStep))
            {
                if (ActiveSquad.CurrentLeader.CurrentAttack.CanAttack)
                {
                    if (ActiveSquad.CurrentLeader.CurrentAttack.Pri == WeaponPrimaryProperty.PER)
                    {
                        AddToPanelListAndSelect(new ActionPanelAttackPER(Map, ActivePlayerIndex, ActiveSquadIndex));
                    }
                    else if (ActiveSquad.CurrentLeader.CurrentAttack.Pri == WeaponPrimaryProperty.MAP)
                    {
                        AddToPanelListAndSelect(new ActionPanelAttackMAP(Map, ActivePlayerIndex, ActiveSquadIndex));
                    }
                    else
                    {
                        AddToPanelListAndSelect(new ActionPanelAttackPart2(Map, ActivePlayerIndex, ActiveSquadIndex));
                    }
                }
                else
                {
                    Map.sndDeny.Play();
                }
            }
        }
Esempio n. 3
0
        private void UpdateBaseMenu(GameTime gameTime)
        {
            if (ActiveInputManager.InputLeftPressed())
            {
                Map.BattleMenuCursorIndex--;

                if (Map.BattleMenuCursorIndex == BattleMenuChoices.Support)
                {//Can't pick Support. (No Support Squads nearby)
                    if (ActiveSquadSupport.Count <= 0)
                    {
                        Map.BattleMenuCursorIndex = BattleMenuChoices.Formation;
                    }
                }
                if (Map.BattleMenuCursorIndex == BattleMenuChoices.Formation)
                {//Can't pick Formation. (No wingmans or ALL attack)
                    if (ActiveSquad.UnitsAliveInSquad == 1 || Map.BattleMenuDefenseFormationChoice == FormationChoices.ALL)
                    {
                        Map.BattleMenuCursorIndex = BattleMenuChoices.Action;
                    }
                }
                if (Map.BattleMenuCursorIndex < BattleMenuChoices.Start)
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Demo;
                }

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputRightPressed())
            {
                Map.BattleMenuCursorIndex++;

                if (Map.BattleMenuCursorIndex == BattleMenuChoices.Formation)
                {//Can't pick Formation. (No wingmans or ALL attack)
                    if (ActiveSquad.UnitsAliveInSquad == 1 || Map.BattleMenuDefenseFormationChoice == FormationChoices.ALL)
                    {
                        Map.BattleMenuCursorIndex = BattleMenuChoices.Support;
                    }
                }
                if (Map.BattleMenuCursorIndex == BattleMenuChoices.Support)
                {//Can't pick Support. (No Support Squads nearby)
                    if (ActiveSquadSupport.Count <= 0)
                    {
                        Map.BattleMenuCursorIndex = BattleMenuChoices.Demo;
                    }
                }
                if (Map.BattleMenuCursorIndex > BattleMenuChoices.Demo)
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Start;
                }

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputMovePressed())
            {
                if (ActiveInputManager.IsInZone(0, Constants.Height - 30, 125, Constants.Height))
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Start;
                }
                else if (ActiveInputManager.IsInZone(125, Constants.Height - 30, 255, Constants.Height))
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Action;
                }
                else if (ActiveInputManager.IsInZone(255, Constants.Height - 30, 385, Constants.Height) &&
                         (ActiveSquad.UnitsAliveInSquad > 1 && Map.BattleMenuDefenseFormationChoice != FormationChoices.ALL))
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Formation;
                }
                else if (ActiveInputManager.IsInZone(385, Constants.Height - 30, 510, Constants.Height) && ActiveSquadSupport.Count > 0)
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Support;
                }
                else if (ActiveInputManager.IsInZone(510, Constants.Height - 30, 635, Constants.Height))
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Demo;
                }
            }
            else if (ActiveInputManager.InputCommand1Pressed())
            {
                Map.SpiritMenu.InitSpiritScreen(ActiveSquad);

                Map.BattleMenuStage = BattleMenuStages.Default;
            }
            else if (ActiveInputManager.InputCommand2Pressed())
            {
                //Constants.ShowAnimation = !Constants.ShowAnimation;

                Map.sndSelection.Play();
            }
            if (ActiveInputManager.InputConfirmPressed())
            {
                switch (Map.BattleMenuCursorIndex)
                {
                //Begin attack.
                case BattleMenuChoices.Start:
                    StartBattle();
                    break;

                case BattleMenuChoices.Action:
                    if (ActiveSquad.UnitsAliveInSquad == 1)
                    {
                        ActiveSquad.CurrentLeader.UpdateNonMAPAttacks(ActiveSquad.Position, TargetSquad.Position, TargetSquad.ArrayMapSize, TargetSquad.CurrentMovement, ActiveSquad.CanMove);

                        ActiveSquad.CurrentLeader.AttackIndex = 0;    //Make sure you select the first weapon.
                        Map.BattleMenuStage = BattleMenuStages.ChooseAttack;
                    }
                    else
                    {
                        Map.BattleMenuStage             = BattleMenuStages.ChooseSquadMember; //Choose squad member.
                        Map.BattleMenuCursorIndexSecond = 1;                                  //Leader is attacking, can't put him on defend or evade.
                    }
                    break;

                case BattleMenuChoices.Formation:
                    Map.BattleMenuCursorIndexSecond = (int)Map.BattleMenuOffenseFormationChoice;
                    Map.BattleMenuStage             = BattleMenuStages.ChooseFormation;
                    break;

                case BattleMenuChoices.Support:
                    Map.BattleMenuCursorIndexSecond = 0;
                    ActiveSquadSupportIndexOld      = ActiveSquadSupport.ActiveSquadSupportIndex;
                    Map.BattleMenuStage             = BattleMenuStages.ChooseSupport;
                    break;

                case BattleMenuChoices.Demo:
                    Constants.ShowAnimation = !Constants.ShowAnimation;
                    break;
                }

                Map.sndConfirm.Play();
            }
            else if (ActiveInputManager.InputCancelPressed())
            {
                CancelPanel();
            }
        }
Esempio n. 4
0
        private void UpdateAttackSelection(GameTime gameTime)
        {
            if (ActiveInputManager.InputUpPressed())
            {
                --ActiveSquad.CurrentLeader.AttackIndex;
                if (ActiveSquad.CurrentLeader.AttackIndex < 0)
                {
                    ActiveSquad.CurrentLeader.AttackIndex = ListAttackActiveSquadSupport.Count - 1;
                }

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputDownPressed())
            {
                ++ActiveSquad.CurrentLeader.AttackIndex;
                if (ActiveSquad.CurrentLeader.AttackIndex >= ListAttackActiveSquadSupport.Count)
                {
                    ActiveSquad.CurrentLeader.AttackIndex = 0;
                }

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputMovePressed())
            {
                int YStep = 25;

                for (int A = 0; A < ListAttackActiveSquadSupport.Count; ++A)
                {
                    int YStart = 122 + A * YStep;
                    if (ActiveInputManager.IsInZone(0, YStart, Constants.Width, YStart + YStep))
                    {
                        ActiveSquad.CurrentLeader.AttackIndex = A;
                        break;
                    }
                }
            }
            //Exit the weapon panel.
            else if (ActiveInputManager.InputConfirmPressed())
            {
                if (ActiveSquad.CurrentLeader.CurrentAttack.CanAttack)
                {
                    if (ActiveSquad.CurrentLeader.CurrentAttack.Pri == WeaponPrimaryProperty.ALL)
                    {
                        Map.BattleMenuOffenseFormationChoice = FormationChoices.ALL;
                    }

                    Map.BattleMenuStage = BattleMenuStages.Default;
                    ActiveSquad.CurrentLeader.AttackAccuracy = Map.CalculateHitRate(ActiveSquad.CurrentLeader, ActiveSquad,
                                                                                    TargetSquad.CurrentLeader, TargetSquad, TargetSquad.CurrentLeader.BattleDefenseChoice).ToString() + "%";
                    if (!Map.ListPlayer[TargetPlayerIndex].IsPlayerControlled)
                    {
                        PrepareDefenseSquadForBattle(Map, ActivePlayerIndex, ActiveSquadIndex, TargetPlayerIndex, TargetSquadIndex);
                    }

                    Map.sndConfirm.Play();
                }
                else
                {
                    Map.sndDeny.Play();
                }
            }
            else if (ActiveInputManager.InputCancelPressed())
            {
                Map.BattleMenuStage = BattleMenuStages.Default;
                Map.sndCancel.Play();
            }
        }
Esempio n. 5
0
        private void UpdateBaseMenu(GameTime gameTime)
        {
            if (ActiveInputManager.InputLeftPressed())
            {
                Map.BattleMenuCursorIndex--;

                if (Map.BattleMenuCursorIndex == BattleMenuChoices.Formation)
                {//Can't pick Formation. (No wingmans or ALL attack)
                    if (TargetSquad.UnitsAliveInSquad == 1 || Map.BattleMenuDefenseFormationChoice == FormationChoices.ALL)
                    {
                        Map.BattleMenuCursorIndex = BattleMenuChoices.Action;
                    }
                }
                else if (Map.BattleMenuCursorIndex < BattleMenuChoices.Start)
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Demo;
                }

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputRightPressed())
            {
                Map.BattleMenuCursorIndex++;

                if (Map.BattleMenuCursorIndex == BattleMenuChoices.Formation)
                {//Can't pick Formation. (No wingmans or ALL attack)
                    if (TargetSquad.UnitsAliveInSquad == 1 || Map.BattleMenuDefenseFormationChoice == FormationChoices.ALL)
                    {
                        Map.BattleMenuCursorIndex = BattleMenuChoices.Support;
                    }
                }
                else if (Map.BattleMenuCursorIndex > BattleMenuChoices.Demo)
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Start;
                }

                Map.sndSelection.Play();
            }
            else if (ActiveInputManager.InputMovePressed())
            {
                if (ActiveInputManager.IsInZone(0, Constants.Height - 30, 125, Constants.Height))
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Start;
                }
                else if (ActiveInputManager.IsInZone(125, Constants.Height - 30, 255, Constants.Height))
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Action;
                }
                else if (ActiveInputManager.IsInZone(255, Constants.Height - 30, 385, Constants.Height) &&
                         (ActiveSquad.UnitsAliveInSquad > 1 && Map.BattleMenuDefenseFormationChoice != FormationChoices.ALL))
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Formation;
                }
                else if (ActiveInputManager.IsInZone(385, Constants.Height - 30, 510, Constants.Height) && ActiveSquadSupport.Count > 0)
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Support;
                }
                else if (ActiveInputManager.IsInZone(510, Constants.Height - 30, 635, Constants.Height))
                {
                    Map.BattleMenuCursorIndex = BattleMenuChoices.Demo;
                }
            }
            else if (ActiveInputManager.InputCommand2Pressed())
            {
                Constants.ShowAnimation = !Constants.ShowAnimation;

                Map.sndSelection.Play();
            }
            if (ActiveInputManager.InputConfirmPressed())
            {
                switch (Map.BattleMenuCursorIndex)
                {
                case BattleMenuChoices.Start:
                    Map.ComputeTargetPlayerOffense(ActivePlayerIndex, ActiveSquadIndex, ActiveSquadSupport, TargetPlayerIndex, TargetSquadIndex, TargetSquadSupport);
                    break;

                case BattleMenuChoices.Action:
                    Map.BattleMenuCursorIndexSecond = 0;
                    if (TargetSquad.UnitsAliveInSquad == 1)
                    {
                        Map.BattleMenuStage             = BattleMenuStages.ChooseDefense;
                        Map.BattleMenuCursorIndexSecond = (int)TargetSquad.CurrentLeader.BattleDefenseChoice;
                    }
                    else
                    {
                        Map.BattleMenuStage = BattleMenuStages.ChooseSquadMember;    //Choose squad member.
                    }
                    break;

                case BattleMenuChoices.Formation:
                    if (Map.BattleMenuDefenseFormationChoice != FormationChoices.ALL)
                    {
                        Map.BattleMenuCursorIndexSecond = (int)Map.BattleMenuDefenseFormationChoice;
                        Map.BattleMenuStage             = BattleMenuStages.ChooseFormation;
                    }
                    break;

                case BattleMenuChoices.Support:
                    Map.BattleMenuCursorIndexSecond = 0;
                    Map.BattleMenuStage             = BattleMenuStages.ChooseSupport;
                    break;

                case BattleMenuChoices.Demo:
                    Constants.ShowAnimation = !Constants.ShowAnimation;
                    break;
                }

                Map.sndConfirm.Play();
            }
            else if (ActiveInputManager.InputCancelPressed() && Map.ListPlayer[ActivePlayerIndex].IsPlayerControlled)//Can't cancel out of AI attacks.
            {
                CancelPanel();
            }
        }