-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* this took too long * typo ops
- Loading branch information
Showing
5 changed files
with
168 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<controls:FancyWindow xmlns="https://spacestation14.io" | ||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls" | ||
Title="{Loc 'no-eorg-popup-title'}" | ||
MinSize="520 430" | ||
MaxSize="520 430"> | ||
<BoxContainer Orientation="Vertical" Margin="20"> | ||
<Label Name="TitleLabel" | ||
Text="{Loc 'no-eorg-popup-label'}" | ||
StyleClasses="LabelBig" | ||
HorizontalAlignment="Center" | ||
Margin="0 0 0 10" /> | ||
<PanelContainer StyleClasses="BackgroundDark" Margin="0 0 0 10"> | ||
<BoxContainer Orientation="Vertical" Margin="10"> | ||
<RichTextLabel Name="MessageLabel" HorizontalAlignment="Center" /> | ||
<Control MinSize="0 10" /> | ||
<RichTextLabel Name="RuleLabel" HorizontalAlignment="Center" /> | ||
<RichTextLabel Name="RuleTextLabel" HorizontalAlignment="Center" Margin="0 5 0 0" /> | ||
</BoxContainer> | ||
</PanelContainer> | ||
<BoxContainer Orientation="Vertical" VerticalAlignment="Bottom" Margin="0 10 0 0"> | ||
<CheckBox Name="SkipCheckBox" | ||
Text="{Loc 'no-eorg-popup-skip-checkbox'}" | ||
HorizontalAlignment="Center" | ||
Margin="0 0 0 10" /> | ||
<Button Name="NoEorgCloseButton" | ||
HorizontalAlignment="Center" | ||
MinWidth="150" /> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</controls:FancyWindow> |
76 changes: 76 additions & 0 deletions
76
Content.Client/InfinityStation/RoundEnd/NoEorgPopup.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
using Content.Client.UserInterface.Controls; | ||
using Content.Shared.InfinityStation.CCVar; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.XAML; | ||
using Robust.Shared.Configuration; | ||
using Robust.Shared.Timing; | ||
using Robust.Shared.Utility; | ||
|
||
namespace Content.Client.InfinityStation.RoundEnd | ||
{ | ||
[GenerateTypedNameReferences] | ||
public sealed partial class NoEorgPopup : FancyWindow | ||
{ | ||
[Dependency] private readonly IConfigurationManager _cfg = default!; | ||
|
||
private bool GetSkipPopupCvar() => _cfg.GetCVar(ICCVars.SkipRoundEndNoEorgMessage); | ||
|
||
private float _timer = 5f; | ||
|
||
public NoEorgPopup() | ||
{ | ||
IoCManager.InjectDependencies(this); | ||
RobustXamlLoader.Load(this); | ||
|
||
TitleLabel.Text = Loc.GetString("no-eorg-popup-label"); | ||
MessageLabel.SetMessage(FormattedMessage.FromMarkupOrThrow(Loc.GetString("no-eorg-popup-message"))); | ||
RuleLabel.SetMessage(FormattedMessage.FromMarkupOrThrow(Loc.GetString("no-eorg-popup-rule"))); | ||
RuleTextLabel.SetMessage(FormattedMessage.FromMarkupOrThrow(Loc.GetString("no-eorg-popup-rule-text"))); | ||
|
||
|
||
SkipCheckBox.Pressed = GetSkipPopupCvar(); | ||
SkipCheckBox.OnToggled += OnSkipToggled; | ||
|
||
NoEorgCloseButton.OnPressed += OnClosePressed; | ||
NoEorgCloseButton.Disabled = true; | ||
UpdateCloseButton(); | ||
} | ||
|
||
private void OnSkipToggled(BaseButton.ButtonEventArgs args) | ||
{ | ||
_cfg.SetCVar(ICCVars.SkipRoundEndNoEorgMessage, SkipCheckBox.Pressed); | ||
_cfg.SaveToFile(); | ||
} | ||
|
||
private void OnClosePressed(BaseButton.ButtonEventArgs args) | ||
{ | ||
Close(); | ||
} | ||
|
||
private void UpdateCloseButton() | ||
{ | ||
NoEorgCloseButton.Text = _timer > 0f | ||
? Loc.GetString("no-eorg-popup-close-button-wait", ("time", (int)MathF.Ceiling(_timer))) | ||
: Loc.GetString("no-eorg-popup-close-button"); | ||
NoEorgCloseButton.Disabled = _timer > 0f; | ||
} | ||
|
||
protected override void FrameUpdate(FrameEventArgs args) | ||
{ | ||
base.FrameUpdate(args); | ||
|
||
if (!NoEorgCloseButton.Disabled) | ||
return; | ||
|
||
if (_timer > 0.0f) | ||
{ | ||
_timer -= args.DeltaSeconds; | ||
if (_timer < 0) | ||
_timer = 0; | ||
} | ||
|
||
UpdateCloseButton(); | ||
} | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
Content.Client/InfinityStation/RoundEnd/NoEorgPopupSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using Content.Shared.GameTicking; | ||
using Content.Shared.InfinityStation.CCVar; | ||
using Robust.Shared.Configuration; | ||
|
||
namespace Content.Client.InfinityStation.RoundEnd | ||
{ | ||
public sealed class NoEorgPopupSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IConfigurationManager _cfg = default!; | ||
|
||
private NoEorgPopup? _window; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
|
||
SubscribeNetworkEvent<RoundEndMessageEvent>(OnRoundEnd); | ||
} | ||
|
||
private void OnRoundEnd(RoundEndMessageEvent ev) | ||
{ | ||
if (_cfg.GetCVar(ICCVars.SkipRoundEndNoEorgMessage)) | ||
return; | ||
|
||
OpenNoEorgPopup(); | ||
} | ||
|
||
private void OpenNoEorgPopup() | ||
{ | ||
if (_window != null) | ||
return; | ||
|
||
_window = new NoEorgPopup(); | ||
_window.OpenCentered(); | ||
_window.OnClose += () => _window = null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
using Robust.Shared.Configuration; | ||
|
||
namespace Content.Shared.InfinityStation.CCVar; | ||
|
||
/// <summary> | ||
/// ALLTI specific cvars. | ||
/// </summary> | ||
[CVarDefs] | ||
public sealed class ICCVars | ||
{ | ||
/// <summary> | ||
/// Define if the round end no EORG message should be displayed. | ||
/// </summary> | ||
public static readonly CVarDef<bool> SkipRoundEndNoEorgMessage = | ||
CVarDef.Create("infinity.skip_roundend_noeorg", false, CVar.CLIENTONLY | CVar.ARCHIVE); | ||
} |
8 changes: 8 additions & 0 deletions
8
Resources/Locale/en-US/InfinityStation/RoundEnd/no-eorg-popup.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
no-eorg-popup-title = A Love Letter to Infinity | ||
no-eorg-popup-label = Welcome to the End of Round | ||
no-eorg-popup-message = [bold]End-of-round grief (EORG)[/bold] is not allowed at A Love Letter to Infinity. Please stay in character until the lobby screen appears to maintain an immersive environment for everyone. Thank you for respecting the community rules! | ||
no-eorg-popup-rule = [bold][color=#a4885c]Rule G3: Do not grief or self-antagonize [/color][/bold] | ||
no-eorg-popup-rule-text = This includes attacking, destroying, polluting, and severely injuring without reason both at and on the way to Central Command. Remember that you are playing a character. | ||
no-eorg-popup-close-button = Sounds good! | ||
no-eorg-popup-close-button-wait = The close button will be enabled after {$time} seconds. | ||
no-eorg-popup-skip-checkbox = Don't show this again. |