Add more info to escape menu (#5260)
This commit is contained in:
parent
2dc9dace20
commit
78e0a0943e
|
|
@ -1,4 +1,6 @@
|
|||
using System.Text.RegularExpressions;
|
||||
using Content.Client._DV.UserInterfaces.BuildInfo; // DeltaV - More info in Escape Menu
|
||||
using Content.Client.Credits; // DeltaV - More info in Escape Menu
|
||||
using Content.Client.MainMenu.UI;
|
||||
using Content.Client.UserInterface.Systems.EscapeMenu;
|
||||
using Robust.Client;
|
||||
|
|
@ -48,6 +50,8 @@ namespace Content.Client.MainMenu
|
|||
_mainMenuControl.DirectConnectButton.OnPressed += DirectConnectButtonPressed;
|
||||
_mainMenuControl.AddressBox.OnTextEntered += AddressBoxEntered;
|
||||
_mainMenuControl.ChangelogButton.OnPressed += ChangelogButtonPressed;
|
||||
_mainMenuControl.BuildInfoButton.OnPressed += BuildInfoButtonPressed; // DeltaV - More info in Escape Menu
|
||||
_mainMenuControl.CreditsButton.OnPressed += CreditsButtonPressed; // DeltaV - More info in Escape Menu
|
||||
|
||||
_client.RunLevelChanged += RunLevelChanged;
|
||||
}
|
||||
|
|
@ -66,6 +70,18 @@ namespace Content.Client.MainMenu
|
|||
_userInterfaceManager.GetUIController<ChangelogUIController>().ToggleWindow();
|
||||
}
|
||||
|
||||
// Begin DeltaV - More info in Escape Menu
|
||||
private void BuildInfoButtonPressed(BaseButton.ButtonEventArgs args)
|
||||
{
|
||||
_userInterfaceManager.GetUIController<BuildInfoUIController>().ToggleWindow();
|
||||
}
|
||||
|
||||
private void CreditsButtonPressed(BaseButton.ButtonEventArgs args)
|
||||
{
|
||||
new CreditsWindow().Open();
|
||||
}
|
||||
// End DeltaV - More info in Escape Menu
|
||||
|
||||
private void OptionsButtonPressed(BaseButton.ButtonEventArgs args)
|
||||
{
|
||||
_userInterfaceManager.GetUIController<OptionsUIController>().ToggleWindow();
|
||||
|
|
|
|||
|
|
@ -48,5 +48,18 @@
|
|||
<clog:ChangelogButton
|
||||
Name="ChangelogButton"
|
||||
Access="Public"/>
|
||||
<!-- Begin DeltaV - More info in Escape Menu -->
|
||||
<Button
|
||||
Name="CreditsButton"
|
||||
Access="Public"
|
||||
Text="{Loc server-info-credits-button}"
|
||||
TextAlign="Center" />
|
||||
<Button
|
||||
Name="BuildInfoButton"
|
||||
Access="Public"
|
||||
Text="{Loc build-info-button}"
|
||||
ToolTip="{Loc build-info-tooltip}"
|
||||
TextAlign="Center" />
|
||||
<!-- End DeltaV - More info in Escape Menu -->
|
||||
</BoxContainer>
|
||||
</Control>
|
||||
|
|
|
|||
|
|
@ -17,5 +17,10 @@
|
|||
<PanelContainer StyleClasses="LowDivider" Margin="0 2.5 0 2.5" />
|
||||
<Button Access="Public" Name="DisconnectButton" Text="{Loc 'ui-escape-disconnect'}" />
|
||||
<Button Access="Public" Name="QuitButton" Text="{Loc 'ui-escape-quit'}" StyleClasses="ButtonColorRed" />
|
||||
<!-- Begin DeltaV - More info in Escape Menu -->
|
||||
<PanelContainer StyleClasses="LowDivider" Margin="0 2.5 0 2.5" />
|
||||
<Button Access="Public" Name="CreditsButton" Text="{Loc server-info-credits-button}" />
|
||||
<Button Access="Public" Name="BuildInfoButton" Text="{Loc build-info-button}" ToolTip="{Loc build-info-tooltip}" />
|
||||
<!-- End DeltaV - More info in Escape Menu -->
|
||||
</BoxContainer>
|
||||
</ui1:EscapeMenu>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
using Content.Client.Gameplay;
|
||||
using Content.Client._DV.UserInterfaces.BuildInfo; // DeltaV - More info in Escape Menu
|
||||
using Content.Client.Credits; // DeltaV - More info in Escape Menu
|
||||
using Content.Client.Gameplay;
|
||||
using Content.Client.UserInterface.Controls;
|
||||
using Content.Client.UserInterface.Systems.Guidebook;
|
||||
using Content.Client.UserInterface.Systems.Info;
|
||||
|
|
@ -25,6 +27,7 @@ public sealed class EscapeUIController : UIController, IOnStateEntered<GameplayS
|
|||
[Dependency] private readonly InfoUIController _info = default!;
|
||||
[Dependency] private readonly OptionsUIController _options = default!;
|
||||
[Dependency] private readonly GuidebookUIController _guidebook = default!;
|
||||
[Dependency] private readonly BuildInfoUIController _buildInfo = default!; // DeltaV - More info in Escape Menu
|
||||
|
||||
private Options.UI.EscapeMenu? _escapeWindow;
|
||||
|
||||
|
|
@ -103,6 +106,19 @@ public sealed class EscapeUIController : UIController, IOnStateEntered<GameplayS
|
|||
_guidebook.ToggleGuidebook();
|
||||
};
|
||||
|
||||
// Begin DeltaV - More info in Escape Menu
|
||||
_escapeWindow.BuildInfoButton.OnPressed += _ =>
|
||||
{
|
||||
CloseEscapeWindow();
|
||||
_buildInfo.OpenWindow();
|
||||
};
|
||||
|
||||
_escapeWindow.CreditsButton.OnPressed += _ =>
|
||||
{
|
||||
new CreditsWindow().Open();
|
||||
};
|
||||
// End DeltaV - More info in Escape Menu
|
||||
|
||||
// Hide wiki button if we don't have a link for it.
|
||||
_escapeWindow.WikiButton.Visible = _cfg.GetCVar(CCVars.InfoLinksWiki) != "";
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
using Content.Client._DV.UserInterfaces.BuildInfo.Controls;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Client.UserInterface.Controllers;
|
||||
|
||||
namespace Content.Client._DV.UserInterfaces.BuildInfo;
|
||||
|
||||
[UsedImplicitly]
|
||||
public sealed class BuildInfoUIController : UIController
|
||||
{
|
||||
private BuildInfoWindow _changeLogWindow = default!;
|
||||
|
||||
public void OpenWindow()
|
||||
{
|
||||
EnsureWindow();
|
||||
|
||||
_changeLogWindow.OpenCentered();
|
||||
_changeLogWindow.MoveToFront();
|
||||
}
|
||||
|
||||
private void EnsureWindow()
|
||||
{
|
||||
if (_changeLogWindow is { Disposed: false })
|
||||
{
|
||||
// return; ADD THIS BACK WHEN I DON'T NEED HOT RELOAD
|
||||
}
|
||||
|
||||
_changeLogWindow = UIManager.CreateWindow<BuildInfoWindow>();
|
||||
}
|
||||
|
||||
public void ToggleWindow()
|
||||
{
|
||||
if (_changeLogWindow is { IsOpen: true })
|
||||
{
|
||||
_changeLogWindow.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
<ui:BuildInfoRow xmlns="https://spacestation14.io"
|
||||
xmlns:ui="clr-namespace:Content.Client._DV.UserInterfaces.BuildInfo.Controls"
|
||||
Orientation="Horizontal">
|
||||
<Label Name="Label" HorizontalAlignment="Left" />
|
||||
<Label Name="Value" HorizontalAlignment="Right" HorizontalExpand="True" Margin="4" />
|
||||
<Button Name="CopyButton" HorizontalAlignment="Right" Text="{Loc ui-options-function-text-copy}" />
|
||||
</ui:BuildInfoRow>
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
|
||||
namespace Content.Client._DV.UserInterfaces.BuildInfo.Controls;
|
||||
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class BuildInfoRow : BoxContainer
|
||||
{
|
||||
[Dependency] private readonly IClipboardManager _clipboard = default!;
|
||||
|
||||
public string? LabelText
|
||||
{
|
||||
get => Label.Text;
|
||||
set => Label.Text = value;
|
||||
}
|
||||
|
||||
public string? ValueText
|
||||
{
|
||||
get => Value.Text;
|
||||
set => Value.Text = value;
|
||||
}
|
||||
|
||||
private void CopyValue(BaseButton.ButtonEventArgs args)
|
||||
{
|
||||
if (ValueText is { } value)
|
||||
_clipboard.SetText(value);
|
||||
}
|
||||
|
||||
public BuildInfoRow()
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
RobustXamlLoader.Load(this);
|
||||
|
||||
CopyButton.OnPressed += CopyValue;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
<buildInfo:BuildInfoWindow xmlns="https://spacestation14.io"
|
||||
xmlns:buildInfo="clr-namespace:Content.Client._DV.UserInterfaces.BuildInfo.Controls"
|
||||
Title="{Loc build-info-window-title}"
|
||||
Resizable="True">
|
||||
<BoxContainer Orientation="Vertical" Margin="4">
|
||||
<buildInfo:BuildInfoRow Name="EngineVersion" LabelText="{Loc build-info-engine-version-label}" />
|
||||
<buildInfo:BuildInfoRow Name="Fork" LabelText="{Loc build-info-fork-label}" />
|
||||
<buildInfo:BuildInfoRow Name="Version" LabelText="{Loc build-info-version-label}" />
|
||||
<buildInfo:BuildInfoRow Name="DownloadUrl" LabelText="{Loc build-info-download-url-label}" />
|
||||
<buildInfo:BuildInfoRow Name="BuildHash" LabelText="{Loc build-info-build-hash-label}" />
|
||||
<buildInfo:BuildInfoRow Name="BuildManifestUrl" LabelText="{Loc build-info-build-manifest-url-label}" />
|
||||
<buildInfo:BuildInfoRow Name="BuildManifestHash" LabelText="{Loc build-info-build-manifest-hash-label}" />
|
||||
</BoxContainer>
|
||||
</buildInfo:BuildInfoWindow>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared;
|
||||
using Robust.Shared.Configuration;
|
||||
|
||||
namespace Content.Client._DV.UserInterfaces.BuildInfo.Controls;
|
||||
|
||||
[GenerateTypedNameReferences]
|
||||
public sealed partial class BuildInfoWindow : DefaultWindow
|
||||
{
|
||||
[Dependency] private readonly IConfigurationManager _cfg = default!;
|
||||
|
||||
public BuildInfoWindow()
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
RobustXamlLoader.Load(this);
|
||||
|
||||
Version.ValueText = _cfg.GetCVar(CVars.BuildVersion);
|
||||
EngineVersion.ValueText = _cfg.GetCVar(CVars.BuildEngineVersion);
|
||||
Fork.ValueText = _cfg.GetCVar(CVars.BuildForkId);
|
||||
DownloadUrl.ValueText = _cfg.GetCVar(CVars.BuildDownloadUrl);
|
||||
BuildHash.ValueText = _cfg.GetCVar(CVars.BuildHash);
|
||||
BuildManifestUrl.ValueText = _cfg.GetCVar(CVars.BuildManifestUrl);
|
||||
BuildManifestHash.ValueText = _cfg.GetCVar(CVars.BuildManifestHash);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
build-info-window-title = Build Info
|
||||
build-info-button = Build Info
|
||||
build-info-tooltip = Metadata about the game you're running
|
||||
build-info-version-label = Game Version:
|
||||
build-info-engine-version-label = Engine Version:
|
||||
build-info-fork-label = Fork ID:
|
||||
build-info-download-url-label = Client Download:
|
||||
build-info-build-hash-label = Client Hash:
|
||||
build-info-build-manifest-url-label = Manifest URL:
|
||||
build-info-build-manifest-hash-label = Manifest Hash:
|
||||
Loading…
Reference in New Issue