public static void SaveGame(Player player, string path) { Stream stream = File.Open(path, FileMode.Create); BinaryFormatter formatter = new BinaryFormatter(); formatter.Serialize(stream, player); stream.Close(); }
public Battle(Player currentplayer) { player = currentplayer; monster = new Monster(Combat.ChooseMonster(player.Level)); player.ResetTimers(); monster.ResetTimers(); player.Target = monster; monster.Target = player; }
public static Player StartGame(string name) { List<Item> inventory = new List<Item>(); inventory.Add(ItemGenerator.CreateItem(7)); Weapon weapon = new Weapon(); Armour headArmour = new Armour(ArmourLocation.Head); Armour torsoArmour = new Armour(ArmourLocation.Torso); Armour handArmour = new Armour(ArmourLocation.Hands); Armour legArmour = new Armour(ArmourLocation.Legs); Armour feetArmour = new Armour(ArmourLocation.Feet); Player player = new Player(name, 10, 1, 100, 0, 80, 3, 7, 1001, inventory, weapon, headArmour, torsoArmour, handArmour, legArmour, feetArmour); GameInProgress = true; return player; }
public Inventory(Logic.Player player) { InitializeComponent(); this.player = player; this.attackDefenseInfo.Player = player; this.equippedItems = new Dictionary <EquipmentSlot, InventoryEntry>() { { EquipmentSlot.RightHand, mainHandEquipment }, { EquipmentSlot.LeftHand, offHandEquipment }, { EquipmentSlot.Head, headEquipment }, { EquipmentSlot.Torso, torsoEquipment }, { EquipmentSlot.Hands, handEquipment }, { EquipmentSlot.Legs, legEquipment }, { EquipmentSlot.Feet, feetEquipment }, }; this.offHandEquipment.ImageFlipped = true; this.inventoryToDisplay = new List <Logic.Item>(); this.inventoryEntries = new List <InventoryEntry>(); this.characterImage.Image = SimpleGame.Properties.Resources.none_selected; headLocation = new Rectangle(26, 0, 28, 32); torsoLocation1 = new Rectangle(0, 32, 80, 65); torsoLocation2 = new Rectangle(24, 97, 32, 2); torsoLocation3 = new Rectangle(34, 99, 12, 2); torsoLocation4 = new Rectangle(2, 97, 12, 2); torsoLocation5 = new Rectangle(66, 97, 12, 2); legsLocation1 = new Rectangle(16, 97, 48, 53); legsLocation2 = new Rectangle(14, 150, 52, 37); handsLocation = new Rectangle(0, 99, 80, 17); feetLocation = new Rectangle(4, 187, 72, 23); this.deselectAllEquipment(); this.attackDefenseInfo.UpdateLabels(); this.updateEquipmentIcons(); this.inventoryFilterBox.SelectedValueChanged += new EventHandler(displayInventory); this.inventorySubFilter.SelectedValueChanged += new EventHandler(displayInventory); this.player.Equipment.LoadoutChanged += new Logic.Equipment.LoadoutChangedEventHandler(Equipment_LoadoutChanged); this.inventoryFilterBox.SelectedIndex = 0; this.inventorySubFilter.SelectedIndex = 0; }
public Inventory(Logic.Player player) { InitializeComponent(); this.player = player; this.attackDefenseInfo.Player = player; this.equippedItems = new Dictionary<EquipmentSlot, InventoryEntry>() { { EquipmentSlot.RightHand, mainHandEquipment }, { EquipmentSlot.LeftHand, offHandEquipment }, { EquipmentSlot.Head, headEquipment }, { EquipmentSlot.Torso, torsoEquipment }, { EquipmentSlot.Hands, handEquipment }, { EquipmentSlot.Legs, legEquipment }, { EquipmentSlot.Feet, feetEquipment }, }; this.offHandEquipment.ImageFlipped = true; this.inventoryToDisplay = new List<Logic.Item>(); this.inventoryEntries = new List<InventoryEntry>(); this.characterImage.Image = SimpleGame.Properties.Resources.none_selected; headLocation = new Rectangle(26, 0, 28, 32); torsoLocation1 = new Rectangle(0, 32, 80, 65); torsoLocation2 = new Rectangle(24, 97, 32, 2); torsoLocation3 = new Rectangle(34, 99, 12, 2); torsoLocation4 = new Rectangle(2, 97, 12, 2); torsoLocation5 = new Rectangle(66, 97, 12, 2); legsLocation1 = new Rectangle(16, 97, 48, 53); legsLocation2 = new Rectangle(14, 150, 52, 37); handsLocation = new Rectangle(0, 99, 80, 17); feetLocation = new Rectangle(4, 187, 72, 23); this.deselectAllEquipment(); this.attackDefenseInfo.UpdateLabels(); this.updateEquipmentIcons(); this.inventoryFilterBox.SelectedValueChanged += new EventHandler(displayInventory); this.inventorySubFilter.SelectedValueChanged += new EventHandler(displayInventory); this.player.Equipment.LoadoutChanged += new Logic.Equipment.LoadoutChangedEventHandler(Equipment_LoadoutChanged); this.inventoryFilterBox.SelectedIndex = 0; this.inventorySubFilter.SelectedIndex = 0; }
public Shop(Player shopper) { this.customer = shopper; this.stockshop(); }
public void ShowItemInfo(Logic.Item item, Logic.Player owner) { this.player = owner; this.item = item; this.ShowItemInfo(); }