-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathIMenuAPI.cs
More file actions
40 lines (37 loc) · 1.86 KB
/
IMenuAPI.cs
File metadata and controls
40 lines (37 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using System;
using System.Threading;
using CounterStrikeSharp.API.Core;
namespace CSSUniversalMenuAPI;
public interface IMenuAPI
{
/// <summary>
/// Create a menu root menu with no parent.
/// </summary>
/// <param name="player">The player to present this menu to.</param>
/// <param name="ct">A token to destroy this menu, such as on plugin unload.</param>
/// <returns>A menu which can be further manipulated, then displayed to the player.</returns>
IMenu CreateMenu(CCSPlayerController player, CancellationToken ct = default);
/// <summary>
/// Create a menu with a parent. This menu will be presented to the parent menu's root player.
/// </summary>
/// <param name="parent">The parent menu to this menu.</param>
/// <param name="ct">A token to destroy this menu, such as on plugin unload.</param>
/// <returns>A menu which can be further manipulated, then displayed to the player.</returns>
IMenu CreateMenu(IMenu parent, CancellationToken ct = default);
/// <summary>
/// Allow the plugin to query the implementations capabilities prior to creating any menus.
/// </summary>
/// <param name="extension">The type of the interface desired.</param>
/// <returns>True if the implementation supports the extension.</returns>
bool IsExtensionSupported(Type extension);
/// <summary>
/// Query whether the player has a menu open already.
/// Intended for use where we want to ask the player something, but we want to wait/not override
/// the current menu, without using the priority extension or such. <br/>
/// Note, providing access to the currently focused menu is intentionally not done. Plugins should not need to do this,
/// and may clobber other plugin's menus.
/// </summary>
/// <param name="player">The player of which to query.</param>
/// <returns>Whether the player has an active menu on their screen.</returns>
bool IsMenuOpen(CCSPlayerController player);
}