Esempio n. 1
0
        public override void OnSelect()
        {
            ListNextChoice.Clear();
            if (IsPostAttack)
            {
                AddChoiceToCurrentPanel(new ActionPanelWait(Map, ActiveSquad));
            }
            else
            {
                Map.UpdateAllAttacks(ActiveSquad.CurrentLeader, Map.CursorPosition, Map.ListPlayer[Map.ActivePlayerIndex].Team, false);

                if (ActiveSquad.CurrentLeader.CanAttack)
                {
                    AddChoiceToCurrentPanel(new ActionPanelAttackPart1(Map, ActivePlayerIndex, ActiveSquadIndex, false));
                }

                if (ActiveSquad.CurrentLeader.Boosts.PostMovementModifier.Spirit)
                {
                    AddChoiceToCurrentPanel(new ActionPanelSpirit(Map, ActiveSquad));
                }

                ActiveSquad.CurrentLeader.OnMenuMovement(ActivePlayerIndex, ActiveSquad, Map.ListActionMenuChoice);

                int SquadIndex = Map.CheckForSquadAtPosition(Map.ActivePlayerIndex, Map.CursorPosition, Vector3.Zero);
                if (SquadIndex >= 0 && Map.ListPlayer[Map.ActivePlayerIndex].ListSquad[SquadIndex] != ActiveSquad)
                {
                    AddChoiceToCurrentPanel(new ActionPanelBoard(Map, Map.ListPlayer[Map.ActivePlayerIndex].ListSquad[SquadIndex], ActiveSquad));
                }
                else
                {
                    AddChoiceToCurrentPanel(new ActionPanelWait(Map, ActiveSquad));
                }

                foreach (ActionPanel OptionalPanel in GetPropPanelsOnUnitStop(ActiveSquad))
                {
                    AddChoiceToCurrentPanel(OptionalPanel);
                }

                new ActionPanelRepair(Map, this, ActiveSquad).OnSelect();
            }

            //Movement initialisation.
            Map.MovementAnimation.Add(ActiveSquad.X, ActiveSquad.Y, ActiveSquad);

            //Move the Unit to the cursor position
            ActiveSquad.SetPosition(Map.CursorPosition);

            Map.CursorPosition        = ActiveSquad.Position;
            Map.CursorPositionVisible = Map.CursorPosition;
        }
Esempio n. 2
0
        public override void DoUpdate(GameTime gameTime)
        {
            Map.LayerManager.AddDrawablePoints(ListMVChoice, Color.FromNonPremultiplied(0, 128, 0, 190));
            Map.LayerManager.AddDrawablePath(ListMovedOverTerrain);

            Map.CursorControl(ActiveInputManager);//Move the cursor

            if (ActiveInputManager.InputConfirmPressed())
            {
                if (CheckIfUnitCanMove())
                {
                    ListNextChoice.Clear();

                    AddToPanelListAndSelect(new ActionPanelMovePart2(Map, ActivePlayerIndex, ActiveSquadIndex, IsPostAttack, ListMovedOverPoint));

                    Map.sndConfirm.Play();
                }
            }
            else if (Map.CursorPosition == ActiveSquad.Position)
            {
                ListMovedOverTerrain.Clear();
                ListMovedOverPoint.Clear();
                ListMovedOverTerrain.Add(Map.GetTerrain(ActiveSquad.X, ActiveSquad.Y, (int)ActiveSquad.Z));
                ListMovedOverPoint.Add(ActiveSquad.Position);
                LastCusorMVPosition = Map.CursorPosition;
            }
            else if (ListMVPoints.Contains(Map.CursorPosition) && Map.CursorPosition != LastCusorMVPosition)
            {
                if (Math.Abs(LastCusorMVPosition.X - Map.CursorPosition.X) + Math.Abs(LastCusorMVPosition.Y - Map.CursorPosition.Y) > 1)
                {
                    ComputeNewHoverPath();
                }
                else if (ListMovedOverPoint.Contains(Map.CursorPosition))
                {
                    RemoveHoverChoice();
                }
                else
                {
                    AddHoverChoice();
                }

                LastCusorMVPosition = Map.CursorPosition;
            }
        }
Esempio n. 3
0
        public override void OnSelect()
        {
            ActionMenuCursor = 0;
            ListNextChoice.Clear();
            AddChoiceToCurrentPanel(new ActionPanelEndTurn(Map, sprCursorConfirmEndNo, sprCursorConfirmEndYes));
            AddChoiceToCurrentPanel(new ActionPanelObjectives(Map, fntFinlanderFont));
            AddChoiceToCurrentPanel(new ActionPanelUnitList(Map, sprBarLargeBackground, sprBarLargeEN, sprBarLargeHP, sprMapMenuBackground, sprLand, sprSea, sprSky,
                                                            sprSpace, fntFinlanderFont));
            AddChoiceToCurrentPanel(new ActionPanelQuickSave(Map));
            AddChoiceToCurrentPanel(new ActionPanelOptions(Map));

            if (GameScreen.UseDebugMode)
            {
                AddChoiceToCurrentPanel(new ActionPanelDebugScreen(Map));
            }

            if (ActionPanelMapSwitch.GetActiveSubMaps(Map).Count > 1)
            {
                AddChoiceToCurrentPanel(new ActionPanelMapChange(Map, fntFinlanderFont));
            }
        }
        public override void DoUpdate(GameTime gameTime)
        {
            Map.ListLayer[Map.ActiveLayerIndex].LayerGrid.AddDrawablePoints(ListMVChoice, Color.FromNonPremultiplied(0, 128, 0, 190));
            Map.CursorControl();//Move the cursor
            if (InputHelper.InputConfirmPressed() || MouseHelper.InputLeftButtonReleased())
            {
                if (MouseHelper.InputLeftButtonReleased())
                {
                    if (MouseHelper.MouseStateCurrent.X < 0 || MouseHelper.MouseStateCurrent.X > Constants.Width ||
                        MouseHelper.MouseStateCurrent.Y < 0 || MouseHelper.MouseStateCurrent.Y > Constants.Height)
                    {
                        return;
                    }
                }
                if (ListMVChoice.Contains(Map.CursorPosition))
                {
                    ListNextChoice.Clear();

                    AddToPanelListAndSelect(new ActionPanelMovePart2(Map, ActiveSquad, ActivePlayerIndex, IsPostAttack));

                    Map.sndConfirm.Play();
                }
            }
        }
Esempio n. 5
0
        public override void OnSelect()
        {
            Map.ActiveSquadIndex = ActiveSquadIndex;

            //Update weapons to decide if the attack choice is drawn.
            Map.UpdateAllAttacks(ActiveSquad.CurrentLeader, ActiveSquad.Position, Map.ListPlayer[ActivePlayerIndex].Team, ActiveSquad.CanMove);

            ListNextChoice.Clear();

            if (ActiveSquad.CanMove)
            {
                AddChoiceToCurrentPanel(new ActionPanelMovePart1(Map, ActivePlayerIndex, ActiveSquadIndex, Map.CursorPosition, Map.CameraPosition));
                if (ActiveSquad.CurrentLeader.CanAttack)
                {
                    AddChoiceToCurrentPanel(new ActionPanelAttackPart1(Map, ActivePlayerIndex, ActiveSquadIndex, ActiveSquad.CanMove));
                }
                AddChoiceToCurrentPanel(new ActionPanelSpirit(Map, ActiveSquad));
                new ActionPanelConsumableParts(Map, this, ActiveSquad).OnSelect();
            }

            if (ActiveSquad.CanTransportUnit && ActiveSquad.ListTransportedUnit.Count > 0)
            {
                AddToPanelListAndSelect(new ActionPanelDeploy(Map, ActiveSquad));
            }
            AddChoiceToCurrentPanel(new ActionPanelStatus(Map, ActiveSquad));
            AddChoiceToCurrentPanel(new ActionPanelDebug(ActiveSquad, Map));

            if (ActiveSquad.CanMove)
            {
                //Add the squad options.
                if (ActiveSquad.CurrentWingmanA != null)
                {
                    AddChoiceToCurrentPanel(new ActionPanelFormation(Map, ActivePlayerIndex, ActiveSquadIndex));
                }

                List <ActionPanel> DicOptionalPanel = ActiveSquad.OnMenuSelect(ActivePlayerIndex, Map.ListActionMenuChoice);
                foreach (ActionPanel OptionalPanel in DicOptionalPanel)
                {
                    AddChoiceToCurrentPanel(OptionalPanel);
                }

                foreach (ActionPanel OptionalPanel in GetPropPanelsOnUnitSelected(ActiveSquad))
                {
                    AddChoiceToCurrentPanel(OptionalPanel);
                }

                if (ActiveSquad.CurrentLeader.ListTerrainChoices.Contains(UnitStats.TerrainLand) &&
                    ActiveSquad.CurrentMovement != UnitStats.TerrainLand &&
                    Map.GetTerrainType(ActiveSquad.X, ActiveSquad.Y, (int)ActiveSquad.Position.Z) == UnitStats.TerrainLand)
                {
                    AddChoiceToCurrentPanel(new ActionPanelLand(Map, ActiveSquad));
                }

                if (ActiveSquad.CurrentLeader.ListTerrainChoices.Contains(UnitStats.TerrainUnderwater) &&
                    ActiveSquad.CurrentMovement != UnitStats.TerrainUnderwater &&
                    Map.GetTerrainType(ActiveSquad.X, ActiveSquad.Y, (int)ActiveSquad.Position.Z) == UnitStats.TerrainSea)
                {
                    AddChoiceToCurrentPanel(new ActionPanelDive(Map, ActiveSquad));
                }

                if (ActiveSquad.CurrentMovement != UnitStats.TerrainAir)
                {
                    if (ActiveSquad.CurrentLeader.ListTerrainChoices.Contains(UnitStats.TerrainAir))
                    {
                        if (ActiveSquad.CurrentWingmanA != null)
                        {
                            if (ActiveSquad.CurrentWingmanA.ListTerrainChoices.Contains(UnitStats.TerrainAir))
                            {
                                if (ActiveSquad.CurrentWingmanB != null)
                                {
                                    if (ActiveSquad.CurrentWingmanB.ListTerrainChoices.Contains(UnitStats.TerrainAir))
                                    {
                                        AddChoiceToCurrentPanel(new ActionPanelFly(Map, ActiveSquad));
                                    }
                                }
                                else
                                {
                                    AddChoiceToCurrentPanel(new ActionPanelFly(Map, ActiveSquad));
                                }
                            }
                        }
                        else
                        {
                            AddChoiceToCurrentPanel(new ActionPanelFly(Map, ActiveSquad));
                        }
                    }
                }

                if (ActiveSquad.CurrentLeader.ListTerrainChoices.Contains(UnitStats.TerrainUnderground) &&
                    ActiveSquad.CurrentMovement != UnitStats.TerrainUnderground &&
                    Map.GetTerrainType(ActiveSquad.X, ActiveSquad.Y, (int)ActiveSquad.Position.Z) == UnitStats.TerrainLand)
                {
                    AddChoiceToCurrentPanel(new ActionPanelDig(Map, ActiveSquad));
                }

                CheckForMapSwitch();

                new ActionPanelRepair(Map, this, ActiveSquad).OnSelect();
                new ActionPanelResupply(Map, this, ActiveSquad).OnSelect();
            }
        }
Esempio n. 6
0
 public override void DoRead(ByteReader BR)
 {
     ActionMenuCursor = 0;
     ListNextChoice.Clear();
 }