コード例 #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);
                }
            }
        }
コード例 #2
0
        private void btnInvShield_Click(object sender, RoutedEventArgs e)
        {
            if (player.Shield == null)
            {
                return;
            }

            EditShieldWindow window = new EditShieldWindow(player.Shield);

            if (window.ShowDialog(this))
            {
                player.Shield.CopyValues(window.Shield);
            }
        }