Ejemplo n.º 1
0
        public override void Update(GameTime gameTime)
        {
            if (Stage == -1)
            {
                if (KeyboardHelper.InputUpPressed())
                {
                    if (CursorIndex > 0)
                    {
                        CursorIndex--;
                    }
                }
                else if (KeyboardHelper.InputDownPressed())
                {
                    if (CursorIndex < 8 && CursorIndex + 1 + (PageCurrent - 1) * 8 < ListUnitSelection.Count)
                    {
                        CursorIndex++;
                    }
                }
                else if (KeyboardHelper.InputLeftPressed())
                {
                    if (PageCurrent > 1)
                    {
                        PageCurrent--;
                    }
                }
                else if (KeyboardHelper.InputRightPressed())
                {
                    if (PageCurrent * 8 < ListUnitSelection.Count)
                    {
                        PageCurrent++;
                    }
                }
                else if (KeyboardHelper.InputConfirmPressed())
                {
                    //If the Unit has a pilot.
                    if (ListUnitSelection[CursorIndex + (PageCurrent - 1) * 8].ArrayCharacterActive[0] != null)
                    {
                        if (ListUnitSelected.Contains(CursorIndex + (PageCurrent - 1) * 8))
                        {
                            ListUnitSelected.Remove(CursorIndex + (PageCurrent - 1) * 8);
                        }
                        else
                        {
                            ListUnitSelected.Add(CursorIndex + (PageCurrent - 1) * 8);
                        }
                        if (ListUnitSelected.Count >= NbUnitsToSelect)
                        {
                            List <Player> ListPlayers    = new List <Player>();
                            List <Unit>   ListPlayerUnit = new List <Unit>();
                            for (int U = 0; U < ListUnitSelected.Count; U++)
                            {
                                ListPlayerUnit.Add(ListUnitSelection[ListUnitSelected[U]]);
                            }
                            ListPlayers.Add(new Player("noname", PlayerTypes.Human, ListPlayerUnit, 0));

                            GameScreen.PushScreen(new DeathmatchMap(ListPlayers));
                            GameScreen.RemoveScreen(this);
                        }
                    }
                    else//Open the pop up menu.
                    {
                        Stage++;
                    }
                }
                else if (KeyboardHelper.InputCancelPressed())
                {
                    GameScreen.RemoveAllScreens();
                    GameScreen.PushScreen(new IntermissionScreen());
                }
            }
            else
            {
                if (KeyboardHelper.InputCancelPressed() || KeyboardHelper.InputConfirmPressed())
                {
                    Stage--;
                }
            }
        }
        public override void Update(GameTime gameTime)
        {
            if (SelectedAlphaAppearing)
            {//Increment SelectedAlpha before comparing it to 200
                if (++SelectedAlpha >= 200)
                {
                    SelectedAlphaAppearing = false;
                }
            }
            else
            {//Decrement SelectedAlpha before comparing it to 55
                if (--SelectedAlpha <= 55)
                {
                    SelectedAlphaAppearing = true;
                }
            }
            if (KeyboardHelper.InputUpPressed())
            {
                if (Menu[SelectedChoice].Open)
                {
                    if (SubMenu > -1)
                    {
                        SubMenu--;
                    }
                    else
                    {
                        //Decrement SelectedChoice before comparing it to 0
                        if (--SelectedChoice < 0)
                        {
                            SelectedChoice = Menu.Count() - 1;
                        }
                        SubMenu = -1;
                    }
                }
                else
                {
                    SelectedChoice -= SelectedChoice > 0 ? 1 : 0;
                    if (Menu[SelectedChoice].Open)
                    {
                        SubMenu = Menu[SelectedChoice].Categories.Count() - 1;
                    }
                }
                Up.Play();
            }
            else if (KeyboardHelper.InputDownPressed())
            {
                if (Menu[SelectedChoice].Open)
                {
                    if (SubMenu < Menu[SelectedChoice].Categories.Count() - 1)
                    {
                        SubMenu++;
                    }
                    else
                    {
                        SelectedChoice++;
                        SubMenu = -1;
                    }
                }
                else
                //Increment SelectedChoice before comparing it to maximum value.
                if (++SelectedChoice > Menu.Count() - 1)
                {
                    SelectedChoice = 0;
                }
                Down.Play();
            }
            else if (KeyboardHelper.InputConfirmPressed())
            {
                switch ((MenuChoice)SelectedChoice)
                {
                case MenuChoice.StartBattle:
                    GameScreen.PushScreen(new UnitSelection(3));

                    GameScreen.RemoveScreen(this);
                    break;

                case MenuChoice.View:
                    if (SubMenu == 0)    //Pilot
                    {
                    }
                    else if (SubMenu == 1)    //Units
                    {
                    }
                    else if (SubMenu == 2)    //Parts
                    {
                    }
                    GameScreen.PushScreen(new Shop());
                    break;

                case MenuChoice.Customize:
                    if (SubMenu == 0)    //Unit
                    {
                        GameScreen.PushScreen(new SquadSelection());
                    }
                    else if (SubMenu == 1)    //Pilot
                    {
                        GameScreen.PushScreen(new PilotSelection());
                    }
                    else if (SubMenu == 2)    //Parts
                    {
                        //GameScreen.PushScreen(new PartsEquipScreen(serviceProvider, UnitArmoredCore.ListUnitArmoredCore[0]));
                    }
                    else if (SubMenu == 3)    //Shop
                    {
                        GameScreen.PushScreen(new Shop());
                    }
                    else if (SubMenu == 4)    //Forge
                    {
                        GameScreen.PushScreen(new Forge());
                    }
                    break;

                case MenuChoice.Data:

                    break;

                case MenuChoice.Multiplayer:
                    GameScreen.PushScreen(new MultiplayerScreen());
                    break;

                case MenuChoice.Exit:
                    GameScreen.RemoveScreen(this);
                    break;
                }
            }
        }
Ejemplo n.º 3
0
        public override void Update(GameTime gameTime)
        {
            if (KeyboardHelper.InputUpPressed())
            {
                if (Stage == -1)
                {
                    if (CursorIndexUnitSelection > 0)
                    {
                        CursorIndexUnitSelection--;
                    }
                }
                else if (Stage == 0)
                {
                    if (CursorIndexSubMenu > 0)
                    {
                        CursorIndexSubMenu--;
                    }
                }
                else if (Stage == 1)
                {
                    if (CursorIndexPilotPosition > 0)
                    {
                        CursorIndexPilotPosition--;
                    }
                }
            }
            else if (KeyboardHelper.InputDownPressed())
            {
                if (Stage == -1)
                {
                    if (CursorIndexUnitSelection < ItemPerPage - 1 && CursorIndexUnitSelection + 1 + (PageCurrentUnitSelection - 1) * ItemPerPage < Game.ListUnit.Count)
                    {
                        CursorIndexUnitSelection++;
                    }
                }
                else if (Stage == 0)
                {
                    if (CursorIndexSubMenu < SelectedUnit.MaxCharacter)
                    {
                        CursorIndexSubMenu++;
                    }
                }
                else if (Stage == 1)
                {
                    if (CursorIndexPilotPosition < SelectedUnit.MaxCharacter)
                    {
                        CursorIndexPilotPosition++;
                    }
                }
            }
            else if (KeyboardHelper.InputLeftPressed())
            {
                if (Stage == -1)
                {
                    if (PageCurrentUnitSelection > 1)
                    {
                        PageCurrentUnitSelection--;
                    }
                }
                else if (Stage == 1)
                {
                    if (PageCurrentPilotPosition > 1)
                    {
                        PageCurrentPilotPosition--;
                    }
                }
            }
            else if (KeyboardHelper.InputRightPressed())
            {
                if (Stage == -1)
                {
                    if (PageCurrentUnitSelection * ItemPerPage < Game.ListUnit.Count)
                    {
                        PageCurrentUnitSelection++;
                    }
                }

                else if (Stage == 1)
                {
                    if ((PageCurrentPilotPosition + 1) * ItemPerPage < ListCharacterInfo.Count)
                    {
                        PageCurrentPilotPosition++;
                    }
                }
            }
            else if (KeyboardHelper.InputConfirmPressed())
            {
                if (Stage == -1)
                {
                    SelectedUnit       = Game.ListUnit[CursorIndexUnitSelection + (PageCurrentUnitSelection - 1) * ItemPerPage];
                    CursorIndexSubMenu = 0;
                    Stage++;
                }
                else if (Stage == 0)
                {
                    CursorIndexPilotPosition = 0;
                    PageCurrentPilotPosition = 1;
                    Stage++;
                }
                else if (Stage == 1)
                {
                    int CharacterIndex = CursorIndexPilotPosition + (PageCurrentPilotPosition - 1) * PilotPerPage;
                    if (ListCharacterInfo[CharacterIndex].UnitIndex != -1)
                    {
                        Game.ListUnit[ListCharacterInfo[CharacterIndex].UnitIndex].ArrayCharacterActive[ListCharacterInfo[CharacterIndex].CharacterUnitIndex] = null;
                    }
                    //If the selection is not empty, add the pilot.
                    if (CharacterIndex != 0)
                    {
                        SelectedUnit.ArrayCharacterActive[CursorIndexSubMenu] = Game.ListCharacter[CharacterIndex - 1];
                        ListCharacterInfo[CharacterIndex].UnitName            = SelectedUnit.Name;
                        ListCharacterInfo[CharacterIndex].UnitIndex           = CursorIndexUnitSelection + (PageCurrentUnitSelection - 1) * ItemPerPage;
                        ListCharacterInfo[CharacterIndex].CharacterUnitIndex  = CursorIndexSubMenu;
                    }
                    else
                    {
                        SelectedUnit.ArrayCharacterActive[CursorIndexSubMenu] = null;
                        ListCharacterInfo[CharacterIndex].UnitName            = "------";
                        ListCharacterInfo[CharacterIndex].UnitIndex           = -1;
                        ListCharacterInfo[CharacterIndex].CharacterUnitIndex  = -1;
                    }
                    Stage = -1;
                }
            }
            else if (KeyboardHelper.InputCancelPressed())
            {
                if (Stage > -1)
                {
                    Stage--;
                }
                else
                {
                    GameScreen.RemoveScreen(this);
                }
            }
        }