Skip to content

Commit a65d072

Browse files
Add IFocusMenuExtension extension
This will allow plugins to express that a menu should not take focus away from a player without the player doing something to enable that focus. Also included is the ability to query its focus state, for whether you want to time a menu out in the case it has never been focused or such. Co-authored-by: Dawid "daffyyyy" Bepierszcz <41084667+daffyyyy@users.noreply.github.com>
1 parent f99737f commit a65d072

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
namespace CSSUniversalMenuAPI.Extensions;
2+
3+
/// <summary>
4+
/// Allow a menu or a notification to be presented to a player, but without taking focus from the player. <br/>
5+
/// This should be used when you want to present a menu to a player who may not be expecting it, such as votes.
6+
/// </summary>
7+
public interface IFocusMenuExtension
8+
{
9+
/// <summary>
10+
/// When <c>true</c>, the menu shall open in a state where the player can see it, or see a notification,
11+
/// but require further action to be manipulate. It is expected that this would be a key that requires pressing
12+
/// to toggle the menu.<br/>
13+
///<br/>
14+
/// Implementations should default this value to <c>true</c>.
15+
/// </summary>
16+
bool OpenWithFocus { get; }
17+
18+
/// <summary>
19+
/// Returns whether or not the player's input is to be received by this menu if it were visible. <br/>
20+
/// Whether the menu is being occluded by another menu should have no bearing on this value.
21+
/// </summary>
22+
bool HasFocus { get; }
23+
24+
/// <summary>
25+
/// Returns whether or not this menu's input has never been focused, enabling scenarios such as timing out a menu if
26+
/// it has received no interaction from the player.
27+
/// </summary>
28+
bool NeverHadFocus { get; }
29+
}

0 commit comments

Comments
 (0)