using Godot; using System; namespace Chessistics.Scripts.UI; public partial class LevelSelectScreen : Control { [Signal] public delegate void StartCampaignPressedEventHandler(); public override void _Ready() { // Full-screen dark background var bg = new PanelContainer(); bg.SetAnchorsPreset(LayoutPreset.FullRect); var bgStyle = new StyleBoxFlat { BgColor = new Color(0.12f, 0.12f, 0.14f) }; bg.AddThemeStyleboxOverride("panel", bgStyle); bg.MouseFilter = MouseFilterEnum.Ignore; AddChild(bg); // Center content var center = new CenterContainer(); center.SetAnchorsPreset(LayoutPreset.FullRect); center.MouseFilter = MouseFilterEnum.Ignore; var vbox = new VBoxContainer { Alignment = BoxContainer.AlignmentMode.Center }; vbox.AddThemeConstantOverride("separation", 24); vbox.MouseFilter = MouseFilterEnum.Ignore; // Title var title = new Label { Text = "CHESSISTICS", HorizontalAlignment = HorizontalAlignment.Center }; title.AddThemeFontSizeOverride("font_size", 56); title.AddThemeColorOverride("font_color", new Color("#FFD700")); vbox.AddChild(title); // Subtitle var subtitle = new Label { Text = "La QuĂȘte du Roi", HorizontalAlignment = HorizontalAlignment.Center }; subtitle.AddThemeFontSizeOverride("font_size", 18); subtitle.AddThemeColorOverride("font_color", new Color("#999999")); vbox.AddChild(subtitle); // Spacer vbox.AddChild(new Control { CustomMinimumSize = new Vector2(0, 32) }); // Start button var startBtn = new Button { Text = "DĂ©marrer", CustomMinimumSize = new Vector2(200, 52), SizeFlagsHorizontal = SizeFlags.ShrinkCenter }; var btnNormal = new StyleBoxFlat { BgColor = new Color("#8B6914"), CornerRadiusTopLeft = 8, CornerRadiusTopRight = 8, CornerRadiusBottomLeft = 8, CornerRadiusBottomRight = 8, ContentMarginLeft = 32, ContentMarginRight = 32, ContentMarginTop = 12, ContentMarginBottom = 12 }; var btnHover = new StyleBoxFlat { BgColor = new Color("#B8860B"), CornerRadiusTopLeft = 8, CornerRadiusTopRight = 8, CornerRadiusBottomLeft = 8, CornerRadiusBottomRight = 8, ContentMarginLeft = 32, ContentMarginRight = 32, ContentMarginTop = 12, ContentMarginBottom = 12 }; var btnPressed = new StyleBoxFlat { BgColor = new Color("#6B5010"), CornerRadiusTopLeft = 8, CornerRadiusTopRight = 8, CornerRadiusBottomLeft = 8, CornerRadiusBottomRight = 8, ContentMarginLeft = 32, ContentMarginRight = 32, ContentMarginTop = 12, ContentMarginBottom = 12 }; startBtn.AddThemeStyleboxOverride("normal", btnNormal); startBtn.AddThemeStyleboxOverride("hover", btnHover); startBtn.AddThemeStyleboxOverride("pressed", btnPressed); startBtn.AddThemeFontSizeOverride("font_size", 20); startBtn.Pressed += () => EmitSignal(SignalName.StartCampaignPressed); vbox.AddChild(startBtn); center.AddChild(vbox); AddChild(center); } }