Skip to content

Commit

Permalink
Revert "Кнопка в правилах (#214)"
Browse files Browse the repository at this point in the history
This reverts commit 5ddc3cc.

# Conflicts:
#	Resources/Locale/ru-RU/info/rules.ftl
  • Loading branch information
MilenVolf committed Jun 10, 2024
1 parent 1207b67 commit ffaeaea
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 37 deletions.
7 changes: 0 additions & 7 deletions Content.Client/Info/RulesManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ public sealed class RulesManager : SharedRulesManager
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
[Dependency] private readonly INetManager _netManager = default!;
[Dependency] private readonly IEntitySystemManager _sysMan = default!;
[Dependency] private readonly IUriOpener _uri = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;

private InfoSection rulesSection = new InfoSection("", "", false);
private bool _shouldShowRules = false;
Expand Down Expand Up @@ -75,7 +73,6 @@ private void ShowRules(float time)

_activePopup.OnQuitPressed += OnQuitPressed;
_activePopup.OnAcceptPressed += OnAcceptPressed;
_activePopup.OnToWikiSend += OnToWikiSendPressed;
_userInterfaceManager.WindowRoot.AddChild(_activePopup);
LayoutContainer.SetAnchorPreset(_activePopup, LayoutContainer.LayoutPreset.Wide);
}
Expand All @@ -92,10 +89,6 @@ private void OnAcceptPressed()
_activePopup?.Orphan();
_activePopup = null;
}
private void OnToWikiSendPressed()
{
_uri.OpenUri(_cfg.GetCVar(CCVars.InfoLinksWikiRules));
}

public void UpdateRules()
{
Expand Down
4 changes: 1 addition & 3 deletions Content.Client/Info/RulesPopup.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Control xmlns="https://spacestation14.io"
<Control xmlns="https://spacestation14.io"
xmlns:parallax="clr-namespace:Content.Client.Parallax"
xmlns:info="clr-namespace:Content.Client.Info"
VerticalExpand="True" HorizontalExpand="True"
Expand All @@ -13,8 +13,6 @@
<info:RulesControl />
<Label Name="WaitLabel" />
<BoxContainer Orientation="Horizontal">
<Button Name ="ToWikiSend"
Text="{Loc 'ui-rules-wikirules'}" />
<Button Name="AcceptButton"
Text="{Loc 'ui-rules-accept'}"
Disabled="True" />
Expand Down
28 changes: 9 additions & 19 deletions Content.Client/Info/RulesPopup.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ namespace Content.Client.Info;
public sealed partial class RulesPopup : Control
{
private float _timer;
private bool _wikiPressed = false ;

public float Timer
{
Expand All @@ -26,15 +25,13 @@ public float Timer

public event Action? OnQuitPressed;
public event Action? OnAcceptPressed;
public event Action? OnToWikiSend;

public RulesPopup()
{
RobustXamlLoader.Load(this);

AcceptButton.OnPressed += OnAcceptButtonPressed;
QuitButton.OnPressed += OnQuitButtonPressed;
ToWikiSend.OnPressed += OnToWikiSendPressed;
}

private void OnQuitButtonPressed(BaseButton.ButtonEventArgs obj)
Expand All @@ -46,31 +43,24 @@ private void OnAcceptButtonPressed(BaseButton.ButtonEventArgs obj)
{
OnAcceptPressed?.Invoke();
}
private void OnToWikiSendPressed(BaseButton.ButtonEventArgs obj)
{
_wikiPressed = true;
OnToWikiSend?.Invoke();
}

protected override void FrameUpdate(FrameEventArgs args)
{
base.FrameUpdate(args);

if (!AcceptButton.Disabled)
return;
if (_wikiPressed)

if (Timer > 0.0)
{
if (Timer > 0.0)
{
if (Timer - args.DeltaSeconds < 0)
Timer = 0;
else
Timer -= args.DeltaSeconds;
}
if (Timer - args.DeltaSeconds < 0)
Timer = 0;
else
{
AcceptButton.Disabled = false;
}
Timer -= args.DeltaSeconds;
}
else
{
AcceptButton.Disabled = false;
}
}
}
6 changes: 0 additions & 6 deletions Content.Shared/CCVar/CCVars.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1954,12 +1954,6 @@ public static readonly CVarDef<float>
public static readonly CVarDef<string> InfoLinksWiki =
CVarDef.Create("infolinks.wiki", "", CVar.SERVER | CVar.REPLICATED);

/// <summary>
/// Link to wiki rules to show in the launcher.
/// </summary>
public static readonly CVarDef<string> InfoLinksWikiRules =
CVarDef.Create("infolinks.wikirules", "", CVar.SERVER | CVar.REPLICATED);

/// <summary>
/// Link to Patreon. Not shown in the launcher currently.
/// </summary>
Expand Down
1 change: 0 additions & 1 deletion Resources/Locale/en-US/info/rules.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ ui-rules-header-links = Links
ui-rules-roles = Roles wiki
ui-rules-discord = Discord
ui-rules-laws = Space Law
ui-rules-wikirules = Switch to rules
1 change: 0 additions & 1 deletion Resources/Locale/ru-RU/info/rules.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ ui-rules-header-links = Ссылки
ui-rules-roles = Вики ролей
ui-rules-discord = Discord
ui-rules-laws = Корпоративный Закон
ui-rules-wikirules = Открыть правила

0 comments on commit ffaeaea

Please sign in to comment.