public override List <ActionPanel> OnMenuSelect(Squad ActiveSquad, ActionPanelHolder ListActionMenuChoice)
        {
            int NumberOfTransformingUnitsInSquad = 0;

            for (int U = Map.ActiveSquad.UnitsAliveInSquad - 1; U >= 0; --U)
            {
                UnitTransforming ActiveUnit = (UnitTransforming)Map.ActiveSquad[U];
                if (ActiveUnit != null)
                {
                    if (!ActiveUnit.PermanentTransformation)
                    {
                        ++NumberOfTransformingUnitsInSquad;
                    }
                }
            }

            if (NumberOfTransformingUnitsInSquad >= 1)
            {
                return(new List <ActionPanel>()
                {
                    new ActionPanelTransform(Map, ActiveSquad)
                });
            }

            return(new List <ActionPanel>());
        }
        public override void OnSelect()
        {
            int NumberOfTransformingUnitsInSquad = 0;

            for (int U = ActiveSquad.UnitsAliveInSquad - 1; U >= 0; --U)
            {
                if (ActiveSquad[U] is UnitTransforming)
                {
                    ActionMenuSwitchSquadCursor = U;
                    UnitTransforming ActiveUnit = (UnitTransforming)ActiveSquad[U];
                    if (!ActiveUnit.PermanentTransformation)
                    {
                        ++NumberOfTransformingUnitsInSquad;
                    }
                }
            }

            if (NumberOfTransformingUnitsInSquad == 1)
            {
                AddToPanelListAndSelect(new ActionPanelTransform2Wingman((UnitTransforming)ActiveSquad[ActionMenuSwitchSquadCursor], ActiveSquad, false, Map));
            }
            else if (NumberOfTransformingUnitsInSquad >= 2)
            {
                AddToPanelListAndSelect(new ActionPanelTransform2Wingman((UnitTransforming)ActiveSquad[ActionMenuSwitchSquadCursor], ActiveSquad, true, Map));
            }

            RemoveFromPanelList(this);
        }
 public ActionPanelTransform2Wingman(UnitTransforming TransformingUnit, Squad ActiveSquad, bool ShowSquadMembers, DeathmatchMap Map)
     : base("Formation2Wingman", Map)
 {
     this.TransformingUnit = TransformingUnit;
     this.ActiveSquad      = ActiveSquad;
     this.ShowSquadMembers = ShowSquadMembers;
 }
        public override void Draw(CustomSpriteBatch g)
        {
            float X, Y;

            DrawNextChoice(g);
            UnitTransforming TempUnit = (UnitTransforming)ActiveSquad[SelectedUnitIndex];

            X = (Map.CursorPosition.X + 1 - Map.CameraPosition.X) * Map.TileSize.X;
            Y = (Map.CursorPosition.Y - Map.CameraPosition.Y) * Map.TileSize.Y;

            if (X + MinActionMenuWidth + MinActionMenuWidth >= Constants.Width)
            {
                X = Constants.Width - MinActionMenuWidth - MinActionMenuWidth;
            }

            for (int U = 0; U < ActiveSquad.UnitsAliveInSquad; ++U)
            {
                GameScreen.DrawBox(g, new Vector2(X + MinActionMenuWidth, Y + U * PannelHeight), MinActionMenuWidth, PannelHeight, Color.White);
                if (!(ActiveSquad[U] is UnitTransforming) ||
                    ((UnitTransforming)ActiveSquad[SelectedUnitIndex]).PermanentTransformation)
                {
                    GameScreen.DrawText(g, ActiveSquad[U].FullName, new Vector2(X + MinActionMenuWidth, Y + U * PannelHeight), Color.Gray);
                }
                else
                {
                    GameScreen.DrawText(g, ActiveSquad[U].FullName, new Vector2(X + MinActionMenuWidth, Y + U * PannelHeight), Color.White);
                }
            }
            g.Draw(GameScreen.sprPixel, new Rectangle((int)X + MinActionMenuWidth, (int)Y + SelectedUnitIndex * PannelHeight, 50, 20), Color.FromNonPremultiplied(255, 255, 255, 128));
        }
 public ActionPanelTranform2WingmanTurn(int TransformationChoice, UnitTransforming TransformingUnit, Squad ActiveSquad, bool ShowSquadMembers, DeathmatchMap Map)
     : base("Transform2Turn", Map)
 {
     this.TransformingUnit     = TransformingUnit;
     this.TransformationChoice = TransformationChoice;
     this.ActiveSquad          = ActiveSquad;
     this.ShowSquadMembers     = ShowSquadMembers;
 }
 public override void DoRead(ByteReader BR)
 {
     ActivePlayerIndex     = BR.ReadInt32();
     TransformingUnitIndex = BR.ReadInt32();
     ActiveSquad           = Map.ListPlayer[ActivePlayerIndex].ListSquad[BR.ReadInt32()];
     ShowSquadMembers      = BR.ReadBoolean();
     TransformingUnit      = (UnitTransforming)ActiveSquad[TransformingUnitIndex];
 }
        public ActionPanelConfirmTransform(UnitTransforming TransformingUnit, int TransformationChoice, Squad ActiveSquad, DeathmatchMap Map, bool CanTransform)
            : base(TransformingUnit.ArrayTransformingUnit[TransformationChoice].UnitTransformed.ItemName, Map)
        {
            this.TransformingUnit     = TransformingUnit;
            this.TransformationChoice = TransformationChoice;
            this.ActiveSquad          = ActiveSquad;

            IsEnabled = CanTransform;
        }
 public ActionPanelTransform2Wingman(DeathmatchMap Map, int ActivePlayerIndex, int TransformingUnitIndex, Squad ActiveSquad, bool ShowSquadMembers)
     : base(PanelName, Map)
 {
     this.ActivePlayerIndex     = ActivePlayerIndex;
     this.TransformingUnitIndex = TransformingUnitIndex;
     this.ActiveSquad           = ActiveSquad;
     this.ShowSquadMembers      = ShowSquadMembers;
     TransformingUnit           = (UnitTransforming)ActiveSquad[TransformingUnitIndex];
 }
        public override void ReinitializeMembers(Unit InitializedUnitBase)
        {
            UnitTransforming Other = (UnitTransforming)InitializedUnitBase;

            Map = Other.Map;
        }