mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
Expand SharedUserInterfaceSystem API (#6342)
* Expand SharedUserInterfaceSystem API * addr reviews
This commit is contained in:
@@ -801,6 +801,41 @@ public abstract class SharedUserInterfaceSystem : EntitySystem
|
||||
return actors.Contains(actor);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if any of the specified UI keys are open for this entity by anyone.
|
||||
/// </summary>
|
||||
/// <param name="entity">The entity to check.</param>
|
||||
/// <param name="uiKeys">The UI keys to check.</param>
|
||||
/// <returns>True if any UI is open, false otherwise.</returns>
|
||||
[PublicAPI]
|
||||
public bool IsUiOpen(Entity<UserInterfaceComponent?> entity, IEnumerable<Enum> uiKeys)
|
||||
{
|
||||
if (!UIQuery.Resolve(entity.Owner, ref entity.Comp, false))
|
||||
return false;
|
||||
|
||||
foreach (var key in uiKeys)
|
||||
{
|
||||
if (entity.Comp.Actors.ContainsKey(key))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if any UI is open for this entity by anyone.
|
||||
/// </summary>
|
||||
/// <param name="entity">The entity to check.</param>
|
||||
/// <returns>True if any UI is open, false otherwise.</returns>
|
||||
[PublicAPI]
|
||||
public bool IsAnyUiOpen(Entity<UserInterfaceComponent?> entity)
|
||||
{
|
||||
if (!UIQuery.Resolve(entity.Owner, ref entity.Comp, false))
|
||||
return false;
|
||||
|
||||
return entity.Comp.Actors.Count > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Raises a BUI message locally (on client or server) without networking it.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user