public void LoadContent() { // récupération du style myStyle = myApp.guiStyle.ThemeSelectionMenuStyle; myPlayer = null; themes = new List<HorizontalLayout>(); if (myGame.NumPlayers > 0) { // on trouve le joueur concerné par la sélection int numSelections = myGame.Players[0].ChosenThemes.Count; for (int i = 1; i < myGame.NumPlayers; i++) { if (myGame.Players[i].ChosenThemes.Count < numSelections) { myPlayer = myGame.Players[i]; break; } } if (myPlayer == null) myPlayer = myGame.Players[0]; // on détermine si l'on doit afficher les scores. for (int i = 0; i < myGame.NumPlayers; i++) { if (myGame.Players[i].Score > 0) { displayScores = true; break; } } } else throw new Exception("Pas de joueur?"); ImagePart[] labelTextures = myStyle.LabelsTextures; ImagePart[] playersNamesTextures = myStyle.PlayersNamesTextures; ImagePart[] playersPicsTextures = myStyle.PlayersPicsTextures; float themesLabelsBottomSpace = myStyle.ThemesLabelsBottomSpace; float themesListRightSpace = myStyle.ThemesListRightSpace; float playersSpace = myStyle.PlayersSpace; Vector2f picsSize = myStyle.PicsSize; Font font = myStyle.Font; uint fontSize = myStyle.FontSize; myUIManager = new UIManager(myApp.window); DCFont myFont = new DCFont(font); // Layout principal contenant tout le reste mainLayout = new HorizontalLayout(myUIManager, null); mainLayout.Visible = true; // Affichage des thèmes { themesLayout = new VerticalLayout(myUIManager, mainLayout); themesLayout.Visible = true; mainLayout.Add(themesLayout); for (int i = 0; i < myGame.NumThemes; i++) { HorizontalLayout themeHLayout = new HorizontalLayout(myUIManager, themesLayout); themeHLayout.Visible = true; themesLayout.Add(themeHLayout); themes.Add(themeHLayout); if (!myGame.IsThemeAvalaible(myGame.GetTheme(i))) themeHLayout.Tint = new Color(125, 125, 125); // Frame contenant le nom du thème { Frame themeFrame = new Frame(myUIManager, themeHLayout); themeFrame.BordersImagesParts = myStyle.LabelsTextures; themeFrame.Visible = true; themeHLayout.Add(themeFrame); Label themesNamelabel = new Label(myUIManager, themeFrame, myFont, myGame.GetTheme(i).Name + " " + myGame.GetTheme(i).Points.ToString(), fontSize); themesNamelabel.Tint = Color.White; themesNamelabel.Visible = true; themeFrame.ContainedWidget = themesNamelabel; } if (i < myGame.NumThemes - 1) { VerticalSpacer sp = new VerticalSpacer(myUIManager, themesLayout, themesLabelsBottomSpace); sp.Visible = true; themesLayout.Add(sp); } } } // Ajout d'un spacer HorizontalSpacer msp = new HorizontalSpacer(myUIManager, mainLayout, themesListRightSpace); msp.Visible = true; mainLayout.Add(msp); // Affichage des noms des joueurs (éventuellement leurs scores) { playersLayout = new HorizontalLayout(myUIManager, mainLayout); playersLayout.Visible = true; mainLayout.Add(playersLayout); for (int i = 0; i < myGame.NumPlayers; i++) { Player player = myGame.Players[i]; VerticalLayout playerVLayout = new VerticalLayout(myUIManager, playersLayout); playerVLayout.Alignment = HorizontalAlignment.Center; playerVLayout.Visible = true; playersLayout.Add(playerVLayout); // Chargement de la photo du joueur { Frame photoFrame = new Frame(myUIManager, playerVLayout); ; photoFrame.BordersImagesParts = playersPicsTextures; photoFrame.Visible = true; playerVLayout.Add(photoFrame); Caption playerCaption = new Caption(myUIManager, photoFrame); playerCaption.Visible = true; Texture tex = new Texture(player.PhotoSrc); ImagePart img = new ImagePart(tex); playerCaption.ImagePart = img; playerCaption.Size = picsSize; // ajout de la photo photoFrame.ContainedWidget = playerCaption; } // Ajout d'un spacer VerticalSpacer vsp = new VerticalSpacer(myUIManager, playerVLayout, 5f); vsp.Visible = true; playerVLayout.Add(vsp); // Affichage du score du joueur { Frame playerNameFrame = new Frame(myUIManager, playerVLayout); playerNameFrame.BordersImagesParts = playersNamesTextures; playerNameFrame.Visible = true; playerVLayout.Add(playerNameFrame); string str = player.Name; if (displayScores) str += " " + player.Score.ToString(); Label scoreLabel = new Label(myUIManager, playerNameFrame, myFont, str, fontSize); playersScoresLabels.Add(scoreLabel); if (player == myPlayer) scoreLabel.Tint = myStyle.FontHoveredColor; else scoreLabel.Tint = myStyle.FontNormalColor; scoreLabel.Visible = true; playerNameFrame.ContainedWidget = scoreLabel; } // on ajoute le spacer horizontal que si on ajoute pas le dernier joueur if( i < myGame.NumPlayers-1 ) { HorizontalSpacer sp = new HorizontalSpacer(myUIManager, playersLayout, playersSpace); sp.Visible = true; playersLayout.Add(sp); } } } currentChoice = myGame.GetNextAcceptableChoice(-1); ChangeChoice(); // centrage du layout principal mainLayout.CenterPosition = new Vector2f(myApp.window.Size.X / 2f, myApp.window.Size.Y / 2f); }
public BlindTest(GameApplication app, Player player, Song song) : base(app, player, song) { player.DidBlindTest = true; }
public SongTest(GameApplication app, Player player, Song song) { myApp = app; myPlayer = player; mySong = song; }
public SongSelectionMenu(GameApplication app, Player player, Theme theme) { myApp = app; myPlayer = player; myTheme = theme; }