Remove combat mode component reference (#15206)
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
using System.Threading;
|
||||
using Content.Client.CombatMode;
|
||||
using Content.Client.Gameplay;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controllers;
|
||||
using Timer = Robust.Shared.Timing.Timer;
|
||||
|
||||
namespace Content.Client.ContextMenu.UI
|
||||
{
|
||||
/// <summary>
|
||||
@@ -13,7 +15,7 @@ namespace Content.Client.ContextMenu.UI
|
||||
/// <remarks>
|
||||
/// This largely involves setting up timers to open and close sub-menus when hovering over other menu elements.
|
||||
/// </remarks>
|
||||
public sealed class ContextMenuUIController : UIController, IOnStateEntered<GameplayState>, IOnStateExited<GameplayState>
|
||||
public sealed class ContextMenuUIController : UIController, IOnStateEntered<GameplayState>, IOnStateExited<GameplayState>, IOnSystemChanged<CombatModeSystem>
|
||||
{
|
||||
public static readonly TimeSpan HoverDelay = TimeSpan.FromSeconds(0.2);
|
||||
|
||||
@@ -206,5 +208,20 @@ namespace Content.Client.ContextMenu.UI
|
||||
|
||||
menu.InvalidateMeasure();
|
||||
}
|
||||
|
||||
private void OnCombatModeUpdated()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
public void OnSystemLoaded(CombatModeSystem system)
|
||||
{
|
||||
system.LocalPlayerCombatModeUpdated += OnCombatModeUpdated;
|
||||
}
|
||||
|
||||
public void OnSystemUnloaded(CombatModeSystem system)
|
||||
{
|
||||
system.LocalPlayerCombatModeUpdated -= OnCombatModeUpdated;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user