public override void Load() { #region Chargement de la musique sndMusic = AssetManager.mscVictory; MediaPlayer.Play(sndMusic); MediaPlayer.IsRepeating = true; #endregion #region Image de background _backgroundColor = Color.Transparent; _background = AssetManager.Victory; #endregion #region Création des éléments la GUI SpriteFont font = AssetManager.MenuFont; int screenWidth = MainGame.Screen.Width; int screenHeight = MainGame.Screen.Height; _groupMenu = new GroupSelection(); string text = "MENU"; _menu = new Textbox(new Vector2(-200, (screenHeight - font.MeasureString(text).Y) / 2 - 40), font, text); _groupMenu.AddElement((IIntegrableMenu)_menu); text = "QUITTER"; _exit = new Textbox(new Vector2(-2200, (screenHeight - font.MeasureString(text).Y) / 2 + 40), font, text); _groupMenu.AddElement((IIntegrableMenu)_exit); text = "L'" + MainGame.Winner + " gagne !"; _winner = new Textbox(new Vector2(-3000, 50), font, text); _winner.ApplyColor(Color.Green, Color.Black); _groupMenu.RefreshColors(); _groupMenu.CurrentSelection = 0; foreach (Textbox txt in _groupMenu.Elements) { txt.OnHover += Textbox_OnHover; txt.OnClick += Textbox_OnClick; } #endregion #region Création du tweening _tweeningMenu = new Tweening(Tweening.Tween.InSine, (int)_menu.Position.X, (int)(screenWidth - _menu.Size.X) / 2, new TimeSpan(0, 0, 0, TIMER_INTRO)); _tweeningExit = new Tweening(Tweening.Tween.InSine, (int)_exit.Position.X, (int)(screenWidth - _exit.Size.X) / 2, new TimeSpan(0, 0, 0, TIMER_INTRO)); _tweeningWinner = new Tweening(Tweening.Tween.InSine, (int)_winner.Position.X, (int)(screenWidth - _winner.Size.X) / 2, new TimeSpan(0, 0, 0, TIMER_INTRO)); #endregion base.Load(); }
public override void Load() { #region Chargement de la musique sndMusic = AssetManager.mscMenu; MediaPlayer.Play(sndMusic); MediaPlayer.IsRepeating = true; #endregion #region Image de background _backgroundColor = Color.Transparent; _background = AssetManager.Menu; #endregion #region Création des éléments la GUI SpriteFont font = AssetManager.MenuFont; int screenWidth = MainGame.Screen.Width; int screenHeight = MainGame.Screen.Height; #region Menu _groupMenu = new GroupSelection(); string text = "JOUER"; _play = new Textbox(new Vector2(-200, (screenHeight - font.MeasureString(text).Y) / 2 - 80), font, text); _groupMenu.AddElement((IIntegrableMenu)_play); text = "COMMENT JOUER"; _howToPlay = new Textbox(new Vector2(-1200, (screenHeight - font.MeasureString(text).Y) / 2), font, text); _groupMenu.AddElement((IIntegrableMenu)_howToPlay); text = "QUITTER"; _exit = new Textbox(new Vector2(-2200, (screenHeight - font.MeasureString(text).Y) / 2 + 80), font, text); _groupMenu.AddElement((IIntegrableMenu)_exit); text = "ENTRAINER L'IA"; _trainingMode = new Textbox(new Vector2(-3200, (screenHeight - font.MeasureString(text).Y) / 2 + 160), font, text); _groupMenu.AddElement((IIntegrableMenu)_trainingMode); _groupMenu.RefreshColors(); _groupMenu.CurrentSelection = 0; foreach (Textbox txt in _groupMenu.Elements) { txt.OnHover += MenuTextbox_OnHover; txt.OnClick += MenuTextbox_OnClick; } #endregion #region Nombre d'équipes _numberOfTeamDescription = new Textbox(new Vector2(-1000, 10), font, "Nombre d'équipes : "); _groupNbOfTeam = new GroupSelection(); _numberOfTeam = new Textbox[3]; for (int i = 0; i < _numberOfTeam.Length; i++) { _numberOfTeam[i] = new Textbox(new Vector2(-1610 + 80 * i, 10), font, (i + 2).ToString()); _groupNbOfTeam.AddElement((IIntegrableMenu)_numberOfTeam[i]); _numberOfTeam[i].OnClick += NbOfTeamTextbox_OnClick; } _groupNbOfTeam.CurrentSelection = 0; SelectNbOfTeam(); #endregion #region Nombre de tanks _numberOfTankDescription = new Textbox(new Vector2(-1000, 80), font, "Nombre de tanks : "); _groupNbOfTank = new GroupSelection(); _numberOfTank = new Textbox[5]; for (int i = 0; i < _numberOfTank.Length; i++) { _numberOfTank[i] = new Textbox(new Vector2(-1610 + 80 * i, 80), font, (i + 1).ToString()); _groupNbOfTank.AddElement((IIntegrableMenu)_numberOfTank[i]); _numberOfTank[i].OnClick += NbOfTankTextbox_OnClick; } _groupNbOfTank.CurrentSelection = 0; SelectNbOfTank(); #endregion #endregion #region Création du tweening _tweeningPlay = new Tweening(Tweening.Tween.InSine, (int)_play.Position.X, (int)(screenWidth - _play.Size.X) / 2, new TimeSpan(0, 0, 0, TIMER_INTRO)); _tweeninghowToPlay = new Tweening(Tweening.Tween.InSine, (int)_howToPlay.Position.X, (int)(screenWidth - _howToPlay.Size.X) / 2, new TimeSpan(0, 0, 0, TIMER_INTRO)); _tweeningExit = new Tweening(Tweening.Tween.InSine, (int)_exit.Position.X, (int)(screenWidth - _exit.Size.X) / 2, new TimeSpan(0, 0, 0, TIMER_INTRO)); _tweeningTrainingMode = new Tweening(Tweening.Tween.InSine, (int)_trainingMode.Position.X, (int)(screenWidth - _trainingMode.Size.X) / 2, new TimeSpan(0, 0, 0, TIMER_INTRO)); _tweeningNbOfTeamDescription = new Tweening(Tweening.Tween.InSine, (int)_numberOfTeamDescription.Position.X, 10, new TimeSpan(0, 0, 0, TIMER_INTRO)); _tweeningNbOfTankDescription = new Tweening(Tweening.Tween.InSine, (int)_numberOfTankDescription.Position.X, 10, new TimeSpan(0, 0, 0, TIMER_INTRO)); _tweeningNbOfTeam = new Tweening[_numberOfTeam.Length]; for (int i = 0; i < _tweeningNbOfTeam.Length; i++) { _tweeningNbOfTeam[i] = new Tweening(Tweening.Tween.InSine, (int)_numberOfTeam[i].Position.X, 610 + 80 * i, new TimeSpan(0, 0, 0, TIMER_INTRO)); } _tweeningNbOfTank = new Tweening[_numberOfTank.Length]; for (int i = 0; i < _tweeningNbOfTank.Length; i++) { _tweeningNbOfTank[i] = new Tweening(Tweening.Tween.InSine, (int)_numberOfTank[i].Position.X, 610 + 80 * i, new TimeSpan(0, 0, 0, TIMER_INTRO)); } #endregion base.Load(); }