using Content.Client.Parallax.Data; using Robust.Client.AutoGenerated; using Robust.Client.ResourceManagement; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.XAML; using Robust.Shared; using Robust.Shared.Configuration; using Robust.Shared.Prototypes; using Robust.Shared.Random; namespace Content.Client.MainMenu.UI; [GenerateTypedNameReferences] public sealed partial class MainMenuControl : Control { [Dependency] private IRobustRandom _random = default!; public const string StyleIdentifierMainMenu = "mainMenu"; public const string StyleIdentifierMainMenuVBox = "mainMenuVBox"; private static readonly ProtoId[] Parallaxes = [ "Wizard", "TrainStation", "PlasmaStation", "AmberStation", "FastSpace", "AspidParallax", "OriginStation", "Default", "Sky", "KettleStation", "BagelStation", "ExoStation", ]; public MainMenuControl(IResourceCache resCache, IConfigurationManager configMan) { IoCManager.InjectDependencies(this); RobustXamlLoader.Load(this); LayoutContainer.SetAnchorPreset(this, LayoutContainer.LayoutPreset.Wide); LayoutContainer.SetAnchorPreset(VBox, LayoutContainer.LayoutPreset.TopRight); LayoutContainer.SetMarginRight(VBox, -25); LayoutContainer.SetMarginTop(VBox, 30); LayoutContainer.SetGrowHorizontal(VBox, LayoutContainer.GrowDirection.Begin); // I don't just enumerate them all as there's some hideous parallaxes, and it's easier // to update an allowlist than to randomly get an ugly one to fix a blocklist. BackgroundParallax.ParallaxPrototype = _random.Pick(Parallaxes).Id; var logoTexture = resCache.GetResource("/Textures/Logo/logo.png"); Logo.Texture = logoTexture; var currentUserName = configMan.GetCVar(CVars.PlayerName); UsernameBox.Text = currentUserName; } }