public void Build() { int offSetY = 5; Children = new List<View>(); congratulationView = new LabelView("Tillykke !!!") { X = (Width * 0.5) - ((this.Width * 0.65) / 2), Y = offSetY, Width = this.Width * 0.65, Height = this.Height * 0.20 }; descriptionView = new LabelView("Du har gennemført kategorien: " + Category.Name + (isLastCategory ? " \nog dermed gennemført hele spillet!" : "")) { X = (Width * 0.5) - ((congratulationView.Width * 0.75) * 0.5), Y = offSetY + congratulationView.Height, Width = congratulationView.Width * 0.75, Height = congratulationView.Height / 2 }; Children.Add(congratulationView); Children.Add(descriptionView); PlayerListView badgeDic = new PlayerListView(Width, Height); badgeView = null; if (badgeDic.badgeDictionary.ContainsKey(Category.Badge)) { badgeView = new ImageView(badgeDic.badgeDictionary[Category.Badge], Width * 0.25, Width * 0.25) { X = Width / 2 - ((Width * 0.25) / 2), Y = Height * 0.40 }; Children.Add(badgeView); } MenuButton = new ButtonView("Menu", () => { if (OnExit != null) OnExit(); }) { X = badgeView.X + (badgeView.Width / 2) - 115, Y = Height - 50, Width = 105, Height = 35, BackgroundColor = new Color(192, 57, 43), TextColor = new Color(255, 255, 255) }; if (isLastCategory == false) { nextCategory = new ButtonView("Næste", () => { if (OnNext != null) OnNext(); }) { X = badgeView.X + (badgeView.Width / 2) + 10, Y = Height - 50, Width = 105, Height = 35, TextColor = new Color(255, 255, 255), BackgroundColor = new Color(40, 120, 130) }; Children.Add(nextCategory); } Children.Add(MenuButton); }
public void Build(GameModel game) { CurrentPlayer user = game.User; IEnumerable<Player> players = game.Players; BackgroundColor = new Color(255, 255, 255); WelcomeText = new LabelView("Velkommen " + user.PlayerName) { X = 10, Y = 10, Height = 50, Width = 220 }; BadgesView = new CompositeView(220, 40) { X = WelcomeText.X, Y = WelcomeText.Y + WelcomeText.Height }; BadgeInfoText = new LabelView("Badges: ") { Width = 100, Height = 20, X = -10 }; BadgesView.Add(BadgeInfoText); if (user.Badges != null) { // start spacing half the width of a badge int spacing = -10; foreach (BadgeName badge in user.Badges) { if (PlayerView.badgeDictionary.ContainsKey(badge)) { BadgesView.Add(new ImageView(PlayerView.badgeDictionary[badge], 25, 25) { X = BadgeInfoText.X + BadgeInfoText.Width + spacing, }); } spacing += 30; } } VectorImageView playIcon = new VectorImageView(0, 0, 100, 100) { { 25,25 }, { 75,50 }, { 25,75 } }; LogoutButton = new ButtonView("Log ud", () => { if (OnLogout != null) { OnLogout(); } }) { Width = 50, Height = 15, TextColor = new Color(255, 255, 255), BackgroundColor = new Color(193, 57, 43) }; playIcon.BackgroundColor = new Color(255, 255, 255); PlayButton = new CompositeView(100, 100) { playIcon, }; PlayButton.BackgroundColor = new Color(39, 174, 97); PlayButton.X = 10; PlayButton.Y = BadgesView.Y + BadgesView.Height; VectorImageView levelIcon1 = new VectorImageView(0, 0, 100, 100) { { 20,20 }, { 45,20 }, { 45,45 }, { 20,45 }, { 20,20 }, }; VectorImageView levelIcon2 = new VectorImageView(0, 0, 100, 100) { { 80,20 }, { 80,45 }, { 55,45 }, { 55,20 }, { 80,20 }, }; VectorImageView levelIcon3 = new VectorImageView(0, 0, 100, 100) { { 80,80 }, { 55,80 }, { 55,55 }, { 80,55 }, { 80,80 }, }; VectorImageView levelIcon4 = new VectorImageView(0, 0, 100, 100) { { 20,80 }, { 20,55 }, { 45,55 }, { 45,80 }, { 20,80 }, }; levelIcon1.BackgroundColor = new Color(255, 255, 255); levelIcon2.BackgroundColor = new Color(255, 255, 255); levelIcon3.BackgroundColor = new Color(255, 255, 255); levelIcon4.BackgroundColor = new Color(255, 255, 255); LevelButton = new CompositeView(100, 100) { levelIcon1, levelIcon2, levelIcon3, levelIcon4, }; LevelButton.BackgroundColor = new Color(42, 128, 185); LevelButton.X = PlayButton.X + PlayButton.Width + 20; LevelButton.Y = BadgesView.Y + BadgesView.Height; PlayerList = new PlayerListView(players, 160, 200) { X = LevelButton.X + LevelButton.Width + 20, Y = WelcomeText.Y }; Children = new List<View>(){ LogoutButton, WelcomeText, LevelButton, PlayerList, PlayButton, BadgesView }; }