mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 11:40:52 +01:00
* Extension helper function for registering BUI events filtered to UI key. Usages of events like BoundUIClosedEvent frequently did not check the UI key or do it improperly. This has, and will continue to cause, bugs. The new helper (accessible as Subs.BuiEvents() from an entity system) makes it easy to subscribe to BUI events while also filtering to the correct UI key. Also added missing SubscribeLocalEvent overloads with new handler types to EntitySystem.Subscriptions. * Sprinkle [ViewVariables] around BUI * Avoid buggy behavior if a Bound UI is closed inside the `BoundUIOpenedEvent` that's opening it.
30 lines
796 B
C#
30 lines
796 B
C#
using System.Collections.Generic;
|
|
using JetBrains.Annotations;
|
|
using Robust.Shared.Player;
|
|
using Robust.Shared.ViewVariables;
|
|
|
|
namespace Robust.Shared.GameObjects
|
|
{
|
|
[RegisterComponent]
|
|
public sealed partial class ActiveUserInterfaceComponent : Component
|
|
{
|
|
[ViewVariables]
|
|
public HashSet<PlayerBoundUserInterface> Interfaces = new();
|
|
}
|
|
|
|
[PublicAPI]
|
|
public sealed class ServerBoundUserInterfaceMessage
|
|
{
|
|
[ViewVariables]
|
|
public BoundUserInterfaceMessage Message { get; }
|
|
[ViewVariables]
|
|
public ICommonSession Session { get; }
|
|
|
|
public ServerBoundUserInterfaceMessage(BoundUserInterfaceMessage message, ICommonSession session)
|
|
{
|
|
Message = message;
|
|
Session = session;
|
|
}
|
|
}
|
|
}
|