Ejemplo n.º 1
0
 public override void EquipUnit(Equipment input)
 {
     if (input is Veteran)
     {
         veteranRule = input as Veteran;
     }
     else if (input is FieldFortification)
     {
         fieldFortification = input as FieldFortification;
     }
     else if (input is UnitLeader)
     {
         champion = input as UnitLeader;
     }
     else if (input is BannerBearer)
     {
         bannerBearer = input as BannerBearer;
     }
     else if (input is Muscicians)
     {
         muscician = input as Muscicians;
     }
     else
     {
         base.EquipUnit(input);
     }
 }
Ejemplo n.º 2
0
 public override void RemoveEquipment(Equipment output)
 {
     if (output is UnitLeader)
     {
         champion = null;
     }
     else if (output is Muscicians)
     {
         muscician = null;
     }
     else if (output is BannerBearer)
     {
         bannerBearer = null;
     }
     else if (output is Veteran)
     {
         veteranRule = new GenericVeteran();
     }
     else
     {
         base.RemoveEquipment(output);
     }
 }
Ejemplo n.º 3
0
        public MarkButtonHandler(Texture2D markButton, Texture2D show, SoundEffect horseSound, SoundEffect clickSound, SoundEffect swordSound, SoundEffect arrowSound, Vector2 screenSize, SpriteFont font, int buttonPosition,
                                 int cutoff, int buttonPos2, int markButtonStartPos)
        {
            this.font       = font;
            this.clickSound = clickSound;
            this.markButton = markButton;
            parchment       = new Parchment(show, screenSize, font);
            buttonsList     = new List <List <EquipmentMarkButton> >();
            string tempname = "";

            numberlist = new List <int>();
            numberlist.Add(0);
            numberlist.Add(0);
            numberlist.Add(0);
            Equipment equipmentinput = new Equipment();
            int       p    = 0;
            int       yoff = 1;

            offsetBetweenButtons = 20;
            startPos             = markButtonStartPos;
            widthBetweenButtons  = 185;
            for (int i = 0; i < 9; i++)
            {
                buttonsList.Add(new List <EquipmentMarkButton>());
            }
            SoundEffect tempSound = swordSound;

            for (int i = 0; i < 10; i++)
            {
                if (i == 0)
                {
                    equipmentinput = new SideArm();
                }
                else if (i == 1)
                {
                    equipmentinput = new Longsword();
                }
                else if (i == 2)
                {
                    equipmentinput = new Warhammer();
                }
                else if (i == 3)
                {
                    equipmentinput = new Shield();
                }
                else if (i == 4)
                {
                    equipmentinput = new DualWieldedWeapon();
                }
                else if (i == 5)
                {
                    equipmentinput = new Polearm();
                }
                else if (i == 6)
                {
                    equipmentinput = new Spear();
                }
                else if (i == 7)
                {
                    equipmentinput = new Pike();
                }
                else if (i == 8)
                {
                    equipmentinput = new Pavise();
                }
                else if (i == 9)
                {
                    equipmentinput = new Lance();
                }
                tempname = equipmentinput.GetName() + "/ " + equipmentinput.Cost() + "pts";
                if (buttonPos2 + (widthBetweenButtons * p) + 20 + (font.MeasureString(tempname).X * 0.75f) > cutoff)
                {
                    p = 0;
                    yoff++;
                }
                buttonsList[0].Add(new EquipmentMarkButton(equipmentinput, markButton, 3, 1, buttonPos2 + (widthBetweenButtons * p), startPos + (offsetBetweenButtons * yoff), tempname, tempSound, 0.5f));
                p++;
            }
            tempSound = clickSound;
            buttonsList[0][0].ChangeState();
            yoff++;
            p = 0;
            yoff++;
            for (int i = 0; i < 7; i++)
            {
                if (i == 0)
                {
                    equipmentinput = new UnArmoured();
                }
                else if (i == 1)
                {
                    equipmentinput = new SparseArmour();
                }
                else if (i == 2)
                {
                    equipmentinput = new CoveringArmour();
                }
                else if (i == 3)
                {
                    equipmentinput = new FullPlateArmour();
                }
                else if (i == 4)
                {
                    tempSound      = horseSound;
                    equipmentinput = new PartialHorseArmour();
                }
                else if (i == 5)
                {
                    tempSound      = horseSound;
                    equipmentinput = new HeavyHorseArmour();
                }
                else if (i == 6)
                {
                    tempSound      = horseSound;
                    equipmentinput = new CoveringPlateHorseArmour();
                }
                tempname = equipmentinput.GetName() + "/ " + equipmentinput.Cost() + "pts";
                if (buttonPos2 + (widthBetweenButtons * p) + 20 + (font.MeasureString(tempname).X * 0.75f) > cutoff)
                {
                    p = 0;
                    yoff++;
                }
                buttonsList[1].Add(new EquipmentMarkButton(equipmentinput, markButton, 3, 1, buttonPos2 + (widthBetweenButtons * p), startPos + (offsetBetweenButtons * yoff), tempname, tempSound, 0.5f));
                p++;
            }
            tempSound = arrowSound;
            buttonsList[1][0].ChangeState();
            yoff += 2;
            p     = 0;
            for (int i = 0; i < 9; i++)
            {
                if (i == 0)
                {
                    equipmentinput = new GoodOldFists();
                }
                else if (i == 1)
                {
                    equipmentinput = new Sling();
                }
                else if (i == 2)
                {
                    equipmentinput = new Shortbow();
                }
                else if (i == 3)
                {
                    equipmentinput = new Longbow();
                }
                else if (i == 4)
                {
                    equipmentinput = new LightCrossbow();
                }
                else if (i == 5)
                {
                    equipmentinput = new HeavyCrossbow();
                }
                else if (i == 6)
                {
                    equipmentinput = new Handgonne();
                }
                else if (i == 7)
                {
                    equipmentinput = new ThrowingWeapon();
                }
                else if (i == 8)
                {
                    equipmentinput = new Pistol();
                }
                tempname = equipmentinput.GetName() + "/ " + equipmentinput.Cost() + "pts";
                tempname = equipmentinput.GetName() + "/ " + equipmentinput.Cost() + "pts";
                if (buttonPos2 + (widthBetweenButtons * p) + 20 + (font.MeasureString(tempname).X * 0.75f) > cutoff)
                {
                    p = 0;
                    yoff++;
                }
                buttonsList[2].Add(new EquipmentMarkButton(equipmentinput, markButton, 3, 1, buttonPos2 + (widthBetweenButtons * p), startPos + (offsetBetweenButtons * yoff), tempname, tempSound, 0.5f));
                p++;
            }
            tempSound = horseSound;
            p         = 0;
            yoff     += 2;
            buttonsList[2][0].ChangeState();
            for (int i = 0; i < 7; i++)
            {
                if (i == 0)
                {
                    equipmentinput = new Feet();
                }
                else if (i == 1)
                {
                    equipmentinput = new Courser();
                }
                else if (i == 2)
                {
                    equipmentinput = new Charger();
                }
                else if (i == 3)
                {
                    equipmentinput = new Flyer();
                }
                else if (i == 4)
                {
                    equipmentinput = new MonsterousMount();
                }
                else if (i == 5)
                {
                    equipmentinput = new LightChariot();
                }
                else if (i == 6)
                {
                    equipmentinput = new HeavyChariot();
                }
                tempname = equipmentinput.GetName() + "/ " + equipmentinput.Cost() + "pts";
                if (buttonPos2 + (widthBetweenButtons * p) + 20 + (font.MeasureString(tempname).X * 0.75f) > cutoff)
                {
                    p = 0;
                    yoff++;
                }
                buttonsList[3].Add(new EquipmentMarkButton(equipmentinput, markButton, 3, 1, buttonPos2 + (widthBetweenButtons * p), startPos + (offsetBetweenButtons * yoff), tempname, tempSound, 0.5f));
                p++;
            }
            buttonsList[3][0].ChangeState();
            p     = 0;
            yoff += 2;
            int posVeteran = yoff;

            tempSound = clickSound;
            for (int i = 0; i < 12; i++)
            {
                if (i == 0)
                {
                    equipmentinput = new GenericVeteran();
                }
                else if (i == 1)
                {
                    equipmentinput = new Skirmishers();
                }
                else if (i == 2)
                {
                    equipmentinput = new Rangers();
                }
                else if (i == 3)
                {
                    equipmentinput = new Commandos();
                }
                else if (i == 4)
                {
                    equipmentinput = new Zombify();
                }
                else if (i == 5)
                {
                    equipmentinput = new Possessed();
                }
                else if (i == 6)
                {
                    equipmentinput = new Fire_Arrows();
                }
                else if (i == 7)
                {
                    equipmentinput = new Winged();
                }
                else if (i == 8)
                {
                    equipmentinput = new Reckless();
                }
                else if (i == 9)
                {
                    equipmentinput = new MagicallyCharged();
                }
                else if (i == 10)
                {
                    equipmentinput = new Diciples();
                }
                else if (i == 11)
                {
                    equipmentinput = new SavageFighters();
                }
                tempname = equipmentinput.GetName() + "/ " + equipmentinput.Cost() + "pts";
                if (buttonPos2 + (widthBetweenButtons * p) + 20 + (font.MeasureString(tempname).X * 0.75f) > cutoff)
                {
                    p = 0;
                    yoff++;
                }
                buttonsList[4].Add(new EquipmentMarkButton(equipmentinput, markButton, 3, 1, buttonPos2 + (widthBetweenButtons * p), startPos + (offsetBetweenButtons * yoff), tempname, tempSound, 0.5f));
                p++;
            }
            buttonsList[4][0].ChangeState();
            yoff += 2;
            p     = 0;
            for (int i = 0; i < 4; i++)
            {
                if (i == 0)
                {
                    equipmentinput = new NoFortifications();
                }
                else if (i == 1)
                {
                    equipmentinput = new SharpenedStakes();
                }
                else if (i == 2)
                {
                    equipmentinput = new WarWagon();
                }
                else if (i == 3)
                {
                    equipmentinput = new Mantles();
                }
                tempname = equipmentinput.GetName() + "/ " + equipmentinput.Cost() + "pts";
                if (buttonPos2 + (widthBetweenButtons * p) + 20 + (font.MeasureString(tempname).X * 0.75f) > cutoff)
                {
                    p = 0;
                    yoff++;
                }
                buttonsList[5].Add(new EquipmentMarkButton(equipmentinput, markButton, 3, 1, buttonPos2 + (widthBetweenButtons * p), startPos + (offsetBetweenButtons * yoff), tempname, tempSound, 0.5f));
                p++;
            }
            numberOfLines = yoff + 2;
            buttonsList[5][0].ChangeState();
            p    = 0;
            yoff = posVeteran;
            for (int i = 0; i < 7; i++)
            {
                if (i == 0)
                {
                    equipmentinput = new NoArtillery();
                }
                else if (i == 1)
                {
                    equipmentinput = new Balista();
                }
                else if (i == 2)
                {
                    equipmentinput = new LightCatapult();
                }
                else if (i == 3)
                {
                    equipmentinput = new HeavyCatapult();
                }
                else if (i == 4)
                {
                    equipmentinput = new Cannon();
                }
                else if (i == 5)
                {
                    equipmentinput = new RibaultGun();
                }
                else if (i == 6)
                {
                    equipmentinput = new FlameThrower();
                }
                tempname = equipmentinput.GetName() + "/ " + equipmentinput.Cost() + "pts";
                if (buttonPos2 + (widthBetweenButtons * p) + 20 + (font.MeasureString(tempname).X * 0.75f) > cutoff)
                {
                    p = 0;
                    yoff++;
                }
                buttonsList[6].Add(new EquipmentMarkButton(equipmentinput, markButton, 3, 1, buttonPos2 + (widthBetweenButtons * p), startPos + (offsetBetweenButtons * yoff), tempname, tempSound, 0.5f));
                p++;
            }
            yoff = posVeteran;
            p    = 0;
            for (int i = 0; i < 9; i++)
            {
                if (i == 0)
                {
                    equipmentinput = new GenericHero();
                }
                else if (i == 1)
                {
                    equipmentinput = new GreatWarrior();
                }
                else if (i == 2)
                {
                    equipmentinput = new EagleEyed();
                }
                else if (i == 3)
                {
                    equipmentinput = new InspiringLeader();
                }
                else if (i == 4)
                {
                    equipmentinput = new TrueHero();
                }
                else if (i == 5)
                {
                    equipmentinput = new Conjurer();
                }
                else if (i == 6)
                {
                    equipmentinput = new Enchanter();
                }
                else if (i == 7)
                {
                    equipmentinput = new ArmyStandard();
                }
                else if (i == 8)
                {
                    equipmentinput = new Dragonslayer();
                }
                tempname = equipmentinput.GetName() + "/ " + equipmentinput.Cost() + "pts";
                if (buttonPos2 + (widthBetweenButtons * p) + 20 + (font.MeasureString(tempname).X * 0.75f) > cutoff)
                {
                    p = 0;
                    yoff++;
                }
                buttonsList[7].Add(new EquipmentMarkButton(equipmentinput, markButton, 3, 1, buttonPos2 + (widthBetweenButtons * p), startPos + (offsetBetweenButtons * yoff), tempname, tempSound, 0.5f));
                p++;
            }
            buttonsList[7][0].ChangeState();
            buttonsList[6][0].ChangeState();
            for (int i = 0; i < 3; i++)
            {
                if (i == 0)
                {
                    equipmentinput = new UnitLeader();
                }
                else if (i == 1)
                {
                    equipmentinput = new Muscicians();
                }
                else if (i == 2)
                {
                    equipmentinput = new BannerBearer();
                }
                else if (i == 3)
                {
                    equipmentinput = new BannerBearer();
                }
                tempname = equipmentinput.GetName() + "/ " + equipmentinput.Cost() + "pts";
                buttonsList[8].Add(new EquipmentMarkButton(equipmentinput, markButton, 3, 1, 120 + (170 * i), buttonPosition - 30, tempname, tempSound));
            }
        }