private async Task CreateUserAndShowAnonPanel() { var waitDialog = new HUDIconMessageBox { Text = "Contacting server", TextColor = FlatColors.TextHUD, Background = HUDBackgroundDefinition.CreateRounded(FlatColors.BelizeHole, 16), IconColor = FlatColors.Clouds, Icon = Textures.CannonCogBig, RotationSpeed = 1f, CloseOnClick = false, }; MainGame.Inst.DispatchBeginInvoke(() => { AddModal(waitDialog, false, 0.7f); }); await MainGame.Inst.Backend.CreateUser(MainGame.Inst.Profile); waitDialog.Remove(); MainGame.Inst.DispatchBeginInvoke(() => { if (MainGame.Inst.Profile.AccountType == AccountType.Anonymous) { AddModal(new AnonymousAccountPanel(), true); } }); }
public override void OnInitialize() { AddElement(new HUDImage { RelativePosition = new FPoint(5, (Height - 25 - 32) / 2), Size = new FSize(32, 32), Alignment = HUDAlignment.TOPLEFT, Image = Textures.CannonCog, ImageAlignment = HUDImageAlignmentAlgorithm.CENTER, ImageScale = HUDImageScaleAlgorithm.STRETCH, RotationSpeed = 0.25f, Color = FlatColors.SunFlower, }); AddElement(new HUDTextButton { RelativePosition = new FPoint(5, 5), Size = new FSize(192, 32), Alignment = HUDAlignment.TOPRIGHT, L10NText = L10NImpl.STR_LVLED_BTN_EDIT, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 28, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, Click = OnEdit, BackgroundNormal = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth), BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth), }); }
public void DoPlayTest() { SetMode(LevelEditorMode.Mouse); LevelData.UpdateAndSave(this); var success = LevelData.ValidateWithToasts(HUD); if (success) { var waitDialog = new HUDIconMessageBox { L10NText = L10NImpl.STR_LVLED_COMPILING, 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); DoCompileAndTest(waitDialog).RunAsync(); } }
private async Task DoCompileAndTest(HUDElement spinner) { try { var lvl = await Task.Run(() => LevelData.CompileToBlueprint(HUD)); if (lvl == null) { return; } MonoSAMGame.CurrentInst.DispatchBeginInvoke(() => { spinner.Remove(); HUD.AddModal(new LevelEditorTestConfirmPanel(lvl, LevelData), true, 0.7f); }); } catch (Exception e) { SAMLog.Error("LEMP::DCAT", e); MonoSAMGame.CurrentInst.DispatchBeginInvoke(() => { spinner.Remove(); HUD.AddModal(new HUDFadeOutInfoBox(5, 2, 0.3f) { L10NText = L10NImpl.STR_CPP_COMERR, TextColor = FlatColors.Clouds, Background = HUDBackgroundDefinition.CreateRounded(FlatColors.Alizarin, 16), CloseOnClick = true, }, true); }); } }
public override void OnInitialize() { RelativePosition = new FPoint(0, 0); Size = new FSize(12 * GDConstants.TILE_WIDTH, 5 * GDConstants.TILE_WIDTH); Alignment = HUDAlignment.CENTER; AddElement(new HUDTextButton(1) { Alignment = HUDAlignment.CENTER, RelativePosition = new FPoint(0, 0), Size = new FSize(8 * GDConstants.TILE_WIDTH, 2 * GDConstants.TILE_WIDTH), L10NText = L10NImpl.STR_LVLED_BTN_DELLEVEL, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 75, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, BackgroundNormal = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.Alizarin, 16), BackgroundPressed = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.Pomegranate, 16), Click = DoDelete, }); }
private void OnLogin(HUDTextButton sender, HUDButtonEventArgs e) { if (editUsername.Text == "") { editUsername.AddOperation(new HUDTextBoxBlinkOperation(Color.Red)); return; } if (editPassword.Text == "") { editPassword.AddOperation(new HUDTextBoxBlinkOperation(Color.Red)); return; } var waitDialog = new HUDIconMessageBox { L10NText = L10NImpl.STR_AAP_LOGGINGIN, 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); DoLogin(waitDialog, editUsername.Text, editPassword.Text).RunAsync(); }
private void OnCreateAccount(HUDTextButton sender, HUDButtonEventArgs e) { if (editUsername.Text == "" || editPassword.Text == "") { return; } if (MainGame.Inst.Profile.AccountType != AccountType.Anonymous) { return; } var waitDialog = new HUDIconMessageBox { L10NText = L10NImpl.STR_AAP_ACCCREATING, TextColor = FlatColors.TextHUD, Background = HUDBackgroundDefinition.CreateRounded(FlatColors.BelizeHole, 16), IconColor = FlatColors.Clouds, Icon = Textures.CannonCog, RotationSpeed = 1f, CloseOnClick = false, }; HUD.AddModal(waitDialog, false, 0.7f); DoSignup(waitDialog, editUsername.Text, editPassword.Text).RunAsync(); }
public override void OnInitialize() { AddElement(new HUDTextButton { RelativePosition = new FPoint(8, 0), Size = new FSize(384, 48), Alignment = HUDAlignment.CENTERRIGHT, L10NText = L10NImpl.STR_LVLED_BTN_NEWLVL, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 32, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, Click = CreateNewUserLevel, BackgroundNormal = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth), BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth), }); AddElement(new HUDImage { RelativePosition = new FPoint(8, 0), Size = new FSize(48, 48), Alignment = HUDAlignment.CENTERLEFT, Image = Textures.CannonCog, ImageAlignment = HUDImageAlignmentAlgorithm.CENTER, ImageScale = HUDImageScaleAlgorithm.STRETCH, RotationSpeed = 0.10f, Color = FlatColors.Asbestos, }); }
private void OnChangePassword(HUDTextButton sender, HUDButtonEventArgs e) { if (editPassword.Text == "") { editPassword.AddHUDOperation(new HUDTextBoxBlinkOperation(Color.Red)); return; } if (MainGame.Inst.Profile.AccountType != AccountType.Full) { return; } var waitDialog = new HUDIconMessageBox { L10NText = L10NImpl.STR_CPP_CHANGING, 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); DoChangePassword(waitDialog, editPassword.Text).RunAsync(); }
private void CreateNewUserLevel(HUDTextButton sender, HUDButtonEventArgs e) { if (MainGame.Inst.Profile.AccountType == AccountType.Local) { CreateUserAndShowAnonPanel().EnsureNoError(); return; } else if (MainGame.Inst.Profile.AccountType == AccountType.Anonymous) { ShowAnonPanel(); HUD.ShowToast(null, L10N.T(L10NImpl.STR_SCCM_NEEDS_ACC), 40, FlatColors.Orange, FlatColors.Foreground, 2f); return; } var waitDialog = new HUDIconMessageBox { L10NText = L10NImpl.STR_GENERIC_SERVER_QUERY, 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); CreateNewUserLevelInternal(waitDialog).RunAsync(); }
public override void OnInitialize() { AddElement(_btn1 = new HUDImageButton { Alignment = HUDAlignment.TOPCENTER, RelativePosition = new FPoint(0, 0), Size = new FSize(Width, 64), Image = Textures.TexTriangle, ImageRotation = FloatMath.RAD_POS_000, ImagePadding = 4, BackgroundNormal = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth), BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth), Click = (s, a) => DoScroll(-1), }); AddElement(_btn2 = new HUDImageButton { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(0, 0), Size = new FSize(Width, 64), Image = Textures.TexTriangle, ImageRotation = FloatMath.RAD_POS_180, ImagePadding = 4, BackgroundNormal = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth), BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth), Click = (s, a) => DoScroll(+1), }); }
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 = L10NImpl.STR_ATTRIBUTIONS, TextColor = FlatColors.Clouds, }); for (int i = 0; i < Attributions.LINK_BACK.Length; i++) { var dd = Attributions.LINK_BACK[i]; var btn = new HUDTextButton(1) { TextAlignment = HUDAlignment.CENTERLEFT, Alignment = HUDAlignment.TOPCENTER, RelativePosition = new FPoint(((i % 2) * 2 - 1) * LINE_OFFSET, 96 + (i / 2) * 48), Size = new FSize(LINE_WIDTH, 32), Font = Textures.HUDFontRegular, FontSize = 24, Text = dd.Item1, TextColor = FlatColors.Foreground, TextPadding = 16, BackgroundNormal = HUDBackgroundDefinition.CreateSimpleBlur(FlatColors.TextHUD, 16), BackgroundPressed = HUDBackgroundDefinition.CreateSimpleBlur(FlatColors.ControlHighlight, 16), ClickMode = HUDButton.HUDButtonClickMode.Single, }; if (!string.IsNullOrWhiteSpace(dd.Item2)) { btn.ButtonClick += (s, a) => { HUD.ShowToast(null, dd.Item2, 32, FlatColors.Silver, FlatColors.Foreground, 3f); MainGame.Inst.GDBridge.OpenURL(dd.Item2); }; } AddElement(btn); } }
private async Task <SCCMListPresenter.LoadFuncResult> QueryData(SCCMListPresenter list, int page, int reqid) { try { var r = await MainGame.Inst.Backend.QueryUserLevel(MainGame.Inst.Profile, QueryUserLevelCategory.NewLevels, string.Empty, page); if (r == null) { return(SCCMListPresenter.LoadFuncResult.Error); } else { if (r.Count == 0) { return(SCCMListPresenter.LoadFuncResult.LastPage); } else { MonoSAMGame.CurrentInst.DispatchBeginInvoke(() => { if (list.IsCurrentRequest(reqid)) { foreach (var levelmeta in r) { list.AddEntry(new SCCMListElementOnlinePlayable(levelmeta)); } } }); return(SCCMListPresenter.LoadFuncResult.Success); } } } catch (Exception e) { SAMLog.Error("SCCMTN::QD", e); MonoSAMGame.CurrentInst.DispatchBeginInvoke(() => { HUD.AddModal(new HUDFadeOutInfoBox(5, 2, 0.3f) { L10NText = L10NImpl.STR_CPP_COMERR, TextColor = FlatColors.Clouds, Background = HUDBackgroundDefinition.CreateRounded(FlatColors.Alizarin, 16), CloseOnClick = true, }, true); }); return(SCCMListPresenter.LoadFuncResult.Error); } }
public void SelectTab(SCCMTab tab) { var bg1Normal = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Clouds, Color.Black, HUD.PixelWidth); var bg1Pressd = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Silver, Color.Black, HUD.PixelWidth); var bg2Normal = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.BelizeHole, Color.Black, HUD.PixelWidth); var bg2Pressd = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.PeterRiver, Color.Black, HUD.PixelWidth); _btnHeaderMyLevel.BackgroundNormal = (tab == SCCMTab.MyLevels) ? bg2Normal : bg1Normal; _btnHeaderMyLevel.BackgroundPressed = (tab == SCCMTab.MyLevels) ? bg2Pressd : bg1Pressd; _btnHeaderNew.BackgroundNormal = (tab == SCCMTab.New) ? bg2Normal : bg1Normal; _btnHeaderNew.BackgroundPressed = (tab == SCCMTab.New) ? bg2Pressd : bg1Pressd; _btnHeaderHot.BackgroundNormal = (tab == SCCMTab.Hot) ? bg2Normal : bg1Normal; _btnHeaderHot.BackgroundPressed = (tab == SCCMTab.Hot) ? bg2Pressd : bg1Pressd; _btnHeaderTop.BackgroundNormal = (tab == SCCMTab.Top) ? bg2Normal : bg1Normal; _btnHeaderTop.BackgroundPressed = (tab == SCCMTab.Top) ? bg2Pressd : bg1Pressd; _btnHeaderSearch.BackgroundNormal = (tab == SCCMTab.Search) ? bg2Normal : bg1Normal; _btnHeaderSearch.BackgroundPressed = (tab == SCCMTab.Search) ? bg2Pressd : bg1Pressd; switch (tab) { case SCCMTab.MyLevels: _container.SetElement(new SCCMTabMyLevels()); break; case SCCMTab.Hot: _container.SetElement(new SCCMTabHot()); break; case SCCMTab.Top: _container.SetElement(new SCCMTabTop()); break; case SCCMTab.New: _container.SetElement(new SCCMTabNew()); break; case SCCMTab.Search: _container.SetElement(new SCCMTabSearch()); break; default: SAMLog.Error("SCCMP::EnumSwitch_ST", "tab: " + tab); break; } }
public void SetActiveButton(HUDTextButton activeButton) { foreach (var btnObj in Buttons) { if (btnObj.Item1 == activeButton) { btnObj.Item1.BackgroundNormal = HUDBackgroundDefinition.CreateSimpleOutlineBlur(btnObj.Item3.Color, btnObj.Item3.OutlineColor, btnObj.Item3.OutlineThickness, 16); btnObj.Item1.BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutlineBlur(btnObj.Item2.Color, btnObj.Item2.OutlineColor, btnObj.Item2.OutlineThickness, 16); } else { btnObj.Item1.BackgroundNormal = btnObj.Item2; btnObj.Item1.BackgroundPressed = btnObj.Item3; } } }
private async Task CreateNewUserLevelInternal(HUDElement spinner) { try { var r = await MainGame.Inst.Backend.GetNewCustomLevelID(MainGame.Inst.Profile); if (!r.Item1) { MonoSAMGame.CurrentInst.DispatchBeginInvoke(() => { spinner.Remove(); HUD.AddModal(new HUDFadeOutInfoBox(5, 2, 0.3f) { L10NText = L10NImpl.STR_CPP_COMERR, TextColor = FlatColors.Clouds, Background = HUDBackgroundDefinition.CreateRounded(FlatColors.Alizarin, 16), CloseOnClick = true, }, true); }); return; } MonoSAMGame.CurrentInst.DispatchBeginInvoke(() => { spinner.Remove(); MainGame.Inst.SetLevelEditorScreen(new SCCMLevelData(r.Item2, MainGame.Inst.Profile.OnlineUserID)); }); } catch (Exception e) { SAMLog.Error("SCCMLENUL::DL", e); MonoSAMGame.CurrentInst.DispatchBeginInvoke(() => { spinner.Remove(); HUD.AddModal(new HUDFadeOutInfoBox(5, 2, 0.3f) { L10NText = L10NImpl.STR_CPP_COMERR, TextColor = FlatColors.Clouds, Background = HUDBackgroundDefinition.CreateRounded(FlatColors.Alizarin, 16), CloseOnClick = true, }, true); }); } }
public HUDToast ShowToast(string id, string text, int size, Color background, Color foreground, float lifetime) { lock (_toasts) { while (_toasts.Count >= MAX_TOAST_COUNT) { _toasts[0].Alive = false; _toasts.RemoveAt(0); } if (id != null) { foreach (var xtoast in _toasts) { if (xtoast.ToastID == id) { xtoast.Reset(text, background, foreground, lifetime); return(xtoast); } } } float px = HUDToast.PAD_BOTTOM; foreach (var xtoast in _toasts) { xtoast.PositionY.SetForce(px); px += xtoast.Height + HUDToast.PAD_VERT; } var toast = new HUDToast(id, lifetime, px); toast.Text = text; toast.Alignment = HUDAlignment.BOTTOMCENTER; toast.RelativePosition = new FPoint(0, px); toast.FontSize = size; toast.Font = DefaultFont; toast.TextColor = foreground; toast.Background = HUDBackgroundDefinition.CreateSimpleBlur(background, size / 4f); toast.TextPadding = new FSize(size / 5f, size / 5f); toast.MaxWidth = Width * 0.8f; toast.WordWrap = HUDWordWrap.WrapByWordTrusted; AddElement(toast); _toasts.Add(toast); return(toast); } }
public void Recreate(ILeveleditorStub selection) { ClearChildren(); if (selection == null) { IsVisible = false; return; } IsVisible = true; int i = 0; foreach (var opt in selection.AttrOptions) { AddElement(new AttributeButton { RelativePosition = new FPoint(32 + i * (128 + 64), 32), Size = new FSize(128, 128), Alignment = HUDAlignment.BOTTOMLEFT, Data = opt, }); i++; } AddElement(new HUDTextButton { RelativePosition = new FPoint(32, 32), Size = new FSize(192, 64), Alignment = HUDAlignment.BOTTOMRIGHT, L10NText = L10NImpl.STR_LVLED_BTN_DEL, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 48, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, Click = DeleteSelected, BackgroundNormal = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Pomegranate, Color.Black, HUD.PixelWidth), BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Alizarin, Color.Black, HUD.PixelWidth), }); }
public override void OnInitialize() { RelativePosition = new FPoint(0, 0); Size = new FSize(14 * GDConstants.TILE_WIDTH, 7 * GDConstants.TILE_WIDTH); Alignment = HUDAlignment.CENTER; AddElement(new HUDTextButton(1) { Alignment = HUDAlignment.CENTER, RelativePosition = new FPoint(0, -1.5f * GDConstants.TILE_WIDTH), Size = new FSize(12 * GDConstants.TILE_WIDTH, 2 * GDConstants.TILE_WIDTH), L10NText = L10NImpl.STR_LVLED_BTN_SAVE, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 75, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, BackgroundNormal = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.PeterRiver, 16), BackgroundPressed = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.BelizeHole, 16), Click = DoSave, }); AddElement(new HUDTextButton(1) { Alignment = HUDAlignment.CENTER, RelativePosition = new FPoint(0, +1.5f * GDConstants.TILE_WIDTH), Size = new FSize(12 * GDConstants.TILE_WIDTH, 2 * GDConstants.TILE_WIDTH), L10NText = L10NImpl.STR_LVLED_BTN_DISCARD, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 75, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, BackgroundNormal = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.Concrete, 16), BackgroundPressed = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.Asbestos, 16), Click = DoDiscard, }); }
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(); }
private void SetInfoBox(string text) { _infobox?.Remove(); _hud.AddElement(_infobox = new HUDInfoBox { Text = text, Alignment = HUDAlignment.ABSOLUTE_BOTHCENTERED, RelativePosition = _screen.TranslateGameToHUDCoordinates(8 * GDConstants.TILE_WIDTH, 9 * GDConstants.TILE_WIDTH), FontSize = 40, Font = Textures.HUDFontRegular, TextColor = Color.Black, Alpha = 1f, TextPadding = new FSize(8, 8), MaxWidth = 8 * GDConstants.TILE_WIDTH, WordWrap = HUDWordWrap.WrapByWordTrusted, Background = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.Concrete, 4f), }); }
public override void OnInitialize() { AddElement(new HUDTextButton { RelativePosition = new FPoint(5, 5), Size = new FSize(192, 32), Alignment = HUDAlignment.TOPRIGHT, L10NText = L10NImpl.STR_LVLED_BTN_PLAY, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 28, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, Click = OnPlay, BackgroundNormal = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth), BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth), }); }
public HUDLabel AddPreviewLine() { var scale = _target.HUD.Width / _virtualWidth; var x = currentVirtualX; var y = _padNS + currentRow * _rowHeight + currentRow * _padKey; var w = _virtualWidth - x - _padEW; var h = _rowHeight; var pnl = new HUDRectangle(1) { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint(x * scale, y * scale), Size = new FSize(w * scale, h * scale), Definition = HUDBackgroundDefinition.CreateRounded(HUDKeyboard.COLOR_PREVIEW_BG, scale * 0.1f), }; _target.AddElement(pnl); var padH = h * 0.25f; var padV = h * 0.1f; var lbl = new HUDLabel(2) { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint((x + padH) * scale, (y + padV) * scale), Size = new FSize((w - 2 * padH) * scale, (h - 2 * padV) * scale), TextColor = HUDKeyboard.COLOR_PREVIEW_TEXT, FontSize = (h - 2 * padV) * scale, TextAlignment = HUDAlignment.CENTERLEFT, }; _target.AddElement(lbl); NextRow(); return(lbl); }
public OverworldHUD(GDOverworldScreen scrn, bool firstShow) : base(scrn, Textures.HUDFontRegular) { AddElement(Settings = new SettingsButton()); ScoreDispMan = new ScoreDisplayManager(this, firstShow); #if FALSE AddElement(new HUDLabel { Alignment = HUDAlignment.CENTER, RelativePosition = new FPoint(0, -200), AutoSize = true, Background = HUDBackgroundDefinition.CreateSimple(Color.LightBlue), TextColor = Color.Red, FontSize = 64, Text = "INTERNAL ALPHA VERSION 4", }); #endif }
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 = _level.FullName, 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(_level.CustomMeta_LevelID, 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(_level.CustomMeta_LevelID, 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(_level.CustomMeta_LevelID, 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(_level.CustomMeta_LevelID, 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, 3.50f * TW), 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(new HUDIconTextButton(2) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(24, 3.50f * TW), 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.Orange, 16), BackgroundPressed = HUDBackgroundDefinition.CreateRounded(FlatColors.SunFlower, 16), Click = (s, a) => Replay(SelectedDifficulty), }); #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.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 HUDIncrementIndicatorLabel(MainGame.Inst.Profile.ScoreSCCM.ToString(), "", 2) { Alignment = HUDAlignment.BOTTOMCENTER, RelativePosition = new FPoint(0, 16), Size = new FSize(WIDTH / 3f, 60), TextAlignment = HUDAlignment.BOTTOMCENTER, TextColor = FlatColors.TextHUD, Font = Textures.HUDFontBold, FontSize = 57, }); #endregion }
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 = L10NImpl.STR_MENU_CAP_SEARCH, TextColor = FlatColors.Clouds, }); AddElement(new MultiplayerConnectionStateControl(_server) { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint(16, 16) }); AddElement(new HUDImage { Alignment = HUDAlignment.CENTER, RelativePosition = new FPoint(0, (-FOOTER_HEIGHT/2) + (96/2f)), Image = Textures.CannonCogBig, RotationSpeed = 0.35f, Color = FlatColors.Clouds, Size = new FSize(192, 192) }); AddElement(new HUDRectangle(0) { Alignment = HUDAlignment.BOTTOMRIGHT, Size = new FSize(WIDTH, FOOTER_HEIGHT), Definition = HUDBackgroundDefinition.CreateRounded(FlatColors.BackgroundHUD2, 16, false, false, true, true), }); 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, }); }
public override void OnInitialize() { base.OnInitialize(); string txt = "?"; if (_showMultiplayer) { txt = L10N.T(L10NImpl.STR_HSP_MULTIPLAYERRANKING); } else if (_focus == null) { txt = L10N.T(L10NImpl.STR_HSP_GLOBALRANKING); } else { txt = L10N.TF(L10NImpl.STR_HSP_RANKINGFOR, L10N.T(Levels.WORLD_NAMES[_focus.ID])); } AddElement(new HUDLabel(1) { TextAlignment = (_showMultiplayer || _focus == null) ? HUDAlignment.CENTER : HUDAlignment.CENTERLEFT, Alignment = HUDAlignment.TOPCENTER, RelativePosition = new FPoint(0, 0), Size = new FSize(TAB_WIDTH, TEXT_HEIGHT_REAL), Font = Textures.HUDFontBold, FontSize = 64, Text = txt, TextColor = FlatColors.Clouds, }); if (MainGame.Inst.Profile.HasMultiplayerGames) { if (!_showMultiplayer) { AddElement(_btn = new HUDTextButton(1) { Alignment = HUDAlignment.TOPRIGHT, RelativePosition = FPoint.Zero, Size = new FSize(3.5f * GDConstants.TILE_WIDTH, 48), L10NText = L10NImpl.STR_WORLD_MULTIPLAYER, TextColor = FlatColors.Foreground, Font = Textures.HUDFontBold, FontSize = 42, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, BackgroundNormal = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.Amethyst, 16, false, true, false, false), BackgroundPressed = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.Wisteria, 16, false, true, false, false), Click = ShowMultiplayer, IsVisible = false, }); } else { AddElement(_btn = new HUDTextButton(1) { Alignment = HUDAlignment.TOPRIGHT, RelativePosition = FPoint.Zero, Size = new FSize(3.5f * GDConstants.TILE_WIDTH, 48), L10NText = L10NImpl.STR_WORLD_SINGLEPLAYER, TextColor = FlatColors.Foreground, Font = Textures.HUDFontBold, FontSize = 42, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, BackgroundNormal = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.Amethyst, 16, false, true, false, false), BackgroundPressed = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.Wisteria, 16, false, true, false, false), Click = ShowSingleplayer, IsVisible = false, }); } } _loader = new HUDImage { RelativePosition = new FPoint(0, TEXT_HEIGHT / 2f), Alignment = HUDAlignment.CENTER, Size = new FSize(2 * GDConstants.TILE_WIDTH, 2 * GDConstants.TILE_WIDTH), Color = FlatColors.Clouds, Image = Textures.CannonCogBig, RotationSpeed = 0.1f, IsVisible = true, }; AddElement(_loader); _table = new HUDScrollTable { RelativePosition = new FPoint(0, TEXT_HEIGHT / 2f), Alignment = HUDAlignment.CENTER, Size = new FSize(TAB_WIDTH, TAB_HEIGHT), Background = FlatColors.BackgroundHUD2, Foreground = FlatColors.TextHUD, LineColor = Color.Black, HeaderBackground = FlatColors.Asbestos, HeaderForeground = Color.Black, ScrollThumbColor = FlatColors.Silver, ScrollWidth = 16, ScrollHeight = 64, LineWidth = 2 * HUD.PixelWidth, FontSize = 32, IsVisible = false, }; _table.FixHeightToMultipleOfRowHeight(); AddElement(_table); _table.AddColumn("", 100); _table.AddColumn(L10N.T(L10NImpl.STR_TAB_NAME), null); _table.AddColumn(L10N.T(L10NImpl.STR_TAB_POINTS), 100); if (!_showMultiplayer) { _table.AddColumn(L10N.T(L10NImpl.STR_TAB_TIME), 175); } LoadHighscore().EnsureNoError(); }
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() { RelativePosition = HUD.UnsafeTopRight; Size = new FSize(WIDTH + HUD.SafetyMargins.MarginRight, HUD.RealHeight); Alignment = HUDAlignment.TOPRIGHT; AddElement(BtnMouse = new HUDTextButton(1) { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint(24, 16 + 75 * 0), Size = new FSize((WIDTH - 2 * 24), 64), L10NText = L10NImpl.STR_LVLED_MOUSE, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 48, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, BackgroundNormal = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth), BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth), Click = SetModeMouse, }); AddElement(BtnCannon = new HUDTextButton(1) { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint(24, 16 + 75 * 1), Size = new FSize((WIDTH - 2 * 24), 64), L10NText = L10NImpl.STR_LVLED_CANNON, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 48, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, BackgroundNormal = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth), BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth), Click = SetModeCannon, }); AddElement(BtnWall = new HUDTextButton(1) { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint(24, 16 + 75 * 2), Size = new FSize((WIDTH - 2 * 24), 64), L10NText = L10NImpl.STR_LVLED_WALL, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 48, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, BackgroundNormal = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth), BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth), Click = SetModeWall, }); AddElement(BtnObstacle = new HUDTextButton(1) { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint(24, 16 + 75 * 3), Size = new FSize((WIDTH - 2 * 24), 64), L10NText = L10NImpl.STR_LVLED_OBSTACLE, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 48, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, BackgroundNormal = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth), BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth), Click = SetModeObstacle, }); AddElement(BtnPortal = new HUDTextButton(1) { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint(24, 16 + 75 * 4), Size = new FSize((WIDTH - 2 * 24), 64), L10NText = L10NImpl.STR_LVLED_PORTAL, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 48, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, BackgroundNormal = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth), BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth), Click = SetModePortal, }); AddElement(BtnSettings = new HUDTextButton(1) { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint(24, 16 + 75 * 5.5f), Size = new FSize((WIDTH - 2 * 24), 64), L10NText = L10NImpl.STR_LVLED_SETTINGS, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 48, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, BackgroundNormal = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonHUD, Color.Black, HUD.PixelWidth), BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.ButtonPressedHUD, Color.Black, HUD.PixelWidth), Click = (o, e) => GDScreen.ShowSettings(), }); AddElement(BtnPlay = new HUDTextButton(1) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(24, 16 + 75 * 4), Size = new FSize((WIDTH - 2 * 24), 64), L10NText = L10NImpl.STR_LVLED_PLAY, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 48, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, BackgroundNormal = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Orange, Color.Black, HUD.PixelWidth), BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.SunFlower, Color.Black, HUD.PixelWidth), Click = (o, e) => GDScreen.DoPlayTest(), }); AddElement(BtnTest = new HUDTextButton(1) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(24, 16 + 75 * 3), Size = new FSize((WIDTH - 2 * 24), 64), L10NText = L10NImpl.STR_LVLED_UPLOAD, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 48, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, BackgroundNormal = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Nephritis, Color.Black, HUD.PixelWidth), BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Emerald, Color.Black, HUD.PixelWidth), Click = (o, e) => GDScreen.TryUpload(), }); AddElement(BtnDelete = new HUDTextButton(1) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(24 + HUD.SafetyMargins.MarginRight, 16 + 75 * 1), Size = new FSize((WIDTH - 3 * 24), 64), L10NText = L10NImpl.STR_LVLED_BTN_DEL, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 48, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, BackgroundNormal = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Pomegranate, Color.Black, HUD.PixelWidth), BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Alizarin, Color.Black, HUD.PixelWidth), Click = (o, e) => GDScreen.DeleteLevel(), }); AddElement(BtnExit = new HUDTextButton(1) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(24 + HUD.SafetyMargins.MarginRight, 16 + 75 * 0), Size = new FSize((WIDTH - 3 * 24), 64), L10NText = L10NImpl.STR_LVLED_EXIT, TextColor = FlatColors.Foreground, Font = Textures.HUDFontRegular, FontSize = 48, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, BackgroundNormal = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Clouds, Color.Black, HUD.PixelWidth), BackgroundPressed = HUDBackgroundDefinition.CreateSimpleOutline(FlatColors.Silver, Color.Black, HUD.PixelWidth), Click = (o, e) => GDScreen.ExitEditor(), }); Buttons.Add(Tuple.Create(BtnMouse, BtnMouse.BackgroundNormal, BtnMouse.BackgroundPressed)); Buttons.Add(Tuple.Create(BtnCannon, BtnCannon.BackgroundNormal, BtnCannon.BackgroundPressed)); Buttons.Add(Tuple.Create(BtnWall, BtnWall.BackgroundNormal, BtnWall.BackgroundPressed)); Buttons.Add(Tuple.Create(BtnObstacle, BtnObstacle.BackgroundNormal, BtnObstacle.BackgroundPressed)); Buttons.Add(Tuple.Create(BtnPortal, BtnObstacle.BackgroundNormal, BtnObstacle.BackgroundPressed)); Buttons.Add(Tuple.Create(BtnSettings, BtnSettings.BackgroundNormal, BtnSettings.BackgroundPressed)); Buttons.Add(Tuple.Create(BtnPlay, BtnPlay.BackgroundNormal, BtnPlay.BackgroundPressed)); Buttons.Add(Tuple.Create(BtnTest, BtnTest.BackgroundNormal, BtnTest.BackgroundPressed)); Buttons.Add(Tuple.Create(BtnExit, BtnExit.BackgroundNormal, BtnExit.BackgroundPressed)); SetActiveButton(BtnMouse); }
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 }