Class LocalActionButtonExtensions
- Namespace
- MonkeyLoader.Resonite.UI
- Assembly
- MonkeyLoader.Resonite.Integration.dll
Contains extension methods to setup locally defined actions for FrooxEngine.IButtons which are triggerable by anyone.
Due to their nature, they will only work while the FrooxEngine.User that creates them hasn't left the session.
As such, they will be destroyed when the local user leaves, and won't be saved either (marking it non-persistent).
public static class LocalActionButtonExtensions
- Inheritance
-
LocalActionButtonExtensions
- Inherited Members
Methods
LocalActionButton(UIBuilder, in LocaleString, Action<Button>)
Creates a FrooxEngine.UIX.Button using the given text
and action
.
The action
will be triggerable by anyone, as long as the creating FrooxEngine.User hasn't left the session.
As such, it will be destroyed when the local user leaves, and won't be saved either (marking it non-persistent).
public static Button LocalActionButton(this UIBuilder builder, in LocaleString text, Action<Button> action)
Parameters
builder
UIBuilderThe builder to use for creating the button.
text
LocaleStringThe text displayed on the button.
action
Action<Button>The action to run when pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
LocalActionButton(UIBuilder, Uri, LocaleString, in colorX, in colorX, Action<Button>)
Creates a FrooxEngine.UIX.Button using the given text
,
icon
, tints and action
.
The action
will be triggerable by anyone, as long as the creating FrooxEngine.User hasn't left the session.
As such, it will be destroyed when the local user leaves, and won't be saved either (marking it non-persistent).
public static Button LocalActionButton(this UIBuilder builder, Uri icon, LocaleString text, in colorX tint, in colorX spriteTint, Action<Button> action)
Parameters
builder
UIBuilderThe builder to use for creating the button.
icon
UriThe icon displayed on the button.
text
LocaleStringThe text displayed on the button.
tint
colorXThe background color of the button.
spriteTint
colorXThe tint of the icon.
action
Action<Button>The action to run when pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
LocalActionButton(UIBuilder, Uri, LocaleString, Action<Button>)
Creates a FrooxEngine.UIX.Button using the given text
,
icon
and action
.
The action
will be triggerable by anyone, as long as the creating FrooxEngine.User hasn't left the session.
As such, it will be destroyed when the local user leaves, and won't be saved either (marking it non-persistent).
public static Button LocalActionButton(this UIBuilder builder, Uri icon, LocaleString text, Action<Button> action)
Parameters
builder
UIBuilderThe builder to use for creating the button.
icon
UriThe icon displayed on the button.
text
LocaleStringThe text displayed on the button.
action
Action<Button>The action to run when pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
LocalActionButton(UIBuilder, Uri, Action<Button>)
Creates a FrooxEngine.UIX.Button using the given icon
and action
.
The action
will be triggerable by anyone, as long as the creating FrooxEngine.User hasn't left the session.
As such, it will be destroyed when the local user leaves, and won't be saved either (marking it non-persistent).
public static Button LocalActionButton(this UIBuilder builder, Uri icon, Action<Button> action)
Parameters
builder
UIBuilderThe builder to use for creating the button.
icon
UriThe icon displayed on the button.
action
Action<Button>The action to run when pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
LocalActionButton<T>(UIBuilder, in LocaleString, Action<Button, T>, T)
Creates a FrooxEngine.UIX.Button using the given text
and action
with an extra argument
.
The action
will be triggerable by anyone, as long as the creating FrooxEngine.User hasn't left the session.
As such, it will be destroyed when the local user leaves, and won't be saved either (marking it non-persistent).
public static Button LocalActionButton<T>(this UIBuilder builder, in LocaleString text, Action<Button, T> action, T argument)
Parameters
builder
UIBuilderThe builder to use for creating the button.
text
LocaleStringThe text displayed on the button.
action
Action<Button, T>The action to run when pressed.
argument
TThe extra argument to pass to the action when this button is pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
Type Parameters
T
The type of the extra argument to pass to the action.
LocalActionButton<T>(UIBuilder, Uri, LocaleString, in colorX, in colorX, Action<Button, T>, T)
Creates a FrooxEngine.UIX.Button using the given text
,
icon
, tints and action
with an extra argument
.
The action
will be triggerable by anyone, as long as the creating FrooxEngine.User hasn't left the session.
As such, it will be destroyed when the local user leaves, and won't be saved either (marking it non-persistent).
public static Button LocalActionButton<T>(this UIBuilder builder, Uri icon, LocaleString text, in colorX tint, in colorX spriteTint, Action<Button, T> action, T argument)
Parameters
builder
UIBuilderThe builder to use for creating the button.
icon
UriThe icon displayed on the button.
text
LocaleStringThe text displayed on the button.
tint
colorXThe background color of the button.
spriteTint
colorXThe tint of the icon.
action
Action<Button, T>The action to run when pressed.
argument
TThe extra argument to pass to the action when this button is pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
Type Parameters
T
The type of the extra argument to pass to the action.
LocalActionButton<T>(UIBuilder, Uri, LocaleString, Action<Button, T>, T)
Creates a FrooxEngine.UIX.Button using the given text
,
icon
and action
with an extra argument
.
The action
will be triggerable by anyone, as long as the creating FrooxEngine.User hasn't left the session.
As such, it will be destroyed when the local user leaves, and won't be saved either (marking it non-persistent).
public static Button LocalActionButton<T>(this UIBuilder builder, Uri icon, LocaleString text, Action<Button, T> action, T argument)
Parameters
builder
UIBuilderThe builder to use for creating the button.
icon
UriThe icon displayed on the button.
text
LocaleStringThe text displayed on the button.
action
Action<Button, T>The action to run when pressed.
argument
TThe extra argument to pass to the action when this button is pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
Type Parameters
T
The type of the extra argument to pass to the action.
LocalActionButton<T>(UIBuilder, Uri, Action<Button, T>, T)
Creates a FrooxEngine.UIX.Button using the given icon
and action
with an extra argument
.
The action
will be triggerable by anyone, as long as the creating FrooxEngine.User hasn't left the session.
As such, it will be destroyed when the local user leaves, and won't be saved either (marking it non-persistent).
public static Button LocalActionButton<T>(this UIBuilder builder, Uri icon, Action<Button, T> action, T argument)
Parameters
builder
UIBuilderThe builder to use for creating the button.
icon
UriThe icon displayed on the button.
action
Action<Button, T>The action to run when pressed.
argument
TThe extra argument to pass to the action when this button is pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
Type Parameters
T
The type of the extra argument to pass to the action.
SetupLocalAction<TButton>(TButton, Action<TButton>)
Sets up an FrooxEngine.IButton with the given action
.
The action
will be triggerable by anyone, as long as the creating FrooxEngine.User hasn't left the session.
As such, it will be destroyed when the local user leaves, and won't be saved either (marking it non-persistent).
[Obsolete("Use WithLocalAction instead.")]
public static TButton SetupLocalAction<TButton>(this TButton button, Action<TButton> action) where TButton : IButton
Parameters
button
TButtonThe button to set up with an action.
action
Action<TButton>The action to run when pressed.
Returns
- TButton
The unchanged button.
Type Parameters
TButton
The specific type of the button.
SetupLocalAction<TButton, TArgument>(TButton, TArgument, Action<TButton, TArgument>)
Sets up an FrooxEngine.IButton with the given action
and extra argument
.
The action
will be triggerable by anyone, as long as the creating FrooxEngine.User hasn't left the session.
As such, it will be destroyed when the local user leaves, and won't be saved either (marking it non-persistent).
[Obsolete("Use WithLocalAction instead.")]
public static TButton SetupLocalAction<TButton, TArgument>(this TButton button, TArgument argument, Action<TButton, TArgument> action) where TButton : IButton
Parameters
button
TButtonThe button to set up with an action.
argument
TArgumentThe extra argument to pass to the action when this button is pressed.
action
Action<TButton, TArgument>The action to run when pressed.
Returns
- TButton
The unchanged button.
Type Parameters
TButton
The specific type of the button.
TArgument
The type of the extra argument to pass to the action.
WithLocalAction<TButton>(TButton, Action<TButton>)
Sets up an FrooxEngine.IButton with the given action
.
The action
will be triggerable by anyone, as long as the creating FrooxEngine.User hasn't left the session.
As such, it will be destroyed when the local user leaves, and won't be saved either (marking it non-persistent).
public static TButton WithLocalAction<TButton>(this TButton button, Action<TButton> action) where TButton : IButton
Parameters
button
TButtonThe button to set up with an action.
action
Action<TButton>The action to run when pressed.
Returns
- TButton
The unchanged button.
Type Parameters
TButton
The specific type of the button.
WithLocalAction<TButton, TArgument>(TButton, TArgument, Action<TButton, TArgument>)
Sets up an FrooxEngine.IButton with the given action
and extra argument
.
The action
will be triggerable by anyone, as long as the creating FrooxEngine.User hasn't left the session.
As such, it will be destroyed when the local user leaves, and won't be saved either (marking it non-persistent).
public static TButton WithLocalAction<TButton, TArgument>(this TButton button, TArgument argument, Action<TButton, TArgument> action) where TButton : IButton
Parameters
button
TButtonThe button to set up with an action.
argument
TArgumentThe extra argument to pass to the action when this button is pressed.
action
Action<TButton, TArgument>The action to run when pressed.
Returns
- TButton
The unchanged button.
Type Parameters
TButton
The specific type of the button.
TArgument
The type of the extra argument to pass to the action.
WithLocalTooltip<TButton>(TButton, LocaleString)
Sets up a local-only FrooxEngine.IButton with the given Elements.Core.LocaleString as a tooltip by registering it with the TooltipManager.
public static TButton WithLocalTooltip<TButton>(this TButton button, LocaleString label) where TButton : IButton
Parameters
button
TButtonThe local-only button to set up with a tooltip.
label
LocaleStringThe localized label to display as a tooltip.
Returns
- TButton
The unchanged button.
Type Parameters
TButton
The specific type of the button.
Remarks
This is the preferred overload to support localization on local-only buttons.
If a non-locale-key Elements.Core.LocaleString is passed in, the bare string is used as the label.
Exceptions
- InvalidOperationException
When the button is not local to the user.
WithTooltip<TButton>(TButton, LocaleString)
Sets up an FrooxEngine.IButton with the given Elements.Core.LocaleString as a tooltip.
public static TButton WithTooltip<TButton>(this TButton button, LocaleString label) where TButton : IButton
Parameters
button
TButtonThe button to set up with a tooltip.
label
LocaleStringThe localized label to display as a tooltip.
Returns
- TButton
The unchanged button.
Type Parameters
TButton
The specific type of the button.
Remarks
This is the preferred overload to support localization.
If a non-locale-key Elements.Core.LocaleString is passed in, the string
overload is used.
WithTooltip<TButton>(TButton, params Action<IField<string>>[])
Sets up an FrooxEngine.IButton with a FrooxEngine.StringConcatenationDriver
which concatenates the tooltip prefix and as many strings as necessary for setupFields
.
public static TButton WithTooltip<TButton>(this TButton button, params Action<IField<string>>[] setupFields) where TButton : IButton
Parameters
button
TButtonThe button to set up with a tooltip.
setupFields
Action<IField<string>>[]Actions to set up additional string fields to be concatenated together.
Returns
- TButton
The unchanged button.
Type Parameters
TButton
The specific type of the button.
Remarks
Primarily a helper method for the Elements.Core.LocaleString overload.
Try to keep localization in mind (i.e. by using
AssignLocaleString(IField<string>, LocaleString) to set up fields).
WithTooltip<TButton>(TButton, string)
Sets up an FrooxEngine.IButton with the given label as a tooltip.
public static TButton WithTooltip<TButton>(this TButton button, string label) where TButton : IButton
Parameters
button
TButtonThe button to set up with a tooltip.
label
stringThe label to display as a tooltip.
Returns
- TButton
The unchanged button.
Type Parameters
TButton
The specific type of the button.
Remarks
Prefer using the overload taking a Elements.Core.LocaleString to support localization.