示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EquipmentViewModel"/> class.
        /// </summary>
        /// <param name="warriorViewModel">The warrior view model.</param>
        /// <exception cref="ArgumentNullException">WarriorViewModel is null</exception>
        public EquipmentViewModel(WarriorViewModel warriorViewModel)
        {
            if (warriorViewModel == null)
            {
                throw new ArgumentNullException("WarriorViewModel is null");
            }
            WarriorViewModel = warriorViewModel;
            Warrior          = warriorViewModel.Warrior;
            SetEquipment();

            RemoveEquipmentCommand = new RemoveEquipment(this);
            SelectEquipmentCommand = new SelectEquipment(this);

            foreach (IEquipment equipment in Warrior.AllowedEquipment)
            {
                if (equipment is ICloseCombatWeapon)
                {
                    Weapons.Add(new CloseCombatWeaponViewModel(equipment as ICloseCombatWeapon));
                }
                if (equipment is IMisseleWeapon)
                {
                    MissileWeapons.Add(new MissileWeaponViewModel(equipment as IMisseleWeapon));
                }
                if (equipment is IArmour)
                {
                    Armour.Add(new ArmorViewModel(equipment as IArmour));
                }
            }
            Warrior.PropertiesChanged += Warrior_PropertiesChanged;
        }
        public WarriorPlayView(IWarrior warrior) : this()
        {
            _ViewModel              = new WarriorViewModel(warrior);
            this.DataContext        = _ViewModel;
            _StatisticsView.Warrior = _ViewModel.Warrior;
            _ExpierenceView.BuildRoster(_ViewModel.Warrior);

            _AfflictionsView.ViewModel = new AfflictionsViewModel(_ViewModel.Warrior.Afflictions);
            _ViewModel.ExperienceList  = _ExpierenceView.ExperienceList;
        }
示例#3
0
 public WarriorView(IWarrior warrior) : this()
 {
     ViewModel = new WarriorViewModel(warrior);
 }