Esempio n. 1
0
 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();
 }
Esempio n. 2
0
 public Battle(Player currentplayer)
 {
     player = currentplayer;
     monster = new Monster(Combat.ChooseMonster(player.Level));
     player.ResetTimers();
     monster.ResetTimers();
     player.Target = monster;
     monster.Target = player;
 }
Esempio n. 3
0
        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;
        }
Esempio n. 4
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;
        }
Esempio n. 5
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;
        }
Esempio n. 6
0
 public Shop(Player shopper)
 {
     this.customer = shopper;
     this.stockshop();
 }
Esempio n. 7
0
 public void ShowItemInfo(Logic.Item item, Logic.Player owner)
 {
     this.player = owner;
     this.item   = item;
     this.ShowItemInfo();
 }
Esempio n. 8
0
 public void ShowItemInfo(Logic.Item item, Logic.Player owner)
 {
     this.player = owner;
     this.item = item;
     this.ShowItemInfo();
 }