1
0

MiscTab.xaml.cs 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. using System.Linq;
  2. using Content.Client.UserInterface.Screens;
  3. using Content.Shared.CCVar;
  4. using Content.Shared.HUD;
  5. using Robust.Client.AutoGenerated;
  6. using Robust.Client.Player;
  7. using Robust.Client.UserInterface;
  8. using Robust.Client.UserInterface.XAML;
  9. using Robust.Shared;
  10. using Robust.Shared.Prototypes;
  11. namespace Content.Client.Options.UI.Tabs;
  12. [GenerateTypedNameReferences]
  13. public sealed partial class MiscTab : Control
  14. {
  15. [Dependency] private readonly IPlayerManager _playerManager = default!;
  16. [Dependency] private readonly IPrototypeManager _prototypeManager = default!;
  17. public MiscTab()
  18. {
  19. RobustXamlLoader.Load(this);
  20. IoCManager.InjectDependencies(this);
  21. var themes = _prototypeManager.EnumeratePrototypes<HudThemePrototype>().ToList();
  22. themes.Sort();
  23. var themeEntries = new List<OptionDropDownCVar<string>.ValueOption>();
  24. foreach (var gear in themes)
  25. {
  26. themeEntries.Add(new OptionDropDownCVar<string>.ValueOption(gear.ID, Loc.GetString(gear.Name)));
  27. }
  28. var layoutEntries = new List<OptionDropDownCVar<string>.ValueOption>();
  29. foreach (var layout in Enum.GetValues(typeof(ScreenType)))
  30. {
  31. layoutEntries.Add(new OptionDropDownCVar<string>.ValueOption(layout.ToString()!, Loc.GetString($"ui-options-hud-layout-{layout.ToString()!.ToLower()}")));
  32. }
  33. // Channel can be null in replays so.
  34. // ReSharper disable once ConditionalAccessQualifierIsNonNullableAccordingToAPIContract
  35. ShowOocPatronColor.Visible = _playerManager.LocalSession?.Channel?.UserData.PatronTier is { };
  36. Control.AddOptionDropDown(CVars.InterfaceTheme, DropDownHudTheme, themeEntries);
  37. Control.AddOptionDropDown(CCVars.UILayout, DropDownHudLayout, layoutEntries);
  38. Control.AddOptionCheckBox(CVars.DiscordEnabled, DiscordRich);
  39. Control.AddOptionCheckBox(CCVars.ShowOocPatronColor, ShowOocPatronColor);
  40. Control.AddOptionCheckBox(CCVars.LoocAboveHeadShow, ShowLoocAboveHeadCheckBox);
  41. Control.AddOptionCheckBox(CCVars.HudHeldItemShow, ShowHeldItemCheckBox);
  42. Control.AddOptionCheckBox(CCVars.CombatModeIndicatorsPointShow, ShowCombatModeIndicatorsCheckBox);
  43. Control.AddOptionCheckBox(CCVars.OpaqueStorageWindow, OpaqueStorageWindowCheckBox);
  44. Control.AddOptionCheckBox(CCVars.ChatEnableFancyBubbles, FancySpeechBubblesCheckBox);
  45. Control.AddOptionCheckBox(CCVars.ChatFancyNameBackground, FancyNameBackgroundsCheckBox);
  46. Control.AddOptionCheckBox(CCVars.StaticStorageUI, StaticStorageUI);
  47. Control.Initialize();
  48. }
  49. }