private void OnClickStart(HUDIconTextButton sender, HUDButtonEventArgs e) { UpdateHostData(); _server.Mode = SAMNetworkConnection.ServerMode.InLobby; MainGame.Inst.Profile.LastMultiplayerHostedLevel = _server.LevelID; MainGame.Inst.Profile.LastMultiplayerHostedSpeed = _server.Speed; MainGame.Inst.SaveProfile(); _btnCreate.Icon = Textures.CannonCogBig; _speed1.IsEnabled = false; _speed2.IsEnabled = false; _speed3.IsEnabled = false; _speed4.IsEnabled = false; _speed5.IsEnabled = false; _music1.IsEnabled = false; _music2.IsEnabled = false; _music3.IsEnabled = false; _music4.IsEnabled = false; _music5.IsEnabled = false; _music6.IsEnabled = false; }
private void OnClickCreateLobby(HUDIconTextButton sender, HUDButtonEventArgs e) { _server.LevelID = _currentLevel.UniqueID; if (_music1.Selected) { _server.MusicIndex = _music1.MusicIndex; } if (_music2.Selected) { _server.MusicIndex = _music2.MusicIndex; } if (_music3.Selected) { _server.MusicIndex = _music3.MusicIndex; } if (_music4.Selected) { _server.MusicIndex = _music4.MusicIndex; } if (_music5.Selected) { _server.MusicIndex = _music5.MusicIndex; } if (_music6.Selected) { _server.MusicIndex = _music6.MusicIndex; } if (_speed1.Selected) { _server.Speed = _speed1.Speed; } if (_speed2.Selected) { _server.Speed = _speed2.Speed; } if (_speed3.Selected) { _server.Speed = _speed3.Speed; } if (_speed4.Selected) { _server.Speed = _speed4.Speed; } if (_speed5.Selected) { _server.Speed = _speed5.Speed; } _server.CreateSession(BlueprintAnalyzer.PlayerCount(_currentLevel)); MainGame.Inst.Profile.LastMultiplayerHostedLevel = _server.LevelID; MainGame.Inst.Profile.LastMultiplayerHostedSpeed = _server.Speed; MainGame.Inst.SaveProfile(); _btnCreate.Icon = Textures.CannonCogBig; }
private void DoUpload(HUDIconTextButton sender, HUDButtonEventArgs e) { var waitDialog = new HUDIconMessageBox { L10NText = L10NImpl.STR_LVLED_UPLOADING, TextColor = FlatColors.TextHUD, Background = HUDBackgroundDefinition.CreateRounded(FlatColors.BelizeHole, 16), IconColor = FlatColors.Clouds, Icon = Textures.CannonCogBig, RotationSpeed = 1f, CloseOnClick = false, }; HUD.AddModal(waitDialog, false, 0.7f); DoUploadInternal(waitDialog).RunAsync(); }
public override void OnInitialize() { base.OnInitialize(); AddElement(new HUDLabel(1) { TextAlignment = HUDAlignment.CENTER, Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint(0, 0), Size = new FSize(WIDTH, 96), Font = Textures.HUDFontBold, FontSize = 64, L10NText = _server.ConnType == MultiplayerConnectionType.PROXY ? L10NImpl.STR_MENU_CAP_CGAME_PROX : L10NImpl.STR_MENU_CAP_CGAME_P2P, TextColor = FlatColors.Clouds, }); AddElement(new MultiplayerConnectionStateControl(_server) { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint(16, 16) }); var screen = new GDGameScreen_Display(MainGame.Inst, MainGame.Inst.Graphics, _currentLevel); AddElement(_displayScreen = new HUDSubScreenProxyRenderer(screen) { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint((2 / 3f) * GDConstants.TILE_WIDTH, 3.25f * GDConstants.TILE_WIDTH), Size = new FSize(6 * GDConstants.TILE_WIDTH, 3.75f * GDConstants.TILE_WIDTH), }); AddElement(new HUDImageButton { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint((5 / 6f) * GDConstants.TILE_WIDTH, 2.25f * GDConstants.TILE_WIDTH), Size = new FSize(32, 48), Image = Textures.TexHUDIconChevronLeft, ImagePadding = 4, BackgroundNormal = HUDBackgroundDefinition.CreateRounded(FlatColors.ButtonHUD, 8f, true, false, true, false), BackgroundPressed = HUDBackgroundDefinition.CreateRounded(FlatColors.ButtonPressedHUD, 8f, true, false, true, false), Click = (s, a) => ChangeID1(-1), }); AddElement(_lblLevelID1 = new HUDClickableLabel { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint((8 / 6f) * GDConstants.TILE_WIDTH, 2.25f * GDConstants.TILE_WIDTH), Size = new FSize(96, 48), FontSize = 48, Font = Textures.HUDFontRegular, Text = "?", TextAlignment = HUDAlignment.CENTER, TextColor = FlatColors.Clouds, Background = HUDBackgroundDefinition.CreateSimple(FlatColors.BackgroundHUD2), Click = (s, a) => ChangeID1(+1), ClickSound = true, }); AddElement(new HUDImageButton { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint((17 / 6f) * GDConstants.TILE_WIDTH, 2.25f * GDConstants.TILE_WIDTH), Size = new FSize(32, 48), Image = Textures.TexHUDIconChevronRight, ImagePadding = 4, BackgroundNormal = HUDBackgroundDefinition.CreateRounded(FlatColors.ButtonHUD, 8f, false, true, false, true), BackgroundPressed = HUDBackgroundDefinition.CreateRounded(FlatColors.ButtonPressedHUD, 8f, false, true, false, true), Click = (s, a) => ChangeID1(+1), }); AddElement(new HUDImageButton { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint((24 / 6f) * GDConstants.TILE_WIDTH, 2.25f * GDConstants.TILE_WIDTH), Size = new FSize(32, 48), Image = Textures.TexHUDIconChevronLeft, ImagePadding = 4, BackgroundNormal = HUDBackgroundDefinition.CreateRounded(FlatColors.ButtonHUD, 8f, true, false, true, false), BackgroundPressed = HUDBackgroundDefinition.CreateRounded(FlatColors.ButtonPressedHUD, 8f, true, false, true, false), Click = (s, a) => ChangeID2(-1), }); AddElement(_lblLevelID2 = new HUDClickableLabel { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint((27 / 6f) * GDConstants.TILE_WIDTH, 2.25f * GDConstants.TILE_WIDTH), Size = new FSize(96, 48), FontSize = 48, Font = Textures.HUDFontRegular, Text = "?", TextAlignment = HUDAlignment.CENTER, TextColor = FlatColors.Clouds, Background = HUDBackgroundDefinition.CreateSimple(FlatColors.BackgroundHUD2), Click = (s, a) => ChangeID2(+1), ClickSound = true, }); AddElement(new HUDImageButton { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint((36 / 6f) * GDConstants.TILE_WIDTH, 2.25f * GDConstants.TILE_WIDTH), Size = new FSize(32, 48), Image = Textures.TexHUDIconChevronRight, ImagePadding = 4, BackgroundNormal = HUDBackgroundDefinition.CreateRounded(FlatColors.ButtonHUD, 8f, false, true, false, true), BackgroundPressed = HUDBackgroundDefinition.CreateRounded(FlatColors.ButtonPressedHUD, 8f, false, true, false, true), Click = (s, a) => ChangeID2(+1), }); AddElement(new HUDLambdaLabel { TextAlignment = HUDAlignment.BOTTOMLEFT, Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(100 + 8, 375), Size = new FSize(200, 32), Font = Textures.HUDFontRegular, FontSize = 32, Lambda = () => L10N.TF(L10NImpl.STR_MENU_MP_LOBBY_USER_FMT, _levelUserCount), TextColor = Color.White, }); AddElement(new HUDLabel { TextAlignment = HUDAlignment.BOTTOMLEFT, Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(100 + 8, 331), Size = new FSize(200, 32), Font = Textures.HUDFontRegular, FontSize = 32, L10NText = L10NImpl.STR_MENU_MP_MUSIC, TextColor = Color.White, }); int initialMusic = FloatMath.GetRangedIntRandom(5); AddElement(_music1 = new HUDRadioMusicButton { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(37, 261), Size = new FSize(62, 62), MusicIndex = 0, Selected = initialMusic == 0, }); AddElement(_music2 = new HUDRadioMusicButton { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(109, 261), Size = new FSize(62, 62), MusicIndex = 1, Selected = initialMusic == 1, }); AddElement(_music3 = new HUDRadioMusicButton { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(179, 261), Size = new FSize(62, 62), MusicIndex = 2, Selected = initialMusic == 2, }); AddElement(_music4 = new HUDRadioMusicButton { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(249, 261), Size = new FSize(62, 62), MusicIndex = 3, Selected = initialMusic == 3, }); AddElement(_music5 = new HUDRadioMusicButton { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(319, 261), Size = new FSize(62, 62), MusicIndex = 4, Selected = initialMusic == 4, }); AddElement(_music6 = new HUDRadioMusicButton { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(389, 261), Size = new FSize(62, 62), MusicIndex = 5, Selected = initialMusic == 5, }); _music1.RadioGroup = new List <HUDRadioMusicButton> { _music1, _music2, _music3, _music4, _music5, _music6 }; _music2.RadioGroup = new List <HUDRadioMusicButton> { _music1, _music2, _music3, _music4, _music5, _music6 }; _music3.RadioGroup = new List <HUDRadioMusicButton> { _music1, _music2, _music3, _music4, _music5, _music6 }; _music4.RadioGroup = new List <HUDRadioMusicButton> { _music1, _music2, _music3, _music4, _music5, _music6 }; _music5.RadioGroup = new List <HUDRadioMusicButton> { _music1, _music2, _music3, _music4, _music5, _music6 }; _music6.RadioGroup = new List <HUDRadioMusicButton> { _music1, _music2, _music3, _music4, _music5, _music6 }; var initialSpeed = MainGame.Inst.Profile.LastMultiplayerHostedSpeed; AddElement(new HUDLabel { TextAlignment = HUDAlignment.BOTTOMLEFT, Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(100 + 8, 221), Size = new FSize(200, 32), Font = Textures.HUDFontRegular, FontSize = 32, L10NText = L10NImpl.STR_MENU_MP_GAMESPEED, TextColor = Color.White, }); AddElement(_speed1 = new HUDRadioSpeedButton { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(37, 150), Size = new FSize(62, 62), Speed = GameSpeedModes.SUPERSLOW, Selected = initialSpeed == GameSpeedModes.SUPERSLOW, }); AddElement(_speed2 = new HUDRadioSpeedButton { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(109, 150), Size = new FSize(62, 62), Speed = GameSpeedModes.SLOW, Selected = initialSpeed == GameSpeedModes.SLOW, }); AddElement(_speed3 = new HUDRadioSpeedButton { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(179, 150), Size = new FSize(62, 62), Speed = GameSpeedModes.NORMAL, Selected = initialSpeed == GameSpeedModes.NORMAL, }); AddElement(_speed4 = new HUDRadioSpeedButton { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(249, 150), Size = new FSize(62, 62), Speed = GameSpeedModes.FAST, Selected = initialSpeed == GameSpeedModes.FAST, }); AddElement(_speed5 = new HUDRadioSpeedButton { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(319, 150), Size = new FSize(62, 62), Speed = GameSpeedModes.SUPERFAST, Selected = initialSpeed == GameSpeedModes.SUPERFAST, }); _speed1.RadioGroup = new List <HUDRadioSpeedButton> { _speed1, _speed2, _speed3, _speed4, _speed5 }; _speed2.RadioGroup = new List <HUDRadioSpeedButton> { _speed1, _speed2, _speed3, _speed4, _speed5 }; _speed3.RadioGroup = new List <HUDRadioSpeedButton> { _speed1, _speed2, _speed3, _speed4, _speed5 }; _speed4.RadioGroup = new List <HUDRadioSpeedButton> { _speed1, _speed2, _speed3, _speed4, _speed5 }; _speed5.RadioGroup = new List <HUDRadioSpeedButton> { _speed1, _speed2, _speed3, _speed4, _speed5 }; AddElement(new HUDRectangle(0) { Alignment = HUDAlignment.BOTTOMRIGHT, Size = new FSize(WIDTH, FOOTER_HEIGHT), Definition = HUDBackgroundDefinition.CreateRounded(FlatColors.BackgroundHUD2, 16, false, false, true, true), }); AddElement(_btnCreate = new HUDIconTextButton(2) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(0.5f * GDConstants.TILE_WIDTH, 0.5f * GDConstants.TILE_WIDTH), Size = new FSize(5.5f * GDConstants.TILE_WIDTH, 1.0f * GDConstants.TILE_WIDTH), Icon = null, IconRotationSpeed = 0.25f, L10NText = L10NImpl.STR_MENU_MP_CREATE, TextColor = Color.White, Font = Textures.HUDFontBold, FontSize = 55, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, BackgroundNormal = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.PeterRiver, 16), BackgroundPressed = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.BelizeHole, 16), Click = OnClickCreateLobby, }); AddElement(new HUDTextButton(2) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(0.5f * GDConstants.TILE_WIDTH, 0.5f * GDConstants.TILE_WIDTH), Size = new FSize(5.5f * GDConstants.TILE_WIDTH, 1.0f * GDConstants.TILE_WIDTH), L10NText = L10NImpl.STR_MENU_CANCEL, TextColor = Color.White, Font = Textures.HUDFontBold, FontSize = 55, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, BackgroundNormal = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.Asbestos, 16), BackgroundPressed = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.MidnightBlue, 16), Click = OnClickCancel, }); //--------------------- if (!Levels.LEVELS.TryGetValue(MainGame.Inst.Profile.LastMultiplayerHostedLevel, out _currentLevel)) { _currentLevel = Levels.LEVELS[Levels.LEVELID_1_3]; } _currentWorld = Levels.WORLDS_MULTIPLAYER.FirstOrDefault(w => w.AllNodes.Any(n => n.ConnectionID == _currentLevel.UniqueID)); if (_currentWorld == null) { _currentWorld = Levels.WORLD_001; _currentLevel = Levels.LEVELS[Levels.LEVELID_1_3]; } UpdateLabels(); }
public override void OnInitialize() { base.OnInitialize(); #region Footer AddElement(new HUDRectangle(0) { Alignment = HUDAlignment.BOTTOMRIGHT, Size = new FSize(WIDTH, FOOTER_HEIGHT - 10), Definition = HUDBackgroundDefinition.CreateRounded(FlatColors.BackgroundHUD2, 16, false, false, true, true), }); AddElement(new HUDRectangle(2) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(0, FOOTER_HEIGHT - FOOTER_COLBAR_HEIGHT), Size = new FSize(WIDTH / 3f, FOOTER_COLBAR_HEIGHT), Definition = HUDBackgroundDefinition.CreateSimple(FlatColors.Nephritis), }); AddElement(new HUDRectangle(1) { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(0, FOOTER_HEIGHT - FOOTER_COLBAR_HEIGHT), Size = new FSize(WIDTH / 2f, FOOTER_COLBAR_HEIGHT), Definition = HUDBackgroundDefinition.CreateSimple(FlatColors.PeterRiver), }); AddElement(new HUDRectangle(2) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(0, FOOTER_HEIGHT - FOOTER_COLBAR_HEIGHT), Size = new FSize(WIDTH / 3f, FOOTER_COLBAR_HEIGHT), Definition = HUDBackgroundDefinition.CreateSimple(FlatColors.Pomegranate), }); AddElement(new HUDSeperator(HUDOrientation.Vertical, 3) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(WIDTH / 3f, 0), Size = new FSize(1, FOOTER_HEIGHT), Color = FlatColors.SeperatorHUD, }); AddElement(new HUDSeperator(HUDOrientation.Vertical, 3) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(WIDTH / 3f, 0), Size = new FSize(1, FOOTER_HEIGHT), Color = FlatColors.SeperatorHUD, }); AddElement(new HUDLabel(2) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(0, 77), Size = new FSize(WIDTH / 3f, 40), TextAlignment = HUDAlignment.BOTTOMCENTER, L10NText = L10NImpl.STR_HSP_LEVEL, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontRegular, FontSize = 35, }); AddElement(new HUDLabel(2) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(0, 15), Size = new FSize(WIDTH / 3f, 60), Text = Level.Name, TextAlignment = HUDAlignment.BOTTOMCENTER, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontBold, FontSize = 57, }); AddElement(new HUDLabel(2) { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(0, 77), Size = new FSize(WIDTH / 3f, 40), TextAlignment = HUDAlignment.BOTTOMCENTER, L10NText = L10NImpl.STR_HSP_MPPOINTS, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontRegular, FontSize = 35, }); AddElement(new HUDIncrementIndicatorLabel(profile.MultiplayerPoints.ToString(), (successScreen ? "+" : "-") + Math.Abs(_deltaPoints), 2) { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(0, 15), Size = new FSize(WIDTH / 3f, 60), TextAlignment = HUDAlignment.BOTTOMCENTER, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontBold, FontSize = 57, }); AddElement(_loadingCog = new HUDImage(2) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(0, 16), Size = new FSize(WIDTH / 3f, 80), Image = Textures.CannonCogBig, RotationSpeed = 0.3f, Color = FlatColors.TextHUD, ImageAlignment = HUDImageAlignment.UNDERSCALE, IsVisible = false, }); #endregion #region Buttons AddElement(new HUDIconTextButton(2) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(24, FOOTER_HEIGHT + 24), Size = new FSize(3.5f * GDConstants.TILE_WIDTH, 60), L10NText = L10NImpl.STR_HSP_BACK, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 55, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, Icon = Textures.TexIconBack, BackgroundNormal = HUDBackgroundDefinition.CreateRounded(FlatColors.ButtonHUD, 16), BackgroundPressed = HUDBackgroundDefinition.CreateRounded(FlatColors.ButtonPressedHUD, 16), Click = (s, a) => { _server.KillSession(); _server.Stop(); GDScreen.ExitToMap(); }, }); if (_server.SessionUserID == 0 && _server.Mode != SAMNetworkConnection.ServerMode.Stopped && _server.Mode != SAMNetworkConnection.ServerMode.Error) { AddElement(_btnRand = new HUDIconTextButton(2) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(24, FOOTER_HEIGHT + 90), Size = new FSize(6f * GDConstants.TILE_WIDTH, 60), L10NText = L10NImpl.STR_HSP_RANDOMGAME, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 55, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, Icon = Textures.TexIconDice, BackgroundNormal = HUDBackgroundDefinition.CreateRounded(FlatColors.Wisteria, 16), BackgroundPressed = HUDBackgroundDefinition.CreateRounded(FlatColors.Amethyst, 16), Click = (s, a) => OnRandomLevel(), }); AddElement(_btnNext = new HUDIconTextButton(2) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(24, FOOTER_HEIGHT + 24), Size = new FSize(6f * GDConstants.TILE_WIDTH, 60), L10NText = L10NImpl.STR_HSP_NEWGAME, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 55, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, Icon = Textures.TexIconRedo, BackgroundNormal = HUDBackgroundDefinition.CreateRounded(FlatColors.SunFlower, 16), BackgroundPressed = HUDBackgroundDefinition.CreateRounded(FlatColors.Orange, 16), Click = (s, a) => OnNextLevel(), }); } #endregion #region Icons AddElement(new HUDMultiplayerDifficultyButton(2, successScreen, 0) { Alignment = HUDAlignment.TOPLEFT, Size = new FSize(ICON_SIZE, ICON_SIZE), RelativePosition = new FPoint(1 * ICON_MARGIN + 0 * ICON_SIZE, ICON_MARGIN), IsEnabled = false, }); AddElement(new HUDMultiplayerDifficultyButton(2, successScreen, 1) { Alignment = HUDAlignment.TOPLEFT, Size = new FSize(ICON_SIZE, ICON_SIZE), RelativePosition = new FPoint(3 * ICON_MARGIN + 1 * ICON_SIZE, ICON_MARGIN), IsEnabled = false, }); AddElement(new HUDMultiplayerDifficultyButton(2, successScreen, 2) { Alignment = HUDAlignment.TOPLEFT, Size = new FSize(ICON_SIZE, ICON_SIZE), RelativePosition = new FPoint(5 * ICON_MARGIN + 2 * ICON_SIZE, ICON_MARGIN), IsEnabled = false, }); AddElement(new HUDMultiplayerDifficultyButton(2, successScreen, 3) { Alignment = HUDAlignment.TOPLEFT, Size = new FSize(ICON_SIZE, ICON_SIZE), RelativePosition = new FPoint(7 * ICON_MARGIN + 3 * ICON_SIZE, ICON_MARGIN), IsEnabled = false, }); #endregion }
public override void OnInitialize() { base.OnInitialize(); #region Footer AddElement(new HUDRectangle(0) { Alignment = HUDAlignment.BOTTOMRIGHT, Size = new FSize(WIDTH, FOOTER_HEIGHT - 10), Definition = HUDBackgroundDefinition.CreateRounded(FlatColors.BackgroundHUD2, 16, false, false, true, true), }); AddElement(new HUDRectangle(2) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(0, FOOTER_HEIGHT - FOOTER_COLBAR_HEIGHT), Size = new FSize(WIDTH / 3f, FOOTER_COLBAR_HEIGHT), Definition = HUDBackgroundDefinition.CreateSimple(FlatColors.Nephritis), }); AddElement(new HUDRectangle(1) { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(0, FOOTER_HEIGHT - FOOTER_COLBAR_HEIGHT), Size = new FSize(WIDTH / 2f, FOOTER_COLBAR_HEIGHT), Definition = HUDBackgroundDefinition.CreateSimple(FlatColors.PeterRiver), }); AddElement(new HUDRectangle(2) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(0, FOOTER_HEIGHT - FOOTER_COLBAR_HEIGHT), Size = new FSize(WIDTH / 3f, FOOTER_COLBAR_HEIGHT), Definition = HUDBackgroundDefinition.CreateSimple(FlatColors.Pomegranate), }); AddElement(new HUDSeperator(HUDOrientation.Vertical, 3) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(WIDTH / 3f, 0), Size = new FSize(1, FOOTER_HEIGHT), Color = FlatColors.SeperatorHUD, }); AddElement(new HUDSeperator(HUDOrientation.Vertical, 3) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(WIDTH / 3f, 0), Size = new FSize(1, FOOTER_HEIGHT), Color = FlatColors.SeperatorHUD, }); AddElement(new HUDLabel(2) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(0, 77), Size = new FSize(WIDTH / 3f, 40), TextAlignment = HUDAlignment.BOTTOMCENTER, L10NText = L10NImpl.STR_HSP_LEVEL, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontRegular, FontSize = 35, }); AddElement(new HUDLabel(2) { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(0, 77), Size = new FSize(WIDTH / 3f, 40), TextAlignment = HUDAlignment.BOTTOMCENTER, L10NText = L10NImpl.STR_HSP_POINTS, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontRegular, FontSize = 35, }); AddElement(new HUDLabel(2) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(0, 77), Size = new FSize(WIDTH / 3f, 40), TextAlignment = HUDAlignment.BOTTOMCENTER, L10NText = L10NImpl.STR_HSP_TIME_BEST, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontRegular, FontSize = 35, }); AddElement(new HUDLabel(2) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(0, 15), Size = new FSize(WIDTH / 3f, 60), L10NText = L10NImpl.STR_HSP_TUTORIAL, TextAlignment = HUDAlignment.BOTTOMCENTER, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontBold, FontSize = 57, }); AddElement(new HUDIncrementIndicatorLabel(profile.TotalPoints.ToString(), increasePoints == 0 ? "" : "+" + increasePoints, 2) { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(0, 15), Size = new FSize(WIDTH / 3f, 60), TextAlignment = HUDAlignment.BOTTOMCENTER, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontBold, FontSize = 57, }); AddElement(new HUDLabel(2) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(0, 15), Size = new FSize(WIDTH / 3f, 60), Text = profile.GetLevelData(Levels.LEVEL_TUTORIAL).GetTimeString(FractionDifficulty.DIFF_0, true), TextAlignment = HUDAlignment.BOTTOMCENTER, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontBold, FontSize = 57, }); #endregion #region Buttons //AddElement(btnMenu = new HUDIconTextButton(2) //{ // Alignment = HUDAlignment.BOTTOMLEFT, // RelativePosition = new FPoint(24, FOOTER_HEIGHT + 24), // Size = new FSize(3.5f * GDConstants.TILE_WIDTH, 60), // // Text = "Back", // TextColor = Color.White, // Font = Textures.HUDFontRegular, // FontSize = 55, // TextAlignment = HUDAlignment.CENTER, // TextPadding = 8, // Icon = Textures.TexIconBack, // BackgroundType = HUDBackgroundType.Rounded, // Color = FlatColors.ButtonHUD, // ColorPressed = FlatColors.ButtonPressedHUD, //}); //btnMenu.ButtonClick += (s, a) => MainGame.Inst.SetWorldMapScreen(GDScreen.WorldBlueprint, GDScreen.Blueprint.UniqueID); AddElement(btnPlay = new HUDIconTextButton(2) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(24, FOOTER_HEIGHT + 24), Size = new FSize(7f * GDConstants.TILE_WIDTH, 60), L10NText = L10NImpl.STR_HSP_GETSTARTED, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 55, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, Icon = Textures.TexIconNext, BackgroundNormal = HUDBackgroundDefinition.CreateRounded(FlatColors.Nephritis, 16), BackgroundPressed = HUDBackgroundDefinition.CreateRounded(FlatColors.Emerald, 16), Click = (s, a) => MainGame.Inst.SetWorldMapScreenWithTransition(Levels.WORLD_001), }); #endregion #region Icons AddElement(new HUDTutorialDifficultyButton(2) { Alignment = HUDAlignment.TOPLEFT, Size = new FSize(ICON_SIZE, ICON_SIZE), RelativePosition = new FPoint(1 * ICON_MARGIN + 0 * ICON_SIZE, ICON_MARGIN) }); AddElement(new HUDTutorialDifficultyButton(2) { Alignment = HUDAlignment.TOPLEFT, Size = new FSize(ICON_SIZE, ICON_SIZE), RelativePosition = new FPoint(3 * ICON_MARGIN + 1 * ICON_SIZE, ICON_MARGIN) }); AddElement(new HUDTutorialDifficultyButton(2) { Alignment = HUDAlignment.TOPLEFT, Size = new FSize(ICON_SIZE, ICON_SIZE), RelativePosition = new FPoint(5 * ICON_MARGIN + 2 * ICON_SIZE, ICON_MARGIN) }); AddElement(new HUDTutorialDifficultyButton(2) { Alignment = HUDAlignment.TOPLEFT, Size = new FSize(ICON_SIZE, ICON_SIZE), RelativePosition = new FPoint(7 * ICON_MARGIN + 3 * ICON_SIZE, ICON_MARGIN) }); #endregion }
public override void OnInitialize() { base.OnInitialize(); #region Header AddElement(new HUDLabel { Alignment = HUDAlignment.TOPCENTER, RelativePosition = new FPoint(0, 0), Size = new FSize(WIDTH, 48), TextAlignment = HUDAlignment.CENTER, Text = LevelMeta.LevelName, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontBold, FontSize = 48, }); #endregion #region Icons AddElement(_diffButton0 = new EnhancedHUDDifficultyButton(2, FractionDifficulty.DIFF_0, () => SelectDiff(FractionDifficulty.DIFF_0)) { Active = MainGame.Inst.Profile.HasCustomLevelBeaten(LevelMeta.OnlineID, FractionDifficulty.DIFF_0), Selected = FractionDifficulty.DIFF_0 == SelectedDifficulty, Alignment = HUDAlignment.TOPLEFT, Size = new FSize(ICON_SIZE, ICON_SIZE), RelativePosition = new FPoint(1 * ICON_MARGIN + 0 * ICON_SIZE, ICON_MARGIN + 32) }); AddElement(_diffButton1 = new EnhancedHUDDifficultyButton(2, FractionDifficulty.DIFF_1, () => SelectDiff(FractionDifficulty.DIFF_1)) { Active = MainGame.Inst.Profile.HasCustomLevelBeaten(LevelMeta.OnlineID, FractionDifficulty.DIFF_1), Selected = FractionDifficulty.DIFF_1 == SelectedDifficulty, Alignment = HUDAlignment.TOPLEFT, Size = new FSize(ICON_SIZE, ICON_SIZE), RelativePosition = new FPoint(3 * ICON_MARGIN + 1 * ICON_SIZE, ICON_MARGIN + 32) }); AddElement(_diffButton2 = new EnhancedHUDDifficultyButton(2, FractionDifficulty.DIFF_2, () => SelectDiff(FractionDifficulty.DIFF_2)) { Active = MainGame.Inst.Profile.HasCustomLevelBeaten(LevelMeta.OnlineID, FractionDifficulty.DIFF_2), Selected = FractionDifficulty.DIFF_2 == SelectedDifficulty, Alignment = HUDAlignment.TOPLEFT, Size = new FSize(ICON_SIZE, ICON_SIZE), RelativePosition = new FPoint(5 * ICON_MARGIN + 2 * ICON_SIZE, ICON_MARGIN + 32) }); AddElement(_diffButton3 = new EnhancedHUDDifficultyButton(2, FractionDifficulty.DIFF_3, () => SelectDiff(FractionDifficulty.DIFF_3)) { Active = MainGame.Inst.Profile.HasCustomLevelBeaten(LevelMeta.OnlineID, FractionDifficulty.DIFF_3), Selected = FractionDifficulty.DIFF_3 == SelectedDifficulty, Alignment = HUDAlignment.TOPLEFT, Size = new FSize(ICON_SIZE, ICON_SIZE), RelativePosition = new FPoint(7 * ICON_MARGIN + 3 * ICON_SIZE, ICON_MARGIN + 32) }); #endregion #region Buttons AddElement(new HUDIconTextButton(2) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(24, FOOTER_HEIGHT + 24), Size = new FSize(3.5f * TW, 60), L10NText = L10NImpl.STR_HSP_BACK, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 55, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, Icon = Textures.TexIconBack, BackgroundNormal = HUDBackgroundDefinition.CreateRounded(FlatColors.ButtonHUD, 16), BackgroundPressed = HUDBackgroundDefinition.CreateRounded(FlatColors.ButtonPressedHUD, 16), Click = (s, a) => MainGame.Inst.SetOverworldScreenWithSCCM(SCCMMainPanel.SCCMTab.Hot), }); AddElement(_btnReplay = new HUDIconTextButton(2) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(24, FOOTER_HEIGHT + 24), Size = new FSize(3.5f * TW, 60), L10NText = L10NImpl.STR_HSP_AGAIN, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 55, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, Icon = Textures.TexIconRedo, BackgroundNormal = HUDBackgroundDefinition.CreateRounded(FlatColors.Nephritis, 16), BackgroundPressed = HUDBackgroundDefinition.CreateRounded(FlatColors.Emerald, 16), Click = (s, a) => Replay(SelectedDifficulty), }); #endregion #region Star AddElement(_btnStar = new HUDEllipseImageButton { Alignment = HUDAlignment.CENTER, RelativePosition = new FPoint(0, 4.25f), Size = new FSize(3f * TW, 3f * TW), Image = Textures.TexIconStar, ImageColor = (MainGame.Inst.Profile.HasCustomLevelStarred(LevelMeta.OnlineID) || LevelMeta.UserID == MainGame.Inst.Profile.OnlineUserID) ? FlatColors.SunFlower : FlatColors.BackgroundHUD, ImagePadding = 16f, BackgroundNormal = FlatColors.ButtonHUD, BackgroundPressed = FlatColors.ButtonPressedHUD, IsEnabled = (LevelMeta.UserID != MainGame.Inst.Profile.OnlineUserID), Click = (s, a) => ToggleStar(), }); AddElement(_lblStarCount = new HUDLabel(4) { Alignment = HUDAlignment.CENTER, RelativePosition = new FPoint(0, 4), Size = new FSize(4 * TW, 4 * TW), TextAlignment = HUDAlignment.CENTER, Text = LevelMeta.Stars.ToString(), TextColor = FlatColors.Foreground, Font = Textures.HUDFontBold, FontSize = 48, }); #endregion #region Footer AddElement(new HUDRectangle(0) { Alignment = HUDAlignment.BOTTOMRIGHT, Size = new FSize(WIDTH, FOOTER_HEIGHT - 10), Definition = HUDBackgroundDefinition.CreateRounded(FlatColors.BackgroundHUD2, 16, false, false, true, true), }); AddElement(new HUDRectangle(2) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(0, FOOTER_HEIGHT - FOOTER_COLBAR_HEIGHT), Size = new FSize(WIDTH / 3f, FOOTER_COLBAR_HEIGHT), Definition = HUDBackgroundDefinition.CreateSimple(FlatColors.Nephritis), }); AddElement(new HUDRectangle(1) { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(0, FOOTER_HEIGHT - FOOTER_COLBAR_HEIGHT), Size = new FSize(WIDTH / 2f, FOOTER_COLBAR_HEIGHT), Definition = HUDBackgroundDefinition.CreateSimple(FlatColors.PeterRiver), }); AddElement(new HUDRectangle(2) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(0, FOOTER_HEIGHT - FOOTER_COLBAR_HEIGHT), Size = new FSize(WIDTH / 3f, FOOTER_COLBAR_HEIGHT), Definition = HUDBackgroundDefinition.CreateSimple(FlatColors.Pomegranate), }); AddElement(new HUDSeperator(HUDOrientation.Vertical, 3) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(WIDTH / 3f, 0), Size = new FSize(1, FOOTER_HEIGHT), Color = FlatColors.SeperatorHUD, }); AddElement(new HUDSeperator(HUDOrientation.Vertical, 3) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(WIDTH / 3f, 0), Size = new FSize(1, FOOTER_HEIGHT), Color = FlatColors.SeperatorHUD, }); AddElement(new HUDLabel(2) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(0, 77), Size = new FSize(WIDTH / 3f, 40), TextAlignment = HUDAlignment.BOTTOMCENTER, L10NText = L10NImpl.STR_HSP_AUTHOR, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontRegular, FontSize = 35, }); AddElement(new HUDLabel(2) { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(0, 77), Size = new FSize(WIDTH / 3f, 40), TextAlignment = HUDAlignment.BOTTOMCENTER, L10NText = L10NImpl.STR_HSP_POINTS, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontRegular, FontSize = 35, }); AddElement(LabelTimeHeader = new HUDLabel(2) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(0, 77), Size = new FSize(WIDTH / 3f, 40), TextAlignment = HUDAlignment.BOTTOMCENTER, L10NText = L10NImpl.STR_HSP_TIME_NOW, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontRegular, FontSize = 35, }); AddElement(new HUDLabel(2) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(0, 15), Size = new FSize(WIDTH / 3f, 60), Text = LevelMeta.Username ?? "Unknown", WordWrap = HUDWordWrap.Ellipsis, TextAlignment = HUDAlignment.BOTTOMCENTER, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontBold, FontSize = 57, AutoFontSizeShrink = true, }); AddElement(new HUDIncrementIndicatorLabel(MainGame.Inst.Profile.ScoreSCCM.ToString(), _scoreGain == 0 ? "" : "+" + _scoreGain, 2) { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(0, 15), Size = new FSize(WIDTH / 3f, 60), TextAlignment = HUDAlignment.BOTTOMCENTER, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontBold, FontSize = 57, }); AddElement(LabelTimeValue = new HUDLabel(2) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(0, 15), Size = new FSize(WIDTH / 3f, 60), Text = TimeExtension.FormatMilliseconds(PersonalTimes[(int)SelectedDifficulty] ?? -1, false), TextAlignment = HUDAlignment.BOTTOMCENTER, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontBold, FontSize = 57, }); #endregion AddOperation(new HUDSCCMScorePanelTimeDisplayOperation()); UpdateTDMLabels(); }
public override void OnInitialize() { base.OnInitialize(); AddElement(new HUDLabel { Alignment = HUDAlignment.TOPCENTER, RelativePosition = new FPoint(0, 0), Size = new FSize(WIDTH, 48), TextAlignment = HUDAlignment.CENTER, Text = _level.FullName, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontBold, FontSize = 48, }); AddElement(_cannonCog = new HUDImage(1) { Alignment = HUDAlignment.CENTER, Size = new FSize(4.5f * TW, 4.5f * TW), RelativePosition = FPoint.Zero, Rotation = 0f, RotationSpeed = 0.5f, Image = Textures.CannonCogBig, Color = FlatColors.BackgroundHUD.Lighten(0.9f), }); AddElement(_centerLabel = new HUDLabel(3) { Alignment = HUDAlignment.CENTER, Size = new FSize(WIDTH, 2 * TW), RelativePosition = FPoint.Zero, TextAlignment = HUDAlignment.CENTER, FontSize = 128, L10NText = L10NImpl.STR_LVLED_UPLOADING, TextColor = FlatColors.Clouds, Font = Textures.HUDFontBold, }); AddElement(new HUDIconTextButton(2) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(24, 24), Size = new FSize(3.5f * TW, 60), L10NText = L10NImpl.STR_LVLED_BTN_ABORT, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 55, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, Icon = Textures.TexIconError, BackgroundNormal = HUDBackgroundDefinition.CreateRounded(FlatColors.Alizarin, 16), BackgroundPressed = HUDBackgroundDefinition.CreateRounded(FlatColors.Pomegranate, 16), Click = (s, a) => MainGame.Inst.SetOverworldScreen(), }); AddElement(_btnReupload = new HUDIconTextButton(2) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(24, 24), Size = new FSize(3.5f * TW, 60), L10NText = L10NImpl.STR_LVLED_BTN_RETRY, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 55, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, Icon = Textures.TexIconError, BackgroundNormal = HUDBackgroundDefinition.CreateRounded(FlatColors.Orange, 16), BackgroundPressed = HUDBackgroundDefinition.CreateRounded(FlatColors.SunFlower, 16), IsVisible = false, Click = (s, a) => StartUpload(), }); StartUpload(); }