Esempio n. 1
0
 private void Reset()
 {
     DamageTypeSelectorViewModel1.SetFromDamageDescriptorSet(new Model.DamageDescriptorSet());
     DamageTypeSelectorViewModel2.SetFromDamageDescriptorSet(new Model.DamageDescriptorSet());
     DamageTypeSelectorViewModel3.SetFromDamageDescriptorSet(new Model.DamageDescriptorSet());
     AbilityDamage = false;
 }
Esempio n. 2
0
 public Model.Weapon GetWeapon()
 {
     Model.Weapon weapon = new Model.Weapon();
     weapon.Name = WeaponName;
     weapon.DamageDescriptorSets.Add(DamageTypeSelectorViewModel1.GetDamageDescriptorSet());
     weapon.DamageDescriptorSets.Add(DamageTypeSelectorViewModel2.GetDamageDescriptorSet());
     weapon.DamageDescriptorSets.Add(DamageTypeSelectorViewModel3.GetDamageDescriptorSet());
     weapon.AbilityDamage = AbilityDamage;
     if (AbilityDamage)
     {
         weapon.Ability            = Ability;
         weapon.AbilityDamageValue = Convert.ToInt32(AbilityDamageValue);
     }
     return(weapon);
 }
        public Model.Weapon GetWeapon()
        {
            bool   askForInput = true;
            string feedback    = null;

            Model.Weapon weapon = null;
            while (askForInput)
            {
                View.AddWeaponWindow addWeaponWindow = new View.AddWeaponWindow(feedback);
                addWeaponWindow.DataContext = this;

                if (addWeaponWindow.ShowDialog() == true)
                {
                    try
                    {
                        weapon = new Model.Weapon
                        {
                            Name               = Name,
                            AbilityDamage      = AbilityDamage,
                            AbilityDamageValue = Convert.ToInt32(AbilityDamageValue),
                            Ability            = Ability
                        };

                        weapon.DamageDescriptorSets.Add(DamageTypeSelectorViewModel1.GetDamageDescriptorSet());
                        weapon.DamageDescriptorSets.Add(DamageTypeSelectorViewModel2.GetDamageDescriptorSet());
                        weapon.DamageDescriptorSets.Add(DamageTypeSelectorViewModel3.GetDamageDescriptorSet());
                        askForInput = false;
                    }
                    catch (FormatException)
                    {
                        feedback = "Invalid format";
                    }
                }
                else
                {
                    askForInput = false;
                }
            }

            return(weapon);
        }