Звуковое оповещение новых ролей для призраков и вынос правил в отдельную кнопку.
This commit is contained in:
parent
371693fe44
commit
dbfa90e956
11 changed files with 57 additions and 59 deletions
|
|
@ -1,9 +1,11 @@
|
|||
using Content.Client.Movement.Systems;
|
||||
using Content.Shared.Actions;
|
||||
using Content.Shared.Ghost;
|
||||
using Robust.Client.Audio;
|
||||
using Robust.Client.Console;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Player;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.Player;
|
||||
|
||||
namespace Content.Client.Ghost
|
||||
|
|
@ -14,6 +16,7 @@ namespace Content.Client.Ghost
|
|||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly SharedActionsSystem _actions = default!;
|
||||
[Dependency] private readonly ContentEyeSystem _contentEye = default!;
|
||||
[Dependency] private readonly AudioSystem _audioSystem = default!;
|
||||
|
||||
public int AvailableGhostRoleCount { get; private set; }
|
||||
|
||||
|
|
@ -156,6 +159,17 @@ namespace Content.Client.Ghost
|
|||
|
||||
private void OnUpdateGhostRoleCount(GhostUpdateGhostRoleCountEvent msg)
|
||||
{
|
||||
|
||||
if (msg.AvailableGhostRoles > AvailableGhostRoleCount && IsGhost)
|
||||
{
|
||||
_audioSystem.PlayGlobal(
|
||||
"/Audio/_Sunrise/Misc/ping.ogg",
|
||||
Filter.Local(),
|
||||
false,
|
||||
new AudioParams().WithVolume(10f)
|
||||
);
|
||||
}
|
||||
|
||||
AvailableGhostRoleCount = msg.AvailableGhostRoles;
|
||||
GhostRoleCountUpdated?.Invoke(msg);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls.Roles
|
|||
{
|
||||
private SpriteSystem _spriteSystem;
|
||||
public event Action<GhostRoleInfo>? OnRoleSelected;
|
||||
public event Action<GhostRoleInfo>? OnRoleRules;
|
||||
public event Action<GhostRoleInfo>? OnRoleFollow;
|
||||
|
||||
public GhostRoleButtonsBox(bool hasAccess, FormattedMessage? reason, IEnumerable<GhostRoleInfo> roles, SpriteSystem spriteSystem)
|
||||
|
|
@ -25,6 +26,7 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls.Roles
|
|||
{
|
||||
var button = new GhostRoleEntryButtons(role);
|
||||
button.RequestButton.OnPressed += _ => OnRoleSelected?.Invoke(role);
|
||||
button.RulesButton.OnPressed += _ => OnRoleRules?.Invoke(role);
|
||||
button.FollowButton.OnPressed += _ => OnRoleFollow?.Invoke(role);
|
||||
|
||||
if (!hasAccess)
|
||||
|
|
|
|||
|
|
@ -6,10 +6,17 @@
|
|||
Text="{Loc 'ghost-roles-window-request-role-button'}"
|
||||
StyleClasses="OpenRight"
|
||||
HorizontalExpand="True"
|
||||
SizeFlagsStretchRatio="3"/>
|
||||
SizeFlagsStretchRatio="2"/>
|
||||
<Button Name="RulesButton"
|
||||
Access="Public"
|
||||
Text="{Loc 'ghost-roles-window-rules-role-button'}"
|
||||
StyleClasses="OpenBoth"
|
||||
HorizontalExpand="True"
|
||||
SizeFlagsStretchRatio="1"/>
|
||||
<Button Name="FollowButton"
|
||||
Access="Public"
|
||||
Text="{Loc 'ghost-roles-window-follow-role-button'}"
|
||||
StyleClasses="OpenLeft"
|
||||
HorizontalExpand="True"/>
|
||||
HorizontalExpand="True"
|
||||
SizeFlagsStretchRatio="1"/>
|
||||
</BoxContainer>
|
||||
|
|
|
|||
|
|
@ -5,11 +5,5 @@
|
|||
<BoxContainer Orientation="Vertical"
|
||||
HorizontalExpand="True">
|
||||
<RichTextLabel Name="TopBanner" VerticalExpand="True"/>
|
||||
<Button Name="RequestButton"
|
||||
Text="{Loc 'ghost-roles-window-request-role-button'}"
|
||||
Disabled="True"
|
||||
TextAlign="Center"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center" />
|
||||
</BoxContainer>
|
||||
</DefaultWindow>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
using Content.Shared.CCVar;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Client.UserInterface.Systems.Ghost.Controls.Roles
|
||||
|
|
@ -12,40 +8,10 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls.Roles
|
|||
[GenerateTypedNameReferences]
|
||||
public sealed partial class GhostRoleRulesWindow : DefaultWindow
|
||||
{
|
||||
[Dependency] private readonly IConfigurationManager _cfg = IoCManager.Resolve<IConfigurationManager>();
|
||||
private float _timer;
|
||||
|
||||
public GhostRoleRulesWindow(string rules, Action<BaseButton.ButtonEventArgs> requestAction)
|
||||
public GhostRoleRulesWindow(string rules)
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
var ghostRoleTime = _cfg.GetCVar(CCVars.GhostRoleTime);
|
||||
_timer = ghostRoleTime;
|
||||
|
||||
if (ghostRoleTime > 0f)
|
||||
{
|
||||
RequestButton.Text = Loc.GetString("ghost-roles-window-request-role-button-timer", ("time", $"{_timer:0.0}"));
|
||||
TopBanner.SetMessage(FormattedMessage.FromMarkupPermissive(rules + "\n" + Loc.GetString("ghost-roles-window-rules-footer", ("time", ghostRoleTime))));
|
||||
RequestButton.Disabled = true;
|
||||
}
|
||||
|
||||
RequestButton.OnPressed += requestAction;
|
||||
}
|
||||
|
||||
|
||||
protected override void FrameUpdate(FrameEventArgs args)
|
||||
{
|
||||
base.FrameUpdate(args);
|
||||
if (!RequestButton.Disabled) return;
|
||||
if (_timer > 0.0)
|
||||
{
|
||||
_timer -= args.DeltaSeconds;
|
||||
RequestButton.Text = Loc.GetString("ghost-roles-window-request-role-button-timer", ("time", $"{_timer:0.0}"));
|
||||
}
|
||||
else
|
||||
{
|
||||
RequestButton.Disabled = false;
|
||||
RequestButton.Text = Loc.GetString("ghost-roles-window-request-role-button");
|
||||
}
|
||||
TopBanner.SetMessage(FormattedMessage.FromMarkupPermissive(rules));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,33 +16,28 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls.Roles
|
|||
private GhostRoleRulesWindow? _windowRules = null;
|
||||
private uint _windowRulesId = 0;
|
||||
|
||||
private ISharedSponsorsManager? _sponsorsManager; // Sunrise-Sponsors
|
||||
|
||||
public GhostRolesEui()
|
||||
{
|
||||
IoCManager.Instance!.TryResolveType(out _sponsorsManager); // Sunrise-Sponsors
|
||||
|
||||
_window = new GhostRolesWindow();
|
||||
|
||||
_window.OnRoleRequestButtonClicked += info =>
|
||||
{
|
||||
_windowRules?.Close();
|
||||
|
||||
if (info.Kind == GhostRoleKind.RaffleJoined)
|
||||
{
|
||||
SendMessage(new LeaveGhostRoleRaffleMessage(info.Identifier));
|
||||
return;
|
||||
}
|
||||
|
||||
_windowRules = new GhostRoleRulesWindow(info.Rules, _ =>
|
||||
{
|
||||
SendMessage(new RequestGhostRoleMessage(info.Identifier));
|
||||
SendMessage(new RequestGhostRoleMessage(info.Identifier));
|
||||
|
||||
// if raffle role, close rules window on request, otherwise do
|
||||
// old behavior of waiting for the server to close it
|
||||
if (info.Kind != GhostRoleKind.FirstComeFirstServe)
|
||||
_windowRules?.Close();
|
||||
});
|
||||
if (info.Kind != GhostRoleKind.FirstComeFirstServe)
|
||||
_windowRules?.Close();
|
||||
};
|
||||
|
||||
_window.OnRoleRulesButtonClicked += info =>
|
||||
{
|
||||
_windowRules?.Close();
|
||||
_windowRules = new GhostRoleRulesWindow(info.Rules);
|
||||
_windowRulesId = info.Identifier;
|
||||
_windowRules.OnClose += () =>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls.Roles
|
|||
public sealed partial class GhostRolesWindow : DefaultWindow
|
||||
{
|
||||
public event Action<GhostRoleInfo>? OnRoleRequestButtonClicked;
|
||||
public event Action<GhostRoleInfo>? OnRoleRulesButtonClicked;
|
||||
public event Action<GhostRoleInfo>? OnRoleFollow;
|
||||
|
||||
private Dictionary<string, Collapsible> _collapsibleBoxes = new();
|
||||
|
|
@ -60,6 +61,7 @@ namespace Content.Client.UserInterface.Systems.Ghost.Controls.Roles
|
|||
var info = new GhostRoleInfoBox(name, description);
|
||||
var buttons = new GhostRoleButtonsBox(hasAccess, reason, ghostRoleInfos, spriteSystem);
|
||||
buttons.OnRoleSelected += OnRoleRequestButtonClicked;
|
||||
buttons.OnRoleRules += OnRoleRulesButtonClicked;
|
||||
buttons.OnRoleFollow += OnRoleFollow;
|
||||
|
||||
EntryContainer.AddChild(info);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ using Content.Client._Sunrise.ServersHub;
|
|||
using Content.Shared._Sunrise.SunriseCCVars;
|
||||
using Content.Sunrise.Interfaces.Shared;
|
||||
using Robust.Shared.Configuration;
|
||||
using Content.Shared._Sunrise.NewLife; // Sunrise-Edit
|
||||
using Content.Shared._Sunrise.NewLife;
|
||||
|
||||
namespace Content.Client.UserInterface.Systems.Ghost;
|
||||
|
||||
|
|
|
|||
BIN
Resources/Audio/_Sunrise/Misc/ping.ogg
Normal file
BIN
Resources/Audio/_Sunrise/Misc/ping.ogg
Normal file
Binary file not shown.
|
|
@ -6721,3 +6721,20 @@
|
|||
type: Tweak
|
||||
id: 468
|
||||
time: '2024-11-29T00:05:43.211310+00:00'
|
||||
- author: VigersRay
|
||||
changes:
|
||||
- message: "\u0411\u043E\u043B\u044C\u0448\u0435 \u043D\u0435 \u043D\u0443\u0436\
|
||||
\u043D\u043E \u0447\u0438\u0442\u0430\u0442\u044C \u043F\u0440\u0430\u0432\u0438\
|
||||
\u043B\u0430 \u043A\u0430\u0436\u0434\u044B\u0439 \u0440\u0430\u0437 \u043F\u0440\
|
||||
\u0438 \u0437\u0430\u043F\u0440\u043E\u0441\u0435 \u0440\u043E\u043B\u0438 \u0434\
|
||||
\u043B\u044F \u043F\u0440\u0438\u0437\u0440\u0430\u043A\u043E\u0432."
|
||||
type: Tweak
|
||||
- message: "\u041F\u0440\u0438 \u043F\u043E\u044F\u0432\u043B\u0435\u043D\u0438\u0438\
|
||||
\ \u043D\u043E\u0432\u044B\u0445 \u0440\u043E\u043B\u0435\u0439 \u0434\u043B\
|
||||
\u044F \u043F\u0440\u0438\u0437\u0440\u0430\u043A\u043E\u0432 \u043E\u043D\u0438\
|
||||
\ \u0431\u0443\u0434\u0443\u0442 \u043F\u043E\u043B\u0443\u0447\u0430\u0442\u044C\
|
||||
\ \u0437\u0432\u0443\u043A\u043E\u0432\u043E\u0435 \u043E\u043F\u043E\u0432\u0435\
|
||||
\u0449\u0435\u043D\u0438\u0435."
|
||||
type: Tweak
|
||||
id: 469
|
||||
time: '2024-11-29T01:35:03.138795+00:00'
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ ghost-roles-window-leave-raffle-button =
|
|||
})
|
||||
ghost-roles-window-request-role-button = Запросить
|
||||
ghost-roles-window-request-role-button-timer = Запросить ({ $time }сек.)
|
||||
ghost-roles-window-rules-role-button = Правила
|
||||
ghost-roles-window-follow-role-button = Следовать
|
||||
ghost-roles-window-no-roles-available-label = В настоящее время нет доступных ролей призраков.
|
||||
ghost-roles-window-rules-footer = Кнопка станет доступна через { $time } секунд (эта задержка нужна, чтобы убедиться, что вы прочитали правила).
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue