PageButtonTag
page-button
pg-button
Description
Displays a page button.
This button is particularly useful for List and CustomList.
Components and Properties
Button
click-event
event-click
event
Event that will fire on click.
on-click
UIAction
UIAction that will fire on click.
ButtonIconImage
icon
resource path
Path to image to use as icon Sprite.
icon-skew
float
The amount of skew to apply to the icon.
show-underline
bool
Whether or not to show an underline on the button.
ContentSizeFitter
horizontal-fit
FitMode
How the width is controlled.
vertical-fit
FitMode
How the height is controlled.
Graphic
raycast-padding
Vector4
Padding to be applied to the masking, ordered counter-clockwise (left, bottom, right, top).
raycast-target
raycast
bool
Whether or not this graphic be considered a target for raycasting.
LayoutElement
flexible-height
float
The relative amount of additional available height this layout element should fill out relative to its siblings.
flexible-width
float
The relative amount of additional available width this layout element should fill out relative to its siblings.
ignore-layout
bool
Whether or not to use layout element.
min-height
float
The minimum height this layout element should have.
min-width
float
The minimum width this layout element should have.
preferred-height
pref-height
float
The preferred height this layout element should have before additional available height is allocated.
preferred-width
pref-width
float
The preferred width this layout element should have before additional available width is allocated.
PageButton
dir
direction
PageButtonDirection
Direction of the page button.
RectTransform
active
bool
Whether or not the GameObject this RectTransform belongs to is active.
anchor-max
Vector2
The anchor point for the upper right corner of the rectangle defined as a fraction of the size of the parent rectangle.
anchor-max-x
float
The normalized x position in the parent RectTransform that the upper right corner is anchored to.
anchor-max-y
float
The normalized y position in the parent RectTransform that the upper right corner is anchored to.
anchor-min
Vector2
The anchor point for the lower left corner of the rectangle defined as a fraction of the size of the parent rectangle.
anchor-min-x
float
The normalized x position in the parent RectTransform that the lower left corner is anchored to.
anchor-min-y
float
The normalized y position in the parent RectTransform that the lower left corner is anchored to.
anchored-position
Vector2
Position of the rectangle’s pivot point relative to the anchors.
anchored-position-x
anchor-pos-x
float
The x position of the pivot of this RectTransform relative to the anchor reference point.
anchored-position-y
anchor-pos-y
float
The y position of the pivot of this RectTransform relative to the anchor reference point.
hover-hint
string
Text that will appear when a pointer hovers over.
hover-hint-key
localization key
The localization key used for the hover hint text.
local-scale
scale
Vector3
Scale factor applied to the object in the X, Y and Z dimensions.
name
string
The name of the GameObject.
pivot
Vector2
The location around which the rectangle rotates.
pivot-x
float
Normalized x position to rotate around.
pivot-y
float
Normalized y position to rotate around.
size-delta
Vector2
The size added to the rectangle defined by the anchors.
size-delta-x
float
The width added to the rectangle defined by the anchors.
size-delta-y
float
The height added to the rectangle defined by the anchors.
Selectable
interactable
bool
Whether or not this is interactable.
Example Usage
example.bsml
<vertical child-control-height="false">
<horizontal bg="panel-top" pad-left="15" pad-right="15" horizontal-fit="PreferredSize">
<text text="Page button" align="Center" font-size="8"/>
</horizontal>
<horizontal vertical-fit="PreferredSize">
<text text="Find the lucky choice!" font-size="4.5"/>
</horizontal>
<page-button click-event="list#PageUp" direction="Up" pref-width="30" pref-height="5"></page-button>
<custom-list id="list" contents="buttons" list-width="30" visible-cells="3" cell-size="8">
<horizontal vertical-fit="Unconstrained">
<vertical pref-width="20">
<text text="~text" align="Center" font-size="4" overflow-mode="Ellipsis"></text>
</vertical>
<button text="+" pad="0" all-uppercase="false" pref-width="6" pref-height="6" on-click="button-click"></button>
</horizontal>
</custom-list>
<page-button click-event="list#PageDown" direction="Down" pref-width="30" pref-height="5"></page-button>
</vertical>
using System.Collections.Generic;
using System.Linq;
using BeatSaberMarkupLanguage.Attributes;
using BeatSaberMarkupLanguage.MenuButtons;
using BeatSaberMarkupLanguage.Parser;
using BeatSaberMarkupLanguage.ViewControllers;
public class TestViewController : BSMLResourceViewController
{
public override string ResourceName => "Path.To.Resource.example.bsml";
[UIValue("buttons")]
private List<object> buttons = Enumerable.Range(1, 7)
.Select(i => {
return new MenuButton($"Choice " + i, "", () => Logger.log.Info($"You clicked the choice {i}! " + (i == 7 ? "Lucky one!" : "Try again.."))) as object;
}).ToList();
}
This example will display a list container and its elements list contained in the script