Class ContextMenuItemsGenerationEvent
- Namespace
- MonkeyLoader.Resonite.UI.ContextMenus
- Assembly
- MonkeyLoader.Resonite.Integration.dll
Represents a dispatchable base class for all events that generate a FrooxEngine.ContextMenu.
[DispatchableBaseEvent]
[SubscribableBaseEvent]
public abstract class ContextMenuItemsGenerationEvent : AsyncEvent
- Inheritance
-
ContextMenuItemsGenerationEvent
- Derived
- Inherited Members
Remarks
Use ContextMenuItemsGenerationEvent<T> for derived classes instead.
This class only exists as a subscribable catch-all event.
Properties
ContextMenu
Gets the FrooxEngine.ContextMenu being summoned.
public ContextMenu ContextMenu { get; }
Property Value
- ContextMenu
IsContextMenuOpen
Gets whether the ContextMenu is open.
public bool IsContextMenuOpen { get; }
Property Value
- bool
true if the ContextMenu is open; otherwise, false.
Summoner
Gets the FrooxEngine.IWorldElement that the ContextMenu is being summoned by.
public IWorldElement Summoner { get; }
Property Value
- IWorldElement
SummoningUser
Gets the FrooxEngine.User that the FrooxEngine.ContextMenu is being summoned for.
public User SummoningUser { get; }
Property Value
- User
Methods
AddConcreteEvent(Type, Func<ContextMenu, ContextMenuItemsGenerationEvent>, bool)
Adds the given constructorFunc
as a concrete derived event
constructor for summoners
of the summonerType
or a more derived type.
public static bool AddConcreteEvent(Type summonerType, Func<ContextMenu, ContextMenuItemsGenerationEvent> constructorFunc, bool replace = false)
Parameters
summonerType
TypeThe type of the summoners to use the
constructorFunc
for.constructorFunc
Func<ContextMenu, ContextMenuItemsGenerationEvent>A function that constructs the concrete ContextMenuItemsGenerationEvent<T>-derived instance with the given FrooxEngine.ContextMenu.
replace
booltrue if the given
constructorFunc
should replace one that's already present; otherwise, false.
Returns
AddConcreteEvent<TSummoner>(Func<ContextMenu, ContextMenuItemsGenerationEvent>, bool)
Adds the given constructorFunc
as a concrete derived event
constructor for summoners
of type TSummoner
or a more derived type.
public static bool AddConcreteEvent<TSummoner>(Func<ContextMenu, ContextMenuItemsGenerationEvent> constructorFunc, bool replace = false)
Parameters
constructorFunc
Func<ContextMenu, ContextMenuItemsGenerationEvent>A function that constructs the concrete ContextMenuItemsGenerationEvent<T>-derived instance with the given FrooxEngine.ContextMenu.
replace
booltrue if the given
constructorFunc
should replace one that's already present; otherwise, false.
Returns
Type Parameters
TSummoner
The type of the summoners to use the
constructorFunc
for.
CloseContextMenu()
Closes the SummoningUser's FrooxEngine.ContextMenu.
public void CloseContextMenu()
HasConcreteEvent(Type)
Determines whether there is a concrete derived event constructor for the given summonerType
.
public static bool HasConcreteEvent(Type summonerType)
Parameters
summonerType
TypeThe type of the summoners to check.
Returns
HasConcreteEvent(Type, out Func<ContextMenu, ContextMenuItemsGenerationEvent>?)
Determines whether there is a concrete derived event constructor for the given summonerType
.
public static bool HasConcreteEvent(Type summonerType, out Func<ContextMenu, ContextMenuItemsGenerationEvent>? constructorFunc)
Parameters
summonerType
TypeThe type of the summoners to check.
constructorFunc
Func<ContextMenu, ContextMenuItemsGenerationEvent>The function that constructs the concrete ContextMenuItemsGenerationEvent<T>-derived instance with the given FrooxEngine.ContextMenu if there is one; otherwise, null.
Returns
HasConcreteEvent<TSummoner>()
Determines whether there is a concrete derived event constructor for the type TSummoner
.
public static bool HasConcreteEvent<TSummoner>()
Returns
Type Parameters
TSummoner
The type of the summoners to check.
HasConcreteEvent<TSummoner>(out Func<ContextMenu, ContextMenuItemsGenerationEvent>?)
Determines whether there is a concrete derived event constructor for the type TSummoner
.
public static bool HasConcreteEvent<TSummoner>(out Func<ContextMenu, ContextMenuItemsGenerationEvent>? constructorFunc)
Parameters
constructorFunc
Func<ContextMenu, ContextMenuItemsGenerationEvent>The function that constructs the concrete ContextMenuItemsGenerationEvent<T>-derived instance with the given FrooxEngine.ContextMenu if there is one; otherwise, null.
Returns
Type Parameters
TSummoner
The type of the summoners to check.
OpenContextMenuAsync(Slot, ContextMenuOptions)
Ensures that the SummoningUser's FrooxEngine.ContextMenu
is open at the position determined by the pointer
using the given options
.
public Task<ContextMenu?> OpenContextMenuAsync(Slot pointer, ContextMenuOptions options = default)
Parameters
pointer
SlotThe slot that the FrooxEngine.ContextMenu will be centered at.
This is typically the slot of the FrooxEngine.TouchSource that triggered the opening.options
ContextMenuOptionsThe additional options for opening the menu.
Returns
Remarks
If options
.keepPosition
is true
the last position will be kept instead.
RemoveConcreteEvent(Type)
Removes the concrete derived event constructor for the given summonerType
.
public static bool RemoveConcreteEvent(Type summonerType)
Parameters
summonerType
TypeThe type of the summoners to remove the constructor function for.
Returns
RemoveConcreteEvent<TSummoner>()
Removes the concrete derived event constructor for the type TSummoner
.
public static bool RemoveConcreteEvent<TSummoner>()
Returns
Type Parameters
TSummoner
The type of the summoners to remove the constructor function for.
ToggleContextMenuAsync(Slot, ContextMenuOptions)
Opens the SummoningUser's FrooxEngine.ContextMenu
at the position determined by the pointer
using the given options
if it's not open already.
If it is open already, it will be closed instead.
public Task<ContextMenu?> ToggleContextMenuAsync(Slot pointer, ContextMenuOptions options = default)
Parameters
pointer
SlotThe slot that the FrooxEngine.ContextMenu will be centered at.
This is typically the slot of the FrooxEngine.TouchSource that triggered the opening.options
ContextMenuOptionsThe additional options for opening the menu.
Returns
- Task<ContextMenu>
The SummoningUser's newly opened FrooxEngine.ContextMenu, or
null
if opening failed or it was already open before.
Remarks
If options
.keepPosition
is true
the last position will be kept instead.