コード例 #1
0
        public GestionCompetences(ContentManager Content, GraphicsDevice graphics)
        {
            font  = Tools.LoadFont("Fonts/AngryBirds/24", Content);
            font2 = Tools.LoadFont("Fonts/AngryBirds/44", Content);

            state      = SubGestion.fichePerso;
            butAttaque = new Button(Tools.LoadTexture("Menu/BoutonPlus", Content));
            butDefense = new Button(Tools.LoadTexture("Menu/BoutonPlus", Content));
            butDext    = new Button(Tools.LoadTexture("Menu/BoutonPlus", Content));
            butVitesse = new Button(Tools.LoadTexture("Menu/BoutonPlus", Content));
            butPv      = new Button(Tools.LoadTexture("Menu/BoutonPlus", Content));
            LoadListPerso(Content);
            butLoad = new Button(Tools.LoadTexture("boutonInventaire", Content), new string[] { Langage.getString(Langage.langueactuelle, 37) }, new int[] { 45 }, 20, font);

            butInventaire = new Button(Tools.LoadTexture("boutonInventaire", Content), new string[] { Langage.getString(Langage.langueactuelle, 5) }, new int[] { 120 }, 20, font);

            butNewChar = new Button(Tools.LoadTexture("boutonInventaire", Content), new string[] { Langage.getString(Langage.langueactuelle, 18) }, new int[] { 50 }, 20, font);

            butAttaque.setPositionAndColor(new Vector2(1450, 450), Color.Black);
            butDefense.setPositionAndColor(new Vector2(1450, 550), Color.Black);
            butDext.setPositionAndColor(new Vector2(1450, 650), Color.Black);
            butVitesse.setPositionAndColor(new Vector2(1450, 750), Color.Black);
            butPv.setPositionAndColor(new Vector2(1450, 850), Color.Black);
            butInventaire.setPositionAndColor(new Vector2(300, 150), Color.Black);
            butLoad.setPositionAndColor(new Vector2(1100, 150), Color.Black);
            butNewChar.setPositionAndColor(new Vector2(200, 200), Color.Black);

            saveName = new TextView(graphics, font2, "", false, false);
            saveName.SetPositionAndColor(new Vector2(font2.MeasureString(Langage.getString(Langage.langueactuelle, 7)).X + 150, 400), Color.Black);
        }
コード例 #2
0
        public void Draw(Player player, SpriteBatch sb, ContentManager content)
        {
            switch (state)
            {
            case SubGestion.fichePerso:

                sb.Draw(Tools.LoadTexture("Menu/GestionPerso", content), new Vector2(0, 0), Color.White);
                butAttaque.Draw(sb);
                butVitesse.Draw(sb);
                butDefense.Draw(sb);
                butDext.Draw(sb);
                butPv.Draw(sb);
                butLoad.Draw(sb);
                butInventaire.Draw(sb);
                sb.DrawString(font2, Langage.getString(Langage.langueactuelle, 8) + player.pointRestants, new Vector2(1150, 350), Color.Black);
                sb.Draw(Tools.LoadTexture("barre", content), new Vector2(1110, 410), Color.White);
                sb.Draw(Tools.LoadTexture("barre", content), new Vector2(1320, 410), Color.White);
                sb.DrawString(font, Langage.getString(Langage.langueactuelle, 13) + player.attaquePoint, new Vector2(1200, 470), Color.Black);
                sb.DrawString(font, Langage.getString(Langage.langueactuelle, 14) + player.defensePoint, new Vector2(1200, 570), Color.Black);
                sb.DrawString(font, Langage.getString(Langage.langueactuelle, 15) + player.dexteritePoint, new Vector2(1200, 670), Color.Black);
                sb.DrawString(font, Langage.getString(Langage.langueactuelle, 16) + player.vitessePoint, new Vector2(1200, 770), Color.Black);
                sb.DrawString(font, Langage.getString(Langage.langueactuelle, 17) + player.pVMax, new Vector2(1200, 870), Color.Black);

                sb.DrawString(font2, Langage.getString(Langage.langueactuelle, 7), new Vector2(150, 400), Color.Black);
                saveName.Draw(sb);
                sb.DrawString(font2, Langage.getString(Langage.langueactuelle, 9) + player.experience + "/" + (int)(Math.Pow(1.5, player.niveau) * Math.PI * 100), new Vector2(150, 500), Color.Black);
                sb.DrawString(font2, Langage.getString(Langage.langueactuelle, 10) + player.niveau, new Vector2(150, 600), Color.Black);
                sb.DrawString(font2, Langage.getString(Langage.langueactuelle, 11) + player.money, new Vector2(150, 700), Color.Black);
                sb.DrawString(font2, Langage.getString(Langage.langueactuelle, 12) + player.lifes, new Vector2(150, 800), Color.Black);

                break;

            case SubGestion.inventaire:

                inventaire.draw(sb, player, content);
                break;

            case SubGestion.LoadChar:
                sb.Draw(Tools.LoadTexture("Menu/GestionPerso", content), new Vector2(0, 0), Color.White);
                butNewChar.Draw(sb);
                listviewperso.Draw(sb);
                break;

            default:
                break;
            }
        }
コード例 #3
0
        public void Draw(SpriteBatch spriteBatch)
        {
            switch (submenu)
            {
            case SubMenuMulti.selection:
                create.Draw(spriteBatch);
                join.Draw(spriteBatch);
                break;

            case SubMenuMulti.name:
                spriteBatch.DrawString(font, Langage.getString(Langage.langueactuelle, 45), new Vector2(200, 550), Color.Black);
                textViewName.Draw(spriteBatch);
                break;

            case SubMenuMulti.mode:
                ctf.Draw(spriteBatch);
                tdm.Draw(spriteBatch);
                break;

            case SubMenuMulti.map:
                spriteBatch.DrawString(font, Langage.getString(Langage.langueactuelle, 46), new Vector2(10, 430), Color.Black);
                listViewMaps.Draw(spriteBatch);
                break;

            case SubMenuMulti.list:
                spriteBatch.DrawString(font, Langage.getString(Langage.langueactuelle, 47), new Vector2(10, 480), Color.Black);

                spriteBatch.DrawString(font, Langage.getString(Langage.langueactuelle, 54), new Vector2(10, 550), Color.Black);
                spriteBatch.DrawString(font, Langage.getString(Langage.langueactuelle, 55), new Vector2(600, 550), Color.Black);
                spriteBatch.DrawString(font, Langage.getString(Langage.langueactuelle, 56), new Vector2(1200, 550), Color.Black);
                spriteBatch.DrawString(font, Langage.getString(Langage.langueactuelle, 57), new Vector2(1650, 550), Color.Black);

                listViewServs.Draw(spriteBatch);
                if (mastersrv.serversConnected.Count == 0)
                {
                    spriteBatch.DrawString(font, Langage.getString(Langage.langueactuelle, 48), new Vector2(200, 800), Color.Black);
                }
                break;

            default:
                break;
            }
        }
コード例 #4
0
ファイル: Options.cs プロジェクト: SushiFu/The-Danger-Zone
        public void Draw(SpriteBatch spriteBatch)
        {
            switch (submenu)
            {
            case SubMenuOpt.general:
                spriteBatch.DrawString(font, Langage.getString(Langage.langueactuelle, 44), new Vector2(20 + offsetButtonX, 450 + offsetButton), Color.Black);
                serverAdress.Draw(spriteBatch);
                spriteBatch.DrawString(font, Langage.getString(Langage.langueactuelle, 27), new Vector2(20 + offsetButtonX, 550 + offsetButton), Color.Black);
                spriteBatch.DrawString(font, Langage.getString(Langage.langueactuelle, 24), new Vector2(20 + offsetButtonX, 650 + offsetButton), Color.Black);
                spriteBatch.DrawString(font, Langage.getString(Langage.langueactuelle, 26), new Vector2(20 + offsetButtonX, 750 + offsetButton), Color.Black);
                Francais.Draw(spriteBatch);
                English.Draw(spriteBatch);
                keys.Draw(spriteBatch);
                if (sound)
                {
                    soundON.Draw(spriteBatch);
                }
                else
                {
                    soundOFF.Draw(spriteBatch);
                }

                if (fullsSreen)
                {
                    fullsSreenON.Draw(spriteBatch);
                }
                else
                {
                    fullsSreenOFF.Draw(spriteBatch);
                }

                break;

            case SubMenuOpt.keys:
                general.Draw(spriteBatch);
                spriteBatch.DrawString(font, SetControles(), new Vector2(20 + offsetButtonX, 550 + offsetButton), Color.Black);
                spriteBatch.DrawString(fontkey, touche, new Vector2(SetControles().Length *(font.LineSpacing - 20), 520 + offsetButton), Color.Black);
                break;

            default:
                break;
            }
        }
コード例 #5
0
ファイル: Inventaire.cs プロジェクト: SushiFu/The-Danger-Zone
        public void draw(SpriteBatch sb, Player player, ContentManager content)
        {
            sb.Draw(Tools.LoadTexture("Menu/GestionPerso", content), new Vector2(0, 0), Color.White);
            sb.DrawString(font2, Langage.getString(Langage.langueactuelle, 11) + player.money, new Vector2(100, 150), Color.Black);
            sb.DrawString(font2, Langage.getString(Langage.langueactuelle, 38), new Vector2(100, 230), Color.Black);

            sb.DrawString(font2, Langage.getString(Langage.langueactuelle, 40), new Vector2(1000, 230), Color.Black);

            sb.DrawString(font2, Langage.getString(Langage.langueactuelle, 53) + Langage.getString(Langage.langueactuelle, 12) + " 500" + Langage.getString(Langage.langueactuelle, 39), new Vector2(1400, 230), Color.Black);
            sb.DrawString(font, Langage.getString(Langage.langueactuelle, 41) + player.lifes, new Vector2(1500, 300), Color.Black);
            butLifes.setPositionAndColor(new Vector2(1500 + (Langage.getString(Langage.langueactuelle, 41) + player.lifes).Length * (font.LineSpacing - 19), 300), Color.Black);
            butLifes.Draw(sb);
            sb.DrawString(font, Langage.getString(Langage.langueactuelle, 51), new Vector2(1400, 500), Color.Black);
            butChar1.Draw(sb);
            butChar2.Draw(sb);
            sb.DrawString(font, Langage.getString(Langage.langueactuelle, 52), new Vector2(600, 150), Color.Black);

            shopWeapons.Draw(sb);
            inventaryWeapons.Draw(sb);
        }
コード例 #6
0
        private void DrawLifeBar()
        {
            int x     = 700;
            int y     = 10;
            int For10 = (int)((players[hostPlayer].pV * 10) / players[hostPlayer].pVMax);

            sbHUD.Draw(textBarre, new Vector2(x - 40, y), Color.White);
            sbHUD.Draw(barreVie, new Vector2(x, y), Color.White);
            for (int i = 0; i < For10; i++)
            {
                sbHUD.Draw(caseVie, new Vector2(x + 5 + (i * 9), y + 2), Color.White);
            }
            if (currentPlayer.scoreKey)
            {
                spriteBatch.Draw(Tools.LoadTexture("HUD/HUD_level", Content), new Vector2(320, 10), Color.White);
                spriteBatch.DrawString(font, Langage.getString(Langage.langueactuelle, 10) + currentPlayer.niveau + "          Exp : " + currentPlayer.experience + "/" + (int)(Math.Pow(1.5, currentPlayer.niveau) * Math.PI * 100), new Vector2(330, 16), Color.Black);
                spriteBatch.DrawString(font, Langage.getString(Langage.langueactuelle, 11) + currentPlayer.money + " J", new Vector2(400, 45), Color.Black);
                spriteBatch.DrawString(font, Langage.getString(Langage.langueactuelle, 12) + currentPlayer.lifes, new Vector2(450, 75), Color.Black);
                spriteBatchMini2.DrawString(font, Langage.getString(Langage.langueactuelle, 42) + Player1Events.killplayer0.ToString(), new Vector2(2335, 275), Color.Black);
                spriteBatchMini2.DrawString(font, Langage.getString(Langage.langueactuelle, 10) + Player1Events.SurvivalLvL0.ToString(), new Vector2(2335, 315), Color.Black);
            }
        }
コード例 #7
0
ファイル: Options.cs プロジェクト: SushiFu/The-Danger-Zone
 private string SetControles()
 {
     if (changedKeys == 0)
     {
         return(Langage.getString(Langage.langueactuelle, 28));
     }
     else if (changedKeys == 1)
     {
         return(Langage.getString(Langage.langueactuelle, 29));
     }
     else if (changedKeys == 2)
     {
         return(Langage.getString(Langage.langueactuelle, 30));
     }
     else if (changedKeys == 3)
     {
         return(Langage.getString(Langage.langueactuelle, 31));
     }
     else if (changedKeys == 4)
     {
         return(Langage.getString(Langage.langueactuelle, 35));
     }
     else if (changedKeys == 5)
     {
         return(Langage.getString(Langage.langueactuelle, 32));
     }
     else if (changedKeys == 6)
     {
         return(Langage.getString(Langage.langueactuelle, 33));
     }
     else if (changedKeys == 7)
     {
         return(Langage.getString(Langage.langueactuelle, 34));
     }
     else
     {
         return("Done");
     }
 }
コード例 #8
0
ファイル: Inventaire.cs プロジェクト: SushiFu/The-Danger-Zone
        public void update(Controles controles, double mouseCoef, Player player, ContentManager Content)
        {
            inventaryWeapons.Update(mouseCoef, controles);
            shopWeapons.Update(mouseCoef, controles);
            butLifes.Update(mouseCoef, controles);
            if (butLifes.isCliked)
            {
                butLifes.isCliked = false;
                if (player.money > 500)
                {
                    player.lifes++;
                    player.money -= 500;
                }
            }
            butChar1.Update(mouseCoef, controles);
            butChar2.Update(mouseCoef, controles);
            if (butChar1.isCliked)
            {
                player.spritePerso = 0;
            }
            if (butChar2.isCliked)
            {
                player.spritePerso = 1;
            }

            int index = inventaryWeapons.GetIndexClicked();

            if (index != -1 && player.money > weaponList[index].prix / 10)
            {
                weaponList[index].munitions += weaponList[index].capacity;//TODO !!
                player.money -= weaponList[index].prix / 10;
                inventaryWeapons.updateString(new string[] { weaponList[index].weaponName +
                                                             " :  " + weaponList[index].munitions + "-" + weaponList[index].prix / 10 + "J" }, index);
            }

            int index2 = shopWeapons.GetIndexClicked();

            if (index2 != -1 && player.money > AllWeapon[index2].prix)
            {
                player.ItemList.Add(AllWeapon[index2]);
                weaponList.Add(AllWeapon[index2]);
                player.money -= AllWeapon[index2].prix;
                AllWeapon.RemoveAt(index2);
                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);
                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);
                }
            }
        }
コード例 #9
0
ファイル: Inventaire.cs プロジェクト: SushiFu/The-Danger-Zone
        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);
            }
        }
コード例 #10
0
ファイル: Load.cs プロジェクト: SushiFu/The-Danger-Zone
        protected override void LoadContent()
        {
            sbHUD               = new SpriteBatch(GraphicsDevice);
            spriteBatch         = new SpriteBatch(GraphicsDevice);
            spriteBatchMini     = new SpriteBatch(GraphicsDevice);
            spriteBatchMini2    = new SpriteBatch(GraphicsDevice);
            destrucTileList     = new List <Vector3>();
            entityList          = new List <Entity>();
            animationList       = new List <Animate>();
            particlesEngineList = new List <ParticleEngine>();
            particleList        = new List <Particles>();
            explosionReseau     = new List <Vector2>();

            switch (gameState)
            {
            case GameState.initialize:
                //Load Cursor Texture and Position

                personalFolder           = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "TDZ";
                cursor                   = Tools.LoadTexture("Others/cursor", Content);
                controles.cursorPosition = new Vector2();
                Langage.LoadLanguage();
                destroyTile = Tools.LoadTexture("SpriteTexture/destroyed", Content);

                #region Load Textures

                TexturesGame.LoadAmmo(Content);
                TexturesGame.LoadPlayers(Content);
                TexturesGame.LoadArmes(Content);
                TexturesGame.LoadItem(Content);
                TexturesGame.LoadImpact(Content);
                TexturesGame.Loadtest(Content);
                TexturesGame.LoadBonus(Content);
                TexturesGame.LoadIAs(Content);
                TexturesGame.LoadPlatForm(Content);
                TexturesGame.Loadtest(Content);
                TexturesGame.LoadSpeedUp(Content);
                TexturesGame.LoadBackgrounds(Content);

                #endregion Load Textures

                menu      = new Menu(Content, GraphicsDevice);
                font      = Tools.LoadFont("Fonts/AngryBirds/24", Content);
                GameOver  = Tools.LoadTexture("Menu/GameOver", Content);
                fondRadar = Tools.LoadTexture("Others/fondRadar", Content);
                HUDarmes  = Tools.LoadTexture("HUD/HUD_armes", Content);
                gameState = GameState.menu;
                sound     = new Sound(Content);

                Player player = new Player(new Vector2(0, 0), TexturesGame.PlayerTab[0], 0, GraphicsDevice, LoadWeapons.LoadKnife(Content), true, FlagsType.blue);
                menu = new Menu(Content, GraphicsDevice);
                try
                {
                    XmlSerializer serializer = new XmlSerializer(typeof(Opt));
                    FileStream    fs         = new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/TDZ/Options/OptionMenu", FileMode.Open);
                    XmlReader     reader     = XmlReader.Create(fs);
                    Opt           obj        = (Opt)serializer.Deserialize(reader);
                    fullScreenON = obj.Fullscreen;
                    menu.optionsMenu.toFullScreen = obj.Fullscreen;
                    soundON                = obj.SoundOn;
                    sound.playEffects      = soundON;
                    controles.controleTab  = obj.controleTab;
                    Langage.langueactuelle = obj.language;

                    if (obj.masterServerAdress != null)
                    {
                        ConnectMaster.MasterIPAdress = obj.masterServerAdress;
                    }
                    fs.Close();

                    XmlSerializer serializer2 = new XmlSerializer(typeof(SavPerso));
                    FileStream    fs2         = new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/TDZ/Sauvegardes/" + obj.name, FileMode.Open);
                    XmlReader     reader2     = XmlReader.Create(fs2);
                    SavPerso      obj2        = (SavPerso)serializer2.Deserialize(reader2);
                    player.Deserialise(obj2, Content);
                    fs2.Close();
                }
                catch (Exception)
                {
                    player = new Player(new Vector2(0, 0), TexturesGame.PlayerTab[0], 0, GraphicsDevice, LoadWeapons.LoadKnife(Content), true, FlagsType.blue);
                    player.ItemList.Add(LoadWeapons.LoadKnife(Content));
                }
                currentPlayer = player;
                solo          = new Solo(player.currentLevel, player);
                menu.LaunchMenuSound(sound);
                break;

            case GameState.editor:

                sound.soundPlayer.Stop();

                // Prepare the process to run
                ProcessStartInfo start = new ProcessStartInfo();
                // Enter the executable to run, including the complete path
                start.FileName = "./MapEditor.exe";
                // Do you want to show a console window?
                start.WindowStyle    = ProcessWindowStyle.Hidden;
                start.CreateNoWindow = true;

                // Run the external process & wait for it to finish
                using (Process proc = Process.Start(start))
                {
                    proc.WaitForExit();
                }


                gameState = GameState.menu;
                menu      = new Menu(Content, GraphicsDevice);
                menu.LaunchMenuSound(sound);
                break;

            case GameState.solo:

                sound.soundPlayer.Stop();

                //Load List Tirs and Texture
                shotsPlayer = new Shot();

                //Load Map
                LoadMap(menu.mapname + ".xml");
                LoadMapTextures();

                //Load Player Array
                hostPlayer = 0;
                LoadPlayer();
                players[hostPlayer].position = mapWorld.spawnPoint;
                players[hostPlayer].image    = TexturesGame.PlayerTab[players[hostPlayer].spritePerso];
                // LoadEnemy();
                LoadSurvivalEnemy();
                LoadItem();

                //Load HUD
                LoadHUD();

                background = new Background(Content, mapWorld);
                camera     = new Camera(players, hostPlayer, scaleNormValue, GraphicsDevice, mapWorld);

                break;

            case GameState.scenario:

                sound.soundPlayer.Stop();

                //Load List Tirs and Texture
                shotsPlayer = new Shot();

                //Load Map
                LoadMap(solo.currentMap + ".xml");
                LoadMapTextures();

                //Load Player Array
                solo.player.position = mapWorld.spawnPoint;
                hostPlayer           = 0;
                players = new List <Player>();
                players.Add(solo.player);
                entityList.Add(solo.player);

                Enemys = new List <Enemy>();

                for (int i = 0; i < mapWorld.IASpawnList.Count; i++)
                {
                    Enemys.Add(new Enemy(mapWorld.IASpawnList[i], TexturesGame.IATab[0], 100 + i, Content, LoadWeapons.LoadIAGun(Content), false, 0, GraphicsDevice));
                    Enemys[i].iaType = IAType.patrouille;
                    entityList.Add(Enemys[i]);
                    Enemys[i].attaque = currentPlayer.niveau * 0.1f;
                    Enemys[i].defense = 2 / currentPlayer.niveau;
                }

                LoadItem();

                //Load HUD
                LoadHUD();

                background = new Background(Content, mapWorld);
                camera     = new Camera(players, hostPlayer, scaleNormValue, GraphicsDevice, mapWorld);

                break;

            case GameState.multi:
                sound.soundPlayer.Stop();

                //Launch Network and Load Map
                mapWorld = new Map();
                client   = new Client(ConnectMaster.MasterIPAdress, Convert.ToInt32(menu.multiMenu.tmpserv.port), ref hostPlayer, mapWorld, Content, menu.multiMenu.tmpserv.mode);

                if (client.mode == ModeMulti.ctf)
                {
                    flags    = new Flag[2];
                    flags[0] = new Flag(mapWorld.drapeau2, Content, FlagsType.red);
                    flags[1] = new Flag(mapWorld.drapeau1, Content, FlagsType.blue);
                    foreach (Flag item in flags)
                    {
                        mapWorld.itemList.Add(item);
                    }
                }

                LoadMapTextures();

                //Platforms
                for (int i = 0; i < mapWorld.platFormList.Count; i++)
                {
                    entityList.Add(mapWorld.platFormList[i]);
                }

                //Load List Tirs and Texture
                shotsPlayer = new Shot();

                //Load Player Array
                LoadPlayer();
                SetCurrentPlayer();
                Enemys = new List <Enemy>();

                //Load HUD
                LoadHUD();

                background = new Background(Content, mapWorld);
                camera     = new Camera(players, hostPlayer, scaleNormValue, GraphicsDevice, mapWorld);

                break;

            default:
                break;
            }
        }
コード例 #11
0
ファイル: Menu.cs プロジェクト: SushiFu/The-Danger-Zone
        public Menu(ContentManager Content, GraphicsDevice graphics)
        {
            font = Tools.LoadFont("Fonts/Inversionz_Italic/64", Content);
            Color color = Color.Yellow;

            gestion = new GestionCompetences(Content, graphics);

            if (graphics.Viewport.Height < 1080)
            {
                offsetButton  = 320;
                offsetButtonX = 20;
            }

            menuState = MenuState.main;

            optionsMenu = new Options(Content, graphics);

            multiMenu = new MultiMenu(Content, graphics);

            back = Tools.LoadTexture("Menu/MENU", Content);

            butSolo     = new Button(Tools.LoadTexture("Menu/BoutonMenu", Content), new string[] { Langage.getString(Langage.langueactuelle, 0) }, new int[] { 80 }, 5, font);
            butCreation = new Button(Tools.LoadTexture("Menu/BoutonMenu", Content), new string[] { Langage.getString(Langage.langueactuelle, 3) }, new int[] { 80 }, 5, font);
            butMulti    = new Button(Tools.LoadTexture("Menu/BoutonMenu", Content), new string[] { Langage.getString(Langage.langueactuelle, 19) }, new int[] { 80 }, 5, font);
            butEditor   = new Button(Tools.LoadTexture("Menu/BoutonMenu", Content), new string[] { Langage.getString(Langage.langueactuelle, 22) }, new int[] { 80 }, 5, font);
            butOptions  = new Button(Tools.LoadTexture("Menu/BoutonMenu", Content), new string[] { Langage.getString(Langage.langueactuelle, 23) }, new int[] { 80 }, 5, font);
            butExit     = new Button(Tools.LoadTexture("Menu/BoutonMenu", Content), new string[] { Langage.getString(Langage.langueactuelle, 25) }, new int[] { 80 }, 5, font);
            butCampagne = new Button(Tools.LoadTexture("Menu/BoutonMenu", Content), new string[] { Langage.getString(Langage.langueactuelle, 1) }, new int[] { 80 }, 5, font);
            butSurvival = new Button(Tools.LoadTexture("Menu/BoutonMenu", Content), new string[] { Langage.getString(Langage.langueactuelle, 2) }, new int[] { 80 }, 5, font);

            butSolo.setPositionAndColor(new Vector2(20 + offsetButtonX, graphics.Viewport.Height - 600 + offsetButton), color);
            butMulti.setPositionAndColor(new Vector2(20 + offsetButtonX, graphics.Viewport.Height - 500 + offsetButton), color);
            butEditor.setPositionAndColor(new Vector2(20 + offsetButtonX, graphics.Viewport.Height - 400 + offsetButton), color);
            butOptions.setPositionAndColor(new Vector2(20 + offsetButtonX, graphics.Viewport.Height - 300 + offsetButton), color);
            butExit.setPositionAndColor(new Vector2(20 + offsetButtonX, graphics.Viewport.Height - 200 + offsetButton), color);
            butCampagne.setPositionAndColor(new Vector2(20 + offsetButtonX, graphics.Viewport.Height - 600 + offsetButton), color);
            butSurvival.setPositionAndColor(new Vector2(20 + offsetButtonX, graphics.Viewport.Height - 500 + offsetButton), color);
            butCreation.setPositionAndColor(new Vector2(20 + offsetButtonX, graphics.Viewport.Height - 400 + offsetButton), color);

            optionsMenu.submenu = SubMenuOpt.general;
        }
コード例 #12
0
        public void Update(ref Player player, double mousseCoef, Controles controles, ContentManager content, GraphicsDevice graphics)
        {
            switch (state)
            {
            case SubGestion.fichePerso:
                butAttaque.Update(mousseCoef, controles);
                butDefense.Update(mousseCoef, controles);
                butDext.Update(mousseCoef, controles);
                butPv.Update(mousseCoef, controles);
                butVitesse.Update(mousseCoef, controles);
                butInventaire.Update(mousseCoef, controles);
                butLoad.Update(mousseCoef, controles);

                if (butAttaque.isCliked)
                {
                    butAttaque.isCliked = false;
                    if (player.pointRestants > 0)
                    {
                        player.attaquePoint++;
                        if (player.attaque < 3)
                        {
                            player.attaque *= 1.1f;
                        }
                        player.pointRestants--;
                    }
                }
                if (butDefense.isCliked)
                {
                    butDefense.isCliked = false;
                    if (player.pointRestants > 0)
                    {
                        player.defensePoint++;
                        player.defense *= 0.9f;
                        player.pointRestants--;
                    }
                }
                if (butDext.isCliked)
                {
                    butDext.isCliked = false;
                    if (player.pointRestants > 0 && player.accuracy > 0)
                    {
                        player.dexteritePoint++;
                        player.accuracy--;
                        player.pointRestants--;
                    }
                }
                if (butPv.isCliked)
                {
                    butPv.isCliked = false;
                    if (player.pointRestants > 0)
                    {
                        player.pVMax = (int)(player.pVMax * 1.1f);
                        player.pV    = player.pVMax;
                        player.pointRestants--;
                    }
                }
                if (butVitesse.isCliked)
                {
                    butVitesse.isCliked = false;
                    if (player.pointRestants > 0)
                    {
                        player.vitessePoint++;
                        player.vitesseMaxInit += 0.5f;
                        player.vitesseMax      = player.vitesseMaxInit;
                        player.pointRestants--;
                    }
                }

                if (butInventaire.isCliked)
                {
                    butInventaire.isCliked = false;
                    inventaire             = new Inventaire(content, player);
                    state = SubGestion.inventaire;
                }

                if (player.newChar)
                {
                    if (saveName.IsFinish)
                    {
                        saveName.IsFinish = false;
                        player.name       = saveName.text;
                        player.newChar    = false;
                    }
                    else
                    {
                        saveName.Update(controles);
                    }
                }
                else
                {
                    saveName.SetText(player.name);
                }

                if (butLoad.isCliked)
                {
                    butLoad.isCliked = false;
                    state            = SubGestion.LoadChar;
                }
                break;

            case SubGestion.inventaire:
                inventaire.update(controles, mousseCoef, player, content);
                break;

            case SubGestion.LoadChar:
                butNewChar.Update(mousseCoef, controles);
                listviewperso.Update(mousseCoef, controles);
                Button item = listviewperso.GetClickedButton();
                if (item != null)
                {
                    player = new Player(new Vector2(0, 0), TexturesGame.PlayerTab[0], 0, player.graphics, LoadWeapons.LoadKnife(content), true, FlagsType.red);
                    XmlSerializer serializer2 = new XmlSerializer(typeof(SavPerso));
                    FileStream    fs2         = new FileStream((Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/TDZ/Sauvegardes/") + item.text[0], FileMode.Open);
                    XmlReader     reader2     = XmlReader.Create(fs2);
                    SavPerso      obj2        = (SavPerso)serializer2.Deserialize(reader2);
                    player.Deserialise(obj2, content);
                    fs2.Close();
                    state = SubGestion.fichePerso;
                }
                else if (butNewChar.isCliked)
                {
                    butNewChar.isCliked = false;
                    player = new Player(new Vector2(0, 0), TexturesGame.PlayerTab[0], 0, player.graphics, LoadWeapons.LoadKnife(content), true, FlagsType.red);
                    player.ItemList.Add(LoadWeapons.LoadKnife(content));
                    saveName = new TextView(graphics, font, player.name, true, true);
                    saveName.SetPositionAndColor(new Vector2(font.MeasureString(Langage.getString(Langage.langueactuelle, 7)).X + 500, 400), Color.Black);
                    state = SubGestion.fichePerso;
                }
                break;

            default:
                break;
            }
        }
コード例 #13
0
 private void DrawMultiScore()
 {
     spriteBatch.DrawString(font, Langage.getString(Langage.langueactuelle, 58) + client.redScore.ToString(), new Vector2(1400, 20), Color.Red);
     spriteBatch.DrawString(font, Langage.getString(Langage.langueactuelle, 59) + client.blueScore.ToString(), new Vector2(1400, 70), Color.Blue);
 }
コード例 #14
0
        public MultiMenu(ContentManager Content, GraphicsDevice graphics)
        {
            font = Tools.LoadFont("Fonts/Inversionz_Italic/64", Content);
            Color color = Color.Yellow;

            submenu = SubMenuMulti.selection;

            create = new Button(Tools.LoadTexture("Menu/BoutonMenu", Content), new string[] { Langage.getString(Langage.langueactuelle, 20) }, new int[] { 80 }, 5, font);
            join   = new Button(Tools.LoadTexture("Menu/BoutonMenu", Content), new string[] { Langage.getString(Langage.langueactuelle, 21) }, new int[] { 80 }, 5, font);
            ctf    = new Button(Tools.LoadTexture("Menu/BoutonMenu", Content), new string[] { Langage.getString(Langage.langueactuelle, 50) }, new int[] { 80 }, 5, font);
            tdm    = new Button(Tools.LoadTexture("Menu/BoutonMenu", Content), new string[] { Langage.getString(Langage.langueactuelle, 49) }, new int[] { 80 }, 5, font);
            create.setPositionAndColor(new Vector2(20, 850), color);
            join.setPositionAndColor(new Vector2(20, 750), color);
            ctf.setPositionAndColor(new Vector2(20, 850), color);
            tdm.setPositionAndColor(new Vector2(20, 750), color);

            tmpserv = new ServerInfo("", "", 0, 0, ModeMulti.ctf);

            textViewName = new TextView(graphics, font, "", true, true);
            textViewName.SetPositionAndColor(new Vector2(200, 600), Color.Black);
        }
コード例 #15
0
ファイル: Options.cs プロジェクト: SushiFu/The-Danger-Zone
        public void Update(ref MenuState state, double mouseCoef, ref bool full, ref bool soun, Sound play, Controles controles)
        {
            sound      = soun;
            fullsSreen = full;
            switch (submenu)
            {
            case SubMenuOpt.general:
                keys.Update(mouseCoef, controles);
                Francais.Update(mouseCoef, controles);
                English.Update(mouseCoef, controles);

                serverAdress.Update(controles);
                if (serverAdress.IsFinish)
                {
                    serverAdress.IsFinish        = false;
                    ConnectMaster.MasterIPAdress = serverAdress.text;
                }

                if (Francais.isCliked)
                {
                    Langage.langueactuelle = Langue.Francais;
                    keys.SetText(new string[] { Langage.getString(Langage.langueactuelle, 36) });
                    English.isCliked = false;
                }
                if (English.isCliked)
                {
                    Langage.langueactuelle = Langue.English;
                    keys.SetText(new string[] { Langage.getString(Langage.langueactuelle, 36) });
                    Francais.isCliked = false;
                }
                if (sound)
                {
                    soundON.Update(mouseCoef, controles);
                }
                else
                {
                    soundOFF.Update(mouseCoef, controles);
                }
                if (fullsSreen)
                {
                    fullsSreenON.Update(mouseCoef, controles);
                }
                else
                {
                    fullsSreenOFF.Update(mouseCoef, controles);
                }

                if (keys.isCliked)
                {
                    submenu       = SubMenuOpt.keys;
                    keys.isCliked = false;
                }
                if (soundON.isCliked)
                {
                    soun             = false;
                    soundON.isCliked = false;
                    play.soundPlayer.Stop();
                }
                if (soundOFF.isCliked)
                {
                    play.sounds[(int)SoundsName.fusil].Play();
                    soun = true;
                    soundOFF.isCliked = false;
                    play.soundPlayer.Play();
                }
                if (fullsSreenON.isCliked)
                {
                    toWindowed            = true;
                    full                  = false;
                    fullsSreenON.isCliked = false;
                }
                if (fullsSreenOFF.isCliked)
                {
                    play.Play(SoundsName.fusil);
                    toFullScreen           = true;
                    full                   = true;
                    fullsSreenOFF.isCliked = false;
                }
                break;

            case SubMenuOpt.keys:
                general.Update(mouseCoef, controles);
                if (general.isCliked)
                {
                    submenu          = SubMenuOpt.general;
                    general.isCliked = false;
                }
                if (controles.keyboard.GetPressedKeys().Length == 1 && controles.oldkeyboard.GetPressedKeys().Length == 0 && controles.keyboard.GetPressedKeys()[0] != Keys.Enter)
                {
                    controles.controleTab[changedKeys] = controles.keyboard.GetPressedKeys()[0];
                    touche = controles.keyboard.GetPressedKeys()[0].ToString();
                }
                if (controles.keyboard.GetPressedKeys().Length == 1 && controles.oldkeyboard.GetPressedKeys().Length == 0 && controles.keyboard.GetPressedKeys()[0] == Keys.Enter)
                {
                    changedKeys++;
                    touche = "";
                }
                if (changedKeys == controles.controleTab.Length)
                {
                    changedKeys = 0;
                    submenu     = SubMenuOpt.general;
                }
                break;

            default:
                break;
            }
        }
コード例 #16
0
ファイル: Options.cs プロジェクト: SushiFu/The-Danger-Zone
        public Options(ContentManager Content, GraphicsDevice graphics)
        {
            if (graphics.Viewport.Height < 1080)
            {/*
              * offsetButton = 320;
              * offsetButtonX = 20;*/
            }
            submenu       = SubMenuOpt.general;
            font          = Tools.LoadFont("Fonts/Inversionz_Italic/64", Content);
            fontkey       = Tools.LoadFont("Fonts/SergoeKeycaps/64", Content);
            soundON       = new Button(Tools.LoadTexture("Menu/checked", Content));
            soundOFF      = new Button(Tools.LoadTexture("Menu/unchecked", Content));
            fullsSreenON  = new Button(Tools.LoadTexture("Menu/checked", Content));
            fullsSreenOFF = new Button(Tools.LoadTexture("Menu/unchecked", Content));
            keys          = new Button(Tools.LoadTexture("Menu/BoutonMenu", Content), new string[] { Langage.getString(Langage.langueactuelle, 36) }, new int[] { 80 }, 5, font);
            general       = new Button(Tools.LoadTexture("Menu/BoutonMenu", Content), new string[] { "general" }, new int[] { 80 }, 5, font);
            Francais      = new Button(Tools.LoadTexture("Menu/fr_flag", Content));
            English       = new Button(Tools.LoadTexture("Menu/gb_flag", Content));

            soundON.setPositionAndColor(new Vector2(750 + offsetButtonX, 500 + offsetButton + 140), Color.Yellow);
            soundOFF.setPositionAndColor(new Vector2(750 + offsetButtonX, 500 + offsetButton + 140), Color.Yellow);
            fullsSreenON.setPositionAndColor(new Vector2(750 + offsetButtonX, 600 + offsetButton + 140), Color.Yellow);
            fullsSreenOFF.setPositionAndColor(new Vector2(750 + offsetButtonX, 600 + offsetButton + 140), Color.Yellow);
            Francais.setPositionAndColor(new Vector2(750 + offsetButtonX, 400 + offsetButton + 140), Color.Yellow);
            English.setPositionAndColor(new Vector2(900 + offsetButtonX, 400 + offsetButton + 140), Color.Yellow);
            keys.setPositionAndColor(new Vector2(20 + offsetButtonX, 700 + offsetButton + 160), Color.Yellow);
            general.setPositionAndColor(new Vector2(20 + offsetButtonX, 700 + offsetButton + 160), Color.Yellow);
            changedKeys = 0;

            serverAdress = new TextView(graphics, font, ConnectMaster.MasterIPAdress, true, true);
            serverAdress.SetPositionAndColor(new Vector2(20 + offsetButtonX + font.MeasureString(Langage.getString(Langage.langueactuelle, 44)).X, 450 + offsetButton), Color.Black);
        }