Class LocalActionButtonExtensions
- Namespace
- MonkeyLoader.Resonite.UI
- Assembly
- MonkeyLoader.Resonite.Core.dll
Contains extension methods to setup locally defined actions for FrooxEngine.IButtons which are triggerable by anyone.
public static class LocalActionButtonExtensions
- Inheritance
-
LocalActionButtonExtensions
- Inherited Members
Remarks
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 (by marking them non-persistent).
Fields
CommentTextPrefix
The prefix that a FrooxEngine.Comment's text must have to define a tooltip label.
public const string CommentTextPrefix = "TooltipperyLabel:"
Field Value
Methods
LocalActionButton(UIBuilder, in LocaleString, Action<Button>)
Creates a FrooxEngine.UIX.Button with text, and adds a local action to it using the given parameters.
public static Button LocalActionButton(this UIBuilder builder, in LocaleString text, Action<Button> action)
Parameters
builderUIBuildertextLocaleStringactionAction<Button>
Returns
- Button
LocalActionButton(UIBuilder, in LocaleString, in colorX?, Action<Button>)
Creates a FrooxEngine.UIX.Button with text, and adds a local action to it using the given parameters.
public static Button LocalActionButton(this UIBuilder builder, in LocaleString text, in colorX? buttonTint, Action<Button> action)
Parameters
builderUIBuildertextLocaleStringbuttonTintcolorX?actionAction<Button>
Returns
- Button
LocalActionButton(UIBuilder, IAssetProvider<Sprite>, in LocaleString, Action<Button>)
Creates a FrooxEngine.UIX.Button with a sprite and text, and adds a local action to it using the given parameters.
public static Button LocalActionButton(this UIBuilder builder, IAssetProvider<Sprite> sprite, in LocaleString text, Action<Button> action)
Parameters
builderUIBuilderThe builder to use for creating the button.
spriteIAssetProvider<Sprite>The sprite displayed on the button.
textLocaleStringThe text displayed on the button.
actionAction<Button>The action to run when pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
Remarks
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 (by marking the button's slot non-persistent).
LocalActionButton(UIBuilder, IAssetProvider<Sprite>, in colorX, in LocaleString, Action<Button>, float, float)
Creates a FrooxEngine.UIX.Button with a sprite and text, and adds a local action to it using the given parameters.
public static Button LocalActionButton(this UIBuilder builder, IAssetProvider<Sprite> sprite, in colorX spriteTint, in LocaleString text, Action<Button> action, float buttonTextSplit = 0.33333, float buttonTextSplitGap = 0.05)
Parameters
builderUIBuilderThe builder to use for creating the button.
spriteIAssetProvider<Sprite>The sprite displayed on the button.
spriteTintcolorXThe tint of the sprite.
textLocaleStringThe text displayed on the button.
actionAction<Button>The action to run when pressed.
buttonTextSplitfloatThe ratio of the button to use for the sprite.
buttonTextSplitGapfloatThe ratio of the button to keep as space between sprite and text. The sprite and text ratios are decreased by half of it.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
Remarks
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 (by marking the button's slot non-persistent).
LocalActionButton(UIBuilder, IAssetProvider<Sprite>, in colorX?, in colorX, Action<Button>)
Creates a FrooxEngine.UIX.Button with a sprite, and adds a local action to it using the given parameters.
public static Button LocalActionButton(this UIBuilder builder, IAssetProvider<Sprite> sprite, in colorX? buttonTint, in colorX spriteTint, Action<Button> action)
Parameters
builderUIBuilderThe builder to use for creating the button.
spriteIAssetProvider<Sprite>The sprite displayed on the button.
buttonTintcolorX?The background color of the button.
spriteTintcolorXThe tint of the sprite.
actionAction<Button>The action to run when pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
Remarks
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 (by marking the button's slot non-persistent).
LocalActionButton(UIBuilder, Uri, in LocaleString, in colorX, in colorX, Action<Button>)
Creates a FrooxEngine.UIX.Button with a sprite and text, and adds a local action to it using the given parameters.
public static Button LocalActionButton(this UIBuilder builder, Uri spriteUrl, in LocaleString text, in colorX buttonTint, in colorX spriteTint, Action<Button> action)
Parameters
builderUIBuilderThe builder to use for creating the button.
spriteUrlUriThe url for the sprite displayed on the button.
textLocaleStringThe text displayed on the button.
buttonTintcolorXThe background color of the button.
spriteTintcolorXThe tint of the sprite.
actionAction<Button>The action to run when pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
Remarks
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 (by marking the button's slot non-persistent).
LocalActionButton(UIBuilder, Uri, in LocaleString, Action<Button>)
Creates a FrooxEngine.UIX.Button with a sprite and text, and adds a local action to it using the given parameters.
public static Button LocalActionButton(this UIBuilder builder, Uri spriteUrl, in LocaleString text, Action<Button> action)
Parameters
builderUIBuilderThe builder to use for creating the button.
spriteUrlUriThe url for the sprite displayed on the button.
textLocaleStringThe text displayed on the button.
actionAction<Button>The action to run when pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
Remarks
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 (by marking the button's slot non-persistent).
LocalActionButton(UIBuilder, Uri, in colorX, in colorX, Action<Button>)
Creates a FrooxEngine.UIX.Button with a sprite and
adds
a local action to it using the given parameters and extra argument.
public static Button LocalActionButton(this UIBuilder builder, Uri spriteUrl, in colorX buttonTint, in colorX spriteTint, Action<Button> action)
Parameters
builderUIBuilderThe builder to use for creating the button.
spriteUrlUriThe url for the sprite displayed on the button.
buttonTintcolorXThe background color of the button.
spriteTintcolorXThe tint of the sprite.
actionAction<Button>The action to run when pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
Remarks
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 (by marking the button's slot non-persistent).
LocalActionButton(UIBuilder, Uri, in colorX, Action<Button>)
Creates a FrooxEngine.UIX.Button with a sprite and
adds
a local action to it using the given parameters and extra argument.
public static Button LocalActionButton(this UIBuilder builder, Uri spriteUrl, in colorX buttonTint, Action<Button> action)
Parameters
builderUIBuilderThe builder to use for creating the button.
spriteUrlUriThe url for the sprite displayed on the button.
buttonTintcolorXThe background color of the button.
actionAction<Button>The action to run when pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
Remarks
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 (by marking the button's slot non-persistent).
LocalActionButton(UIBuilder, Uri, Action<Button>)
Creates a FrooxEngine.UIX.Button with a sprite, and adds a local action to it using the given parameters.
public static Button LocalActionButton(this UIBuilder builder, Uri spriteUrl, Action<Button> action)
Parameters
builderUIBuilderThe builder to use for creating the button.
spriteUrlUriThe url for the sprite displayed on the button.
actionAction<Button>The action to run when pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
Remarks
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 (by marking the button's slot non-persistent).
LocalActionButton<T>(UIBuilder, in LocaleString, Action<Button, T>, T)
Creates a FrooxEngine.UIX.Button with text, and
adds
a local action to it using the given parameters and extra argument.
public static Button LocalActionButton<T>(this UIBuilder builder, in LocaleString text, Action<Button, T> action, T argument)
Parameters
builderUIBuilderThe builder to use for creating the button.
textLocaleStringThe text displayed on the button.
actionAction<Button, T>The action to run when pressed.
argumentTThe extra argument to pass to the action when this button is pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
Type Parameters
TThe type of the extra argument to pass to the action.
Remarks
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 (by marking the button's slot non-persistent).
LocalActionButton<T>(UIBuilder, in LocaleString, in colorX?, Action<Button, T>, T)
Creates a FrooxEngine.UIX.Button with text, and
adds
a local action to it using the given parameters and extra argument.
public static Button LocalActionButton<T>(this UIBuilder builder, in LocaleString text, in colorX? buttonTint, Action<Button, T> action, T argument)
Parameters
builderUIBuilderThe builder to use for creating the button.
textLocaleStringThe text displayed on the button.
buttonTintcolorX?The background color of the button.
actionAction<Button, T>The action to run when pressed.
argumentTThe extra argument to pass to the action when this button is pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
Type Parameters
TThe type of the extra argument to pass to the action.
Remarks
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 (by marking the button's slot non-persistent).
LocalActionButton<T>(UIBuilder, IAssetProvider<Sprite>, in LocaleString, Action<Button, T>, T)
Creates a FrooxEngine.UIX.Button with a sprite and text, and
adds
a local action to it using the given parameters and extra argument.
public static Button LocalActionButton<T>(this UIBuilder builder, IAssetProvider<Sprite> sprite, in LocaleString text, Action<Button, T> action, T argument)
Parameters
builderUIBuilderThe builder to use for creating the button.
spriteIAssetProvider<Sprite>The sprite displayed on the button.
textLocaleStringThe text displayed on the button.
actionAction<Button, T>The action to run when pressed.
argumentTThe extra argument to pass to the action when this button is pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
Type Parameters
TThe type of the extra argument to pass to the action.
Remarks
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 (by marking the button's slot non-persistent).
LocalActionButton<T>(UIBuilder, IAssetProvider<Sprite>, in colorX, in LocaleString, Action<Button, T>, T, float, float)
Creates a FrooxEngine.UIX.Button with a sprite and text, and
adds
a local action to it using the given parameters and extra argument.
public static Button LocalActionButton<T>(this UIBuilder builder, IAssetProvider<Sprite> sprite, in colorX spriteTint, in LocaleString text, Action<Button, T> action, T argument, float buttonTextSplit = 0.33333, float buttonTextSplitGap = 0.05)
Parameters
builderUIBuilderThe builder to use for creating the button.
spriteIAssetProvider<Sprite>The sprite displayed on the button.
spriteTintcolorXThe tint of the sprite.
textLocaleStringThe text displayed on the button.
actionAction<Button, T>The action to run when pressed.
argumentTThe extra argument to pass to the action when this button is pressed.
buttonTextSplitfloatThe ratio of the button to use for the sprite.
buttonTextSplitGapfloatThe ratio of the button to keep as space between sprite and text. The sprite and text ratios are decreased by half of it.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
Type Parameters
TThe type of the extra argument to pass to the action.
Remarks
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 (by marking the button's slot non-persistent).
LocalActionButton<T>(UIBuilder, IAssetProvider<Sprite>, in colorX?, in colorX, Action<Button, T>, T)
Creates a FrooxEngine.UIX.Button with a sprite and
adds
a local action to it using the given parameters and extra argument.
public static Button LocalActionButton<T>(this UIBuilder builder, IAssetProvider<Sprite> sprite, in colorX? buttonTint, in colorX spriteTint, Action<Button, T> action, T argument)
Parameters
builderUIBuilderThe builder to use for creating the button.
spriteIAssetProvider<Sprite>The sprite displayed on the button.
buttonTintcolorX?The background color of the button.
spriteTintcolorXThe tint of the sprite.
actionAction<Button, T>The action to run when pressed.
argumentTThe extra argument to pass to the action when this button is pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
Type Parameters
TThe type of the extra argument to pass to the action.
Remarks
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 (by marking the button's slot non-persistent).
LocalActionButton<T>(UIBuilder, Uri, in LocaleString, in colorX, in colorX, Action<Button, T>, T)
Creates a FrooxEngine.UIX.Button with a sprite and text, and
adds
a local action to it using the given parameters and extra argument.
public static Button LocalActionButton<T>(this UIBuilder builder, Uri spriteUrl, in LocaleString text, in colorX buttonTint, in colorX spriteTint, Action<Button, T> action, T argument)
Parameters
builderUIBuilderThe builder to use for creating the button.
spriteUrlUriThe url for the sprite displayed on the button.
textLocaleStringThe text displayed on the button.
buttonTintcolorXThe background color of the button.
spriteTintcolorXThe tint of the sprite.
actionAction<Button, T>The action to run when pressed.
argumentTThe extra argument to pass to the action when this button is pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
Type Parameters
TThe type of the extra argument to pass to the action.
Remarks
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 (by marking the button's slot non-persistent).
LocalActionButton<T>(UIBuilder, Uri, in LocaleString, Action<Button, T>, T)
Creates a FrooxEngine.UIX.Button with a sprite and text, and
adds
a local action to it using the given parameters and extra argument.
public static Button LocalActionButton<T>(this UIBuilder builder, Uri spriteUrl, in LocaleString text, Action<Button, T> action, T argument)
Parameters
builderUIBuilderThe builder to use for creating the button.
spriteUrlUriThe url for the sprite displayed on the button.
textLocaleStringThe text displayed on the button.
actionAction<Button, T>The action to run when pressed.
argumentTThe extra argument to pass to the action when this button is pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
Type Parameters
TThe type of the extra argument to pass to the action.
Remarks
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 (by marking the button's slot non-persistent).
LocalActionButton<T>(UIBuilder, Uri, in colorX, in colorX, Action<Button, T>, T)
Creates a FrooxEngine.UIX.Button with a sprite and
adds
a local action to it using the given parameters and extra argument.
public static Button LocalActionButton<T>(this UIBuilder builder, Uri spriteUrl, in colorX buttonTint, in colorX spriteTint, Action<Button, T> action, T argument)
Parameters
builderUIBuilderThe builder to use for creating the button.
spriteUrlUriThe url for the sprite displayed on the button.
buttonTintcolorXThe background color of the button.
spriteTintcolorXThe tint of the sprite.
actionAction<Button, T>The action to run when pressed.
argumentTThe extra argument to pass to the action when this button is pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
Type Parameters
TThe type of the extra argument to pass to the action.
Remarks
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 (by marking the button's slot non-persistent).
LocalActionButton<T>(UIBuilder, Uri, in colorX, Action<Button, T>, T)
Creates a FrooxEngine.UIX.Button with a sprite and
adds
a local action to it using the given parameters and extra argument.
public static Button LocalActionButton<T>(this UIBuilder builder, Uri spriteUrl, in colorX buttonTint, Action<Button, T> action, T argument)
Parameters
builderUIBuilderThe builder to use for creating the button.
spriteUrlUriThe url for the sprite displayed on the button.
buttonTintcolorXThe background color of the button.
actionAction<Button, T>The action to run when pressed.
argumentTThe extra argument to pass to the action when this button is pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
Type Parameters
TThe type of the extra argument to pass to the action.
Remarks
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 (by marking the button's slot non-persistent).
LocalActionButton<T>(UIBuilder, Uri, Action<Button, T>, T)
Creates a FrooxEngine.UIX.Button with a sprite and
adds
a local action to it using the given parameters and extra argument.
public static Button LocalActionButton<T>(this UIBuilder builder, Uri spriteUrl, Action<Button, T> action, T argument)
Parameters
builderUIBuilderThe builder to use for creating the button.
spriteUrlUriThe url for the sprite displayed on the button.
actionAction<Button, T>The action to run when pressed.
argumentTThe extra argument to pass to the action when this button is pressed.
Returns
- Button
The button created by the FrooxEngine.UIX.UIBuilder.
Type Parameters
TThe type of the extra argument to pass to the action.
Remarks
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 (by marking the button's slot non-persistent).
WithLocalAction<TButton>(TButton, Action<TButton>)
Sets up an FrooxEngine.IButton with the given action.
public static TButton WithLocalAction<TButton>(this TButton button, Action<TButton> action) where TButton : IButton
Parameters
buttonTButtonThe button to set up with an action.
actionAction<TButton>The action to run when pressed.
Returns
- TButton
The unchanged button.
Type Parameters
TButtonThe specific type of the button.
Remarks
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 (by marking the button's slot non-persistent).
WithLocalAction<TButton, TArgument>(TButton, TArgument, Action<TButton, TArgument>)
Sets up an FrooxEngine.IButton with the given action and extra argument.
public static TButton WithLocalAction<TButton, TArgument>(this TButton button, TArgument argument, Action<TButton, TArgument> action) where TButton : IButton
Parameters
buttonTButtonThe button to set up with an action.
argumentTArgumentThe extra argument to pass to the action when this button is pressed.
actionAction<TButton, TArgument>The action to run when pressed.
Returns
- TButton
The unchanged button.
Type Parameters
TButtonThe specific type of the button.
TArgumentThe type of the extra argument to pass to the action.
Remarks
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 (by marking the button's slot non-persistent).
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
buttonTButtonThe local-only button to set up with a tooltip.
labelLocaleStringThe localized label to display as a tooltip.
Returns
- TButton
The unchanged button.
Type Parameters
TButtonThe 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
buttonTButtonThe button to set up with a tooltip.
labelLocaleStringThe localized label to display as a tooltip.
Returns
- TButton
The unchanged button.
Type Parameters
TButtonThe 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
buttonTButtonThe button to set up with a tooltip.
setupFieldsAction<IField<string>>[]Actions to set up additional string fields to be concatenated together.
Returns
- TButton
The unchanged button.
Type Parameters
TButtonThe 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
buttonTButtonThe button to set up with a tooltip.
labelstringThe localized label to display as a tooltip.
Returns
- TButton
The unchanged button.
Type Parameters
TButtonThe specific type of the button.
Remarks
Prefer using the overload taking a Elements.Core.LocaleString to support localization.