Example #1
0
        public Inventaire(ContentManager Content, Player player)
        {
            font2      = Tools.LoadFont("Fonts/AngryBirds/44", Content);
            font       = Tools.LoadFont("Fonts/AngryBirds/24", Content);
            ButList    = new List <Button>();
            weaponList = new List <Weapon>();
            AllWeapon  = new List <Weapon>();
            butAllWeap = new List <Button>();
            butChar1   = new Button(TexturesGame.PlayerTab[0][0]);
            butChar1.setPositionAndColor(new Vector2(1400, 580), Color.White);
            butChar2 = new Button(TexturesGame.PlayerTab[1][0]);
            butChar2.setPositionAndColor(new Vector2(1500, 580), Color.White);
            inventaryWeapons = new ListView(Tools.LoadTexture("HUD/HUD_armes", Content), new Vector2(100, 300), font, Color.Black, 5);
            shopWeapons      = new ListView(Tools.LoadTexture("HUD/HUD_armes", Content), new Vector2(800, 300), font, Color.Black, 5);
            List <Weapon> temp = LoadWeapons.AllWeapon(Content);

            butLifes = new Button(Tools.LoadTexture("Item/coeur", Content));
            butLifes.setPositionAndColor(new Vector2(1500, 300), Color.Black);

            for (int i = 0; i < temp.Count; i++)
            {
                bool test = false;
                for (int j = 0; j < player.ItemList.Count; j++)
                {
                    test = test || (temp[i].name == player.ItemList[j].name);
                }
                if (!test)
                {
                    AllWeapon.Add(temp[i]);
                }
            }
            for (int i = 0; i < player.ItemList.Count; i++)
            {
                if (player.ItemList[i].GetType() == typeof(Weapon))
                {
                    weaponList.Add((Weapon)player.ItemList[i]);
                }
            }
            for (int i = 0; i < weaponList.Count; i++)
            {
                inventaryWeapons.defaultCell = Tools.LoadTexture("Weapons/WeaponSprite/" + weaponList[i].weaponName, Content);
                inventaryWeapons.AddCell(new string[] { weaponList[i].weaponName + " :  " + weaponList[i].munitions + "-" + weaponList[i].prix / 10 + "J" }, new int[] { 200 }, 10);
            }
            for (int i = 0; i < AllWeapon.Count; i++)
            {
                shopWeapons.defaultCell = Tools.LoadTexture("Weapons/WeaponSprite/" + AllWeapon[i].weaponName, Content);
                shopWeapons.AddCell(new string[] { AllWeapon[i].weaponName + " :  " + AllWeapon[i].prix + Langage.getString(Langage.langueactuelle, 39) }, new int[] { 200 }, 10);
            }
        }