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), }); }
private void OnReuploadProfile(HUDImageButton sender, HUDButtonEventArgs e) { if (isUploading) { return; } isUploading = true; btnReload.RotationSpeed = 0.5f; MainGame.Inst.ShowToast(null, L10N.T(L10NImpl.STR_PROFILESYNC_START), 40, FlatColors.Silver, FlatColors.Foreground, 2f); MainGame.Inst.Profile.NeedsReupload = true; DoReuploadProfile(MainGame.Inst.Profile).RunAsync(); }
public override void OnInitialize() { base.OnInitialize(); 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 HUDLabel(1) { TextAlignment = HUDAlignment.CENTER, Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint(0, 0), Size = new FSize(WIDTH, 100), Font = Textures.HUDFontBold, FontSize = 64, L10NText = L10NImpl.STR_FAP_ACCOUNT, TextColor = FlatColors.Clouds, }); AddElement(new HUDLabel(1) { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint(20, 100), Size = new FSize((WIDTH - 60) / 2, 80), Font = Textures.HUDFontRegular, FontSize = 64, TextColor = FlatColors.Clouds, L10NText = L10NImpl.STR_FAP_USERNAME, }); AddElement(new HUDLabel(1) { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint(20 + (WIDTH - 60) / 2 + 20, 100), Size = new FSize((WIDTH - 60) / 2, 80), Font = Textures.HUDFontRegular, FontSize = 64, TextColor = FlatColors.Clouds, Text = MainGame.Inst.Profile.OnlineUsername, }); AddElement(new HUDLabel(1) { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint(20, 200), Size = new FSize((WIDTH - 60) / 2, 80), Font = Textures.HUDFontRegular, FontSize = 64, TextColor = FlatColors.Clouds, L10NText = L10NImpl.STR_FAP_SCORE, }); AddElement(new HUDLabel(1) { Alignment = HUDAlignment.TOPLEFT, RelativePosition = new FPoint(20 + (WIDTH - 60) / 2 + 20, 200), Size = new FSize((WIDTH - 60) / 2, 80), Font = Textures.HUDFontRegular, FontSize = 64, TextColor = FlatColors.Clouds, Text = MainGame.Inst.Profile.TotalPoints.ToString(), }); AddElement(new HUDTextButton(1) { Alignment = HUDAlignment.BOTTOMLEFT, RelativePosition = new FPoint(24, 32), Size = new FSize(4 * GDConstants.TILE_WIDTH, 64), L10NText = L10NImpl.STR_FAP_LOGOUT, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 55, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, BackgroundNormal = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.ButtonHUD, 16), BackgroundPressed = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.ButtonPressedHUD, 16), Click = OnLogout, }); AddElement(new HUDTextButton(1) { Alignment = HUDAlignment.BOTTOMRIGHT, RelativePosition = new FPoint(24, 32), Size = new FSize(5.5f * GDConstants.TILE_WIDTH, 64), L10NText = L10NImpl.STR_FAP_CHANGEPW, TextColor = Color.White, Font = Textures.HUDFontRegular, FontSize = 55, TextAlignment = HUDAlignment.CENTER, TextPadding = 8, BackgroundNormal = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.ButtonHUD, 16), BackgroundPressed = HUDBackgroundDefinition.CreateRoundedBlur(FlatColors.ButtonPressedHUD, 16), Click = OnChangePassword, }); AddElement(btnReload = new HUDImageButton(2) { Alignment = HUDAlignment.TOPRIGHT, RelativePosition = new FPoint(6, 6), Size = new FSize(64, 64), BackgroundNormal = HUDBackgroundDefinition.NONE, BackgroundPressed = HUDBackgroundDefinition.NONE, ImageAlignment = HUDImageAlignment.UNDERSCALE, Image = Textures.TexHUDIconReload, ImageColor = MainGame.Inst.Profile.NeedsReupload ? FlatColors.Carrot : FlatColors.Clouds, RotationSpeed = 0f, ClickMode = HUDButton.HUDButtonClickMode.Single, Click = OnReuploadProfile, }); }