Exemplo n.º 1
0
        private void EditInventoryItem(IInventoryItem item)
        {
            if (item is Weapon)
            {
                Weapon           weapon  = (Weapon)item;
                EditWeaponWindow window1 = new EditWeaponWindow(player, weapon, true);

                if (window1.ShowDialog(this))
                {
                    weapon.CopyValues(window1.Weapon);
                    player.WeaponBonuses[weapon] = new WeaponBonusValue(window1.ToHitAdjustments, window1.DamageAdjustments);
                }
            }
            else if (item is Armor)
            {
                Armor           armor   = (Armor)item;
                EditArmorWindow window2 = new EditArmorWindow(armor);

                if (window2.ShowDialog(this))
                {
                    armor.CopyValues(window2.Armor);
                }
            }
            else if (item is Shield)
            {
                Shield           shield  = (Shield)item;
                EditShieldWindow window3 = new EditShieldWindow(shield);

                if (window3.ShowDialog(this))
                {
                    shield.CopyValues(window3.Shield);
                }
            }
        }
        private void btnWeapon_Click(object sender, RoutedEventArgs e)
        {
            EditWeaponWindow window = new EditWeaponWindow(player, weaponSpec.Weapon, false);

            if (window.ShowDialog(this))
            {
                weaponSpec.Weapon.CopyValues(window.Weapon);
                player.WeaponBonuses[weaponSpec.Weapon].CopyValues(window.ToHitAdjustments, window.DamageAdjustments);
            }
        }
Exemplo n.º 3
0
        private void btnInvRangedWeapon_Click(object sender, RoutedEventArgs e)
        {
            if (player.RangedWeapon == null)
            {
                return;
            }

            EditWeaponWindow window = new EditWeaponWindow(player, player.RangedWeapon, false);

            if (window.ShowDialog(this))
            {
                player.RangedWeapon.CopyValues(window.Weapon);
                player.WeaponBonuses[player.RangedWeapon].CopyValues(window.ToHitAdjustments, window.DamageAdjustments);
                BindingOperations.GetMultiBindingExpression(txtRangedWeaponSpec, TextBlock.TextProperty).UpdateTarget();
            }
        }