Ghost roles: rule stuff (#5252)

* Ghost roles: Make the rules harder to miss

* Fix markup handling in ghost rule rules

* Apply suggestions
This commit is contained in:
20kdc
2021-11-12 04:23:06 +00:00
committed by GitHub
parent c5b26bcc80
commit baf4904060
4 changed files with 24 additions and 1 deletions

View File

@@ -4,17 +4,35 @@ using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.UserInterface.XAML;
using Robust.Shared.Localization;
using Robust.Shared.Timing;
using Robust.Shared.Utility;
namespace Content.Client.Ghost.Roles.UI
{
[GenerateTypedNameReferences]
public partial class GhostRoleRulesWindow : SS14Window
{
private float _timer = 5.0f;
public GhostRoleRulesWindow(string rules, Action<BaseButton.ButtonEventArgs> requestAction)
{
RobustXamlLoader.Load(this);
Title.SetMessage(rules);
Title.SetMessage(FormattedMessage.FromMarkupPermissive(rules + "\n" + Loc.GetString("ghost-roles-window-rules-footer")));
RequestButton.OnPressed += requestAction;
}
protected override void FrameUpdate(FrameEventArgs args)
{
base.FrameUpdate(args);
if (!RequestButton.Disabled) return;
if (_timer > 0.0)
{
_timer -= args.DeltaSeconds;
}
else
{
RequestButton.Disabled = false;
}
}
}
}