private void bSave_Click(object sender, EventArgs e)
        {
            ClassOverview owner = Owner as ClassOverview;

            SoldierClassExperience experience = new SoldierClassExperience();

            experience.numberInForcedDeck = Utils.parseStringToInt(tNumberInForcedDeck.Text);
            experience.numberInDeck       = Utils.parseStringToInt(tNumberInDeck.Text);
            experience.killAssistsPerKill = Utils.parseStringToInt(tKillAssistsPerKill.Text);

            ValidationResult allowUpdate = experience.allowUpdate();

            if (!allowUpdate.valid)
            {
                MessageBox.Show(allowUpdate.message, "Cannot save", MessageBoxButtons.OK);
                return;
            }

            SavedSoldiersManager manager = new SavedSoldiersManager();

            manager.updateClassElement(formerInternalName, experience, Constants.XML_EXPERIENCE);

            owner.updateSoldiers();
            owner.selectSoldier(formerInternalName);

            Close();
        }
Example #2
0
        private void bSave_Click(object sender, EventArgs e)
        {
            ClassOverview owner = Owner as ClassOverview;

            SoldierClassMetadata metadata = new SoldierClassMetadata();
            metadata.internalName = tInternalName.Text;
            metadata.displayName = tDisplayName.Text;
            metadata.description = tDescription.Text;
            metadata.iconString = tIconString.Text;

            ValidationResult allowUpdate = metadata.allowUpdate();
            if(!allowUpdate.valid)
            {
                MessageBox.Show(allowUpdate.message, "Cannot save", MessageBoxButtons.OK);
                return;
            }

            SavedSoldiersManager manager = new SavedSoldiersManager();
            manager.saveMetadata(formerInternalName, metadata);
            
            owner.updateSoldiers();
            owner.selectSoldier(metadata.internalName);
            
            Close();
        }
        private void bSave_Click(object sender, EventArgs e)
        {
            ClassOverview owner = Owner as ClassOverview;

            SoldierClassEquipment equipment = new SoldierClassEquipment();

            equipment.squaddieLoadout = tSquaddieLoadout.Text;
            equipment.allowedArmors   = tAllowedArmors.Text;
            equipment.weapons         = weapons.ToList();

            ValidationResult allowUpdate = equipment.allowUpdate();

            if (!allowUpdate.valid)
            {
                MessageBox.Show(allowUpdate.message, "Cannot save", MessageBoxButtons.OK);
                return;
            }

            SavedSoldiersManager manager = new SavedSoldiersManager();

            manager.saveEquipment(formerInternalName, equipment);

            owner.updateSoldiers();
            owner.selectSoldier(formerInternalName);

            Close();
        }
Example #4
0
        private void bSave_Click(object sender, EventArgs e)
        {
            ClassOverview owner = Owner as ClassOverview;

            List <SoldierClassStat> soldierStats = new List <SoldierClassStat>();

            soldierStats.Add(buildSoldierStatFromControl(tSquaddieHp, SoldierRank.Squaddie, Stat.HP));
            soldierStats.Add(buildSoldierStatFromControl(tCorporalHp, SoldierRank.Corporal, Stat.HP));
            soldierStats.Add(buildSoldierStatFromControl(tSergeantHp, SoldierRank.Sergeant, Stat.HP));
            soldierStats.Add(buildSoldierStatFromControl(tLieutenantHp, SoldierRank.Lieutenant, Stat.HP));
            soldierStats.Add(buildSoldierStatFromControl(tCaptainHp, SoldierRank.Captain, Stat.HP));
            soldierStats.Add(buildSoldierStatFromControl(tMajorHp, SoldierRank.Major, Stat.HP));
            soldierStats.Add(buildSoldierStatFromControl(tColonelHp, SoldierRank.Colonel, Stat.HP));
            soldierStats.Add(buildSoldierStatFromControl(tBrigadierHp, SoldierRank.Brigadier, Stat.HP));

            soldierStats.Add(buildSoldierStatFromControl(tSquaddieAim, SoldierRank.Squaddie, Stat.Aim));
            soldierStats.Add(buildSoldierStatFromControl(tCorporalAim, SoldierRank.Corporal, Stat.Aim));
            soldierStats.Add(buildSoldierStatFromControl(tSergeantAim, SoldierRank.Sergeant, Stat.Aim));
            soldierStats.Add(buildSoldierStatFromControl(tLieutenantAim, SoldierRank.Lieutenant, Stat.Aim));
            soldierStats.Add(buildSoldierStatFromControl(tCaptainAim, SoldierRank.Captain, Stat.Aim));
            soldierStats.Add(buildSoldierStatFromControl(tMajorAim, SoldierRank.Major, Stat.Aim));
            soldierStats.Add(buildSoldierStatFromControl(tColonelAim, SoldierRank.Colonel, Stat.Aim));
            soldierStats.Add(buildSoldierStatFromControl(tBrigadierAim, SoldierRank.Brigadier, Stat.Aim));

            soldierStats.Add(buildSoldierStatFromControl(tSquaddieStrength, SoldierRank.Squaddie, Stat.Strength));
            soldierStats.Add(buildSoldierStatFromControl(tCorporalStrength, SoldierRank.Corporal, Stat.Strength));
            soldierStats.Add(buildSoldierStatFromControl(tSergeantStrength, SoldierRank.Sergeant, Stat.Strength));
            soldierStats.Add(buildSoldierStatFromControl(tLieutenantStrength, SoldierRank.Lieutenant, Stat.Strength));
            soldierStats.Add(buildSoldierStatFromControl(tCaptainStrength, SoldierRank.Captain, Stat.Strength));
            soldierStats.Add(buildSoldierStatFromControl(tMajorStrength, SoldierRank.Major, Stat.Strength));
            soldierStats.Add(buildSoldierStatFromControl(tColonelStrength, SoldierRank.Colonel, Stat.Strength));
            soldierStats.Add(buildSoldierStatFromControl(tBrigadierStrength, SoldierRank.Brigadier, Stat.Strength));

            soldierStats.Add(buildSoldierStatFromControl(tSquaddieHacking, SoldierRank.Squaddie, Stat.Hacking));
            soldierStats.Add(buildSoldierStatFromControl(tCorporalHacking, SoldierRank.Corporal, Stat.Hacking));
            soldierStats.Add(buildSoldierStatFromControl(tSergeantHacking, SoldierRank.Sergeant, Stat.Hacking));
            soldierStats.Add(buildSoldierStatFromControl(tLieutenantHacking, SoldierRank.Lieutenant, Stat.Hacking));
            soldierStats.Add(buildSoldierStatFromControl(tCaptainHacking, SoldierRank.Captain, Stat.Hacking));
            soldierStats.Add(buildSoldierStatFromControl(tMajorHacking, SoldierRank.Major, Stat.Hacking));
            soldierStats.Add(buildSoldierStatFromControl(tColonelHacking, SoldierRank.Colonel, Stat.Hacking));
            soldierStats.Add(buildSoldierStatFromControl(tBrigadierHacking, SoldierRank.Brigadier, Stat.Hacking));

            soldierStats.Add(buildSoldierStatFromControl(tSquaddiePsi, SoldierRank.Squaddie, Stat.Psi));
            soldierStats.Add(buildSoldierStatFromControl(tCorporalPsi, SoldierRank.Corporal, Stat.Psi));
            soldierStats.Add(buildSoldierStatFromControl(tSergeantPsi, SoldierRank.Sergeant, Stat.Psi));
            soldierStats.Add(buildSoldierStatFromControl(tLieutenantPsi, SoldierRank.Lieutenant, Stat.Psi));
            soldierStats.Add(buildSoldierStatFromControl(tCaptainPsi, SoldierRank.Captain, Stat.Psi));
            soldierStats.Add(buildSoldierStatFromControl(tMajorPsi, SoldierRank.Major, Stat.Psi));
            soldierStats.Add(buildSoldierStatFromControl(tColonelPsi, SoldierRank.Colonel, Stat.Psi));
            soldierStats.Add(buildSoldierStatFromControl(tBrigadierPsi, SoldierRank.Brigadier, Stat.Psi));

            SavedSoldiersManager manager = new SavedSoldiersManager();

            manager.updateStatsElement(formerInternalName, soldierStats);

            owner.updateSoldiers();
            owner.selectSoldier(formerInternalName);

            Close();
        }
        private void ExperienceManager_Load(object sender, EventArgs e)
        {
            ClassOverview owner = Owner as ClassOverview;

            tNumberInForcedDeck.Text = owner.currentSoldier.experience.numberInForcedDeck.ToString();
            tNumberInDeck.Text       = owner.currentSoldier.experience.numberInDeck.ToString();
            tKillAssistsPerKill.Text = owner.currentSoldier.experience.killAssistsPerKill.ToString();

            formerInternalName = owner.currentSoldier.metadata.internalName;
        }
Example #6
0
        private void bSave_Click(object sender, EventArgs e)
        {
            ClassOverview owner = Owner as ClassOverview;

            List <SoldierClassAbility> soldierAbilities = new List <SoldierClassAbility>();

            soldierAbilities.Add(buildSoldierAbilityFromCombo(cSquaddie1, SoldierRank.Squaddie, 1));
            soldierAbilities.Add(buildSoldierAbilityFromCombo(cSquaddie2, SoldierRank.Squaddie, 2));
            soldierAbilities.Add(buildSoldierAbilityFromCombo(cSquaddie3, SoldierRank.Squaddie, 3));
            soldierAbilities.Add(buildSoldierAbilityFromCombo(cSquaddie4, SoldierRank.Squaddie, 4));
            soldierAbilities.Add(buildSoldierAbilityFromCombo(cSquaddie5, SoldierRank.Squaddie, 5));
            soldierAbilities.Add(buildSoldierAbilityFromCombo(cSquaddie6, SoldierRank.Squaddie, 6));

            soldierAbilities.Add(buildSoldierAbilityFromCombo(cCorporal1, SoldierRank.Corporal, 1));
            soldierAbilities.Add(buildSoldierAbilityFromCombo(cCorporal2, SoldierRank.Corporal, 2));
            soldierAbilities.Add(buildSoldierAbilityFromCombo(cCorporal3, SoldierRank.Corporal, 3));

            soldierAbilities.Add(buildSoldierAbilityFromCombo(cSergeant1, SoldierRank.Sergeant, 1));
            soldierAbilities.Add(buildSoldierAbilityFromCombo(cSergeant2, SoldierRank.Sergeant, 2));
            soldierAbilities.Add(buildSoldierAbilityFromCombo(cSergeant3, SoldierRank.Sergeant, 3));

            soldierAbilities.Add(buildSoldierAbilityFromCombo(cLieutenant1, SoldierRank.Lieutenant, 1));
            soldierAbilities.Add(buildSoldierAbilityFromCombo(cLieutenant2, SoldierRank.Lieutenant, 2));
            soldierAbilities.Add(buildSoldierAbilityFromCombo(cLieutenant3, SoldierRank.Lieutenant, 3));

            soldierAbilities.Add(buildSoldierAbilityFromCombo(cCaptain1, SoldierRank.Captain, 1));
            soldierAbilities.Add(buildSoldierAbilityFromCombo(cCaptain2, SoldierRank.Captain, 2));
            soldierAbilities.Add(buildSoldierAbilityFromCombo(cCaptain3, SoldierRank.Captain, 3));

            soldierAbilities.Add(buildSoldierAbilityFromCombo(cMajor1, SoldierRank.Major, 1));
            soldierAbilities.Add(buildSoldierAbilityFromCombo(cMajor2, SoldierRank.Major, 2));
            soldierAbilities.Add(buildSoldierAbilityFromCombo(cMajor3, SoldierRank.Major, 3));

            soldierAbilities.Add(buildSoldierAbilityFromCombo(cColonel1, SoldierRank.Colonel, 1));
            soldierAbilities.Add(buildSoldierAbilityFromCombo(cColonel2, SoldierRank.Colonel, 2));
            soldierAbilities.Add(buildSoldierAbilityFromCombo(cColonel3, SoldierRank.Colonel, 3));

            soldierAbilities.Add(buildSoldierAbilityFromCombo(cBrigadier1, SoldierRank.Brigadier, 1));
            soldierAbilities.Add(buildSoldierAbilityFromCombo(cBrigadier2, SoldierRank.Brigadier, 2));
            soldierAbilities.Add(buildSoldierAbilityFromCombo(cBrigadier3, SoldierRank.Brigadier, 3));

            SavedSoldiersManager manager = new SavedSoldiersManager();

            //manager.updateAbilitiesElement(formerInternalName, soldierAbilities);
            manager.saveAbilities(formerInternalName, soldierAbilities);


            owner.updateSoldiers();
            owner.selectSoldier(formerInternalName);

            Close();
        }
Example #7
0
        private Ability getAbility(string abilityInternalName)
        {
            ClassOverview owner = Owner as ClassOverview;

            Ability soldierAbility = owner.abilities.Where(x => x.internalName == abilityInternalName).FirstOrDefault();

            if (soldierAbility == null)
            {
                return(new Ability());
            }

            return(soldierAbility);
        }
Example #8
0
        private Ability getAbilityForCombo(SoldierRank rank, int slot)
        {
            ClassOverview owner = Owner as ClassOverview;

            SoldierClassAbility soldierAbility = owner.currentSoldier.soldierAbilities.Where(x => x.rank == rank && x.slot == slot).FirstOrDefault();

            if (soldierAbility != null)
            {
                return(soldierAbility.getAbility());
            }

            return(new Ability());
        }
Example #9
0
        private void StatManager_Load(object sender, EventArgs e)
        {
            ClassOverview owner = Owner as ClassOverview;

            formerInternalName = owner.currentSoldier.metadata.internalName;

            tSquaddieHp.Text   = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Squaddie && x.stat == Stat.HP).Select(x => x.value.ToString()).FirstOrDefault();
            tCorporalHp.Text   = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Corporal && x.stat == Stat.HP).Select(x => x.value.ToString()).FirstOrDefault();
            tSergeantHp.Text   = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Sergeant && x.stat == Stat.HP).Select(x => x.value.ToString()).FirstOrDefault();
            tLieutenantHp.Text = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Lieutenant && x.stat == Stat.HP).Select(x => x.value.ToString()).FirstOrDefault();
            tCaptainHp.Text    = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Captain && x.stat == Stat.HP).Select(x => x.value.ToString()).FirstOrDefault();
            tMajorHp.Text      = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Major && x.stat == Stat.HP).Select(x => x.value.ToString()).FirstOrDefault();
            tColonelHp.Text    = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Colonel && x.stat == Stat.HP).Select(x => x.value.ToString()).FirstOrDefault();
            tBrigadierHp.Text  = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Brigadier && x.stat == Stat.HP).Select(x => x.value.ToString()).FirstOrDefault();

            tSquaddieAim.Text   = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Squaddie && x.stat == Stat.Aim).Select(x => x.value.ToString()).FirstOrDefault();
            tCorporalAim.Text   = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Corporal && x.stat == Stat.Aim).Select(x => x.value.ToString()).FirstOrDefault();
            tSergeantAim.Text   = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Sergeant && x.stat == Stat.Aim).Select(x => x.value.ToString()).FirstOrDefault();
            tLieutenantAim.Text = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Lieutenant && x.stat == Stat.Aim).Select(x => x.value.ToString()).FirstOrDefault();
            tCaptainAim.Text    = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Captain && x.stat == Stat.Aim).Select(x => x.value.ToString()).FirstOrDefault();
            tMajorAim.Text      = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Major && x.stat == Stat.Aim).Select(x => x.value.ToString()).FirstOrDefault();
            tColonelAim.Text    = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Colonel && x.stat == Stat.Aim).Select(x => x.value.ToString()).FirstOrDefault();
            tBrigadierAim.Text  = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Brigadier && x.stat == Stat.Aim).Select(x => x.value.ToString()).FirstOrDefault();

            tSquaddieStrength.Text   = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Squaddie && x.stat == Stat.Strength).Select(x => x.value.ToString()).FirstOrDefault();
            tCorporalStrength.Text   = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Corporal && x.stat == Stat.Strength).Select(x => x.value.ToString()).FirstOrDefault();
            tSergeantStrength.Text   = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Sergeant && x.stat == Stat.Strength).Select(x => x.value.ToString()).FirstOrDefault();
            tLieutenantStrength.Text = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Lieutenant && x.stat == Stat.Strength).Select(x => x.value.ToString()).FirstOrDefault();
            tCaptainStrength.Text    = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Captain && x.stat == Stat.Strength).Select(x => x.value.ToString()).FirstOrDefault();
            tMajorStrength.Text      = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Major && x.stat == Stat.Strength).Select(x => x.value.ToString()).FirstOrDefault();
            tColonelStrength.Text    = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Colonel && x.stat == Stat.Strength).Select(x => x.value.ToString()).FirstOrDefault();
            tBrigadierStrength.Text  = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Brigadier && x.stat == Stat.Strength).Select(x => x.value.ToString()).FirstOrDefault();

            tSquaddieHacking.Text   = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Squaddie && x.stat == Stat.Hacking).Select(x => x.value.ToString()).FirstOrDefault();
            tCorporalHacking.Text   = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Corporal && x.stat == Stat.Hacking).Select(x => x.value.ToString()).FirstOrDefault();
            tSergeantHacking.Text   = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Sergeant && x.stat == Stat.Hacking).Select(x => x.value.ToString()).FirstOrDefault();
            tLieutenantHacking.Text = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Lieutenant && x.stat == Stat.Hacking).Select(x => x.value.ToString()).FirstOrDefault();
            tCaptainHacking.Text    = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Captain && x.stat == Stat.Hacking).Select(x => x.value.ToString()).FirstOrDefault();
            tMajorHacking.Text      = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Major && x.stat == Stat.Hacking).Select(x => x.value.ToString()).FirstOrDefault();
            tColonelHacking.Text    = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Colonel && x.stat == Stat.Hacking).Select(x => x.value.ToString()).FirstOrDefault();
            tBrigadierHacking.Text  = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Brigadier && x.stat == Stat.Hacking).Select(x => x.value.ToString()).FirstOrDefault();

            tSquaddiePsi.Text   = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Squaddie && x.stat == Stat.Psi).Select(x => x.value.ToString()).FirstOrDefault();
            tCorporalPsi.Text   = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Corporal && x.stat == Stat.Psi).Select(x => x.value.ToString()).FirstOrDefault();
            tSergeantPsi.Text   = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Sergeant && x.stat == Stat.Psi).Select(x => x.value.ToString()).FirstOrDefault();
            tLieutenantPsi.Text = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Lieutenant && x.stat == Stat.Psi).Select(x => x.value.ToString()).FirstOrDefault();
            tCaptainPsi.Text    = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Captain && x.stat == Stat.Psi).Select(x => x.value.ToString()).FirstOrDefault();
            tMajorPsi.Text      = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Major && x.stat == Stat.Psi).Select(x => x.value.ToString()).FirstOrDefault();
            tColonelPsi.Text    = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Colonel && x.stat == Stat.Psi).Select(x => x.value.ToString()).FirstOrDefault();
            tBrigadierPsi.Text  = owner.currentSoldier.stats.Where(x => x.rank == SoldierRank.Brigadier && x.stat == Stat.Psi).Select(x => x.value.ToString()).FirstOrDefault();
        }
Example #10
0
        private void EquipmentManager_Load(object sender, EventArgs e)
        {
            ClassOverview owner = Owner as ClassOverview;

            tSquaddieLoadout.Text = owner.currentSoldier.equipment.squaddieLoadout;
            tAllowedArmors.Text   = owner.currentSoldier.equipment.allowedArmors;

            formerInternalName = owner.currentSoldier.metadata.internalName;

            soldiersWeapons     = owner.currentSoldier.equipment.weapons;
            weapons             = new BindingList <Weapon>(soldiersWeapons);
            lWeapons.DataSource = weapons;

            setControlsInitialState();
        }
Example #11
0
        private void AbilityManager_Load(object sender, EventArgs e)
        {
            ClassOverview owner = Owner as ClassOverview;

            formerInternalName = owner.currentSoldier.metadata.internalName;

            foreach (Control control in Controls)
            {
                ComboBox combo = control as ComboBox;

                if (combo != null)
                {
                    List <Ability> abilitiesCopy = owner.abilities.ToList();
                    abilitiesCopy.Add(new Ability());
                    abilitiesCopy = abilitiesCopy.OrderBy(x => x.internalName).ToList();

                    combo.DataSource = abilitiesCopy;
                }
            }

            setCombos();
        }