private void AddNewCombatant(object sender, ExecutedRoutedEventArgs e)
        {
            Combatant newCombatant = new Combatant(textBlock15.Text, "", textBlock21.Text, textBlock22.Text,
                    textBlock19.Text, textBlock20.Text, textBlock21.Text, textBlock22.Text, textBlock23.Text,
                    textBlock26.Text, textBlock27.Text, textBlock28.Text, textBox1.Text, textBox2.Text, (bool)isNPC.IsChecked);

            if (combatant == null)
            {
                CommAddCombatant addComm = new CommAddCombatant(combatants, newCombatant);
                addComm.Execute();
            }
            else
            {
                int index = combatants.IndexOf(combatant);

                CommRemoveCombatant commRmv = new CommRemoveCombatant(combatants, combatant);
                commRmv.Execute();
                CommAddCombatant addComm = new CommAddCombatant(combatants, newCombatant);
                addComm.Execute();
                CommRepositionCombatant commRepos = new CommRepositionCombatant(combatants, newCombatant, index - combatants.Count);
                commRepos.Execute();
            }

            this.Close();
        }
Пример #2
0
        public static void combatTableFromJsonFile(CombatTable paramAdventure, string jsonFile)
        {
            JArray adventureJson = JArray.Parse(jsonFile);

            //Every Combatant
             foreach (JObject combatantJson in adventureJson.Children())
             {
                 CommAddCombatant commAdd = new CommAddCombatant(paramAdventure, combatantFromJsonObject(combatantJson));
                 commAdd.Execute();
             }
        }
Пример #3
0
        private void cloneSelectedCombatant_Click(object sender, RoutedEventArgs e)
        {
            Combatant selectedCombatant = getSelectedCombatant();
            if (selectedCombatant == null)
                return;

            Combatant clone = selectedCombatant.Clone();
            CommAddCombatant commAdd = new CommAddCombatant(listi, clone);
            commAdd.Execute();
        }