Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Slider

Slider UI element

Hierarchy

Index

Properties

onValueChanged

onValueChanged: MulticastDelegate<(slider: this, player: Player, value: number) => void>

Called when the value is changed by a player

param

The slider that was changed

param

The player who changed the value. undefined if the value was changed through setValue.

param

The new value

Methods

getFontSize

  • getFontSize(): number

getMaxValue

  • getMaxValue(): number
  • Return the maximum slider value

    Returns number

getMinValue

  • getMinValue(): number
  • Return the minimum slider value

    Returns number

getOwningObject

getParent

  • getParent(): Widget | undefined
  • Return the widget that contains this widget, for example a border that wraps a check box. Returns undefined if this object has no parent.

    Returns Widget | undefined

getStepSize

  • getStepSize(): number

getTextBoxWidth

  • getTextBoxWidth(): number
  • Return the width of the text box. Default: 35

    Returns number

getTextColor

getValue

  • getValue(): number

isBold

  • isBold(): boolean

isEnabled

  • isEnabled(): boolean

isItalic

  • isItalic(): boolean

setBold

  • setBold(bold: boolean): this

setEnabled

  • setEnabled(enabled: boolean): this
  • Set whether the widget is enabled. When a widget is disabled, users can't interact with it and it is greyed out. When a widget that contains other widgets (like VerticalBox) is disabled, all its children behave as if disabled, too. By default, widgets are enabled.

    Parameters

    • enabled: boolean

      Whether to enable the widget.

    Returns this

setFont

  • setFont(fontFilename: string, packageId?: string): this
  • Set the TrueType font file used for the text. If a custom font is used, the bold and italic settings don't have an effect. Place your font files in the "Fonts" folder of your package.

    Parameters

    • fontFilename: string

      The filename of the TTF file to load. Set to empty string to use the standard font (and enable bold and italic settings).

    • Optional packageId: string

      The id of the package that contains the TTF file (in the Fonts folder). Can usually be empty when used from scripts to use the same package that contains the script file, but you need to explicitly pass refPackageId for the current package or a package id when you use it in a callback. You can find package ids in the manifest.json file in package folders. Usually you won't use this parameter, unless you have a specific reason to load a font from a different package than where the script is located.

    Returns this

setFontSize

  • setFontSize(size: number): this

setItalic

  • setItalic(italic: boolean): this

setMaxValue

  • setMaxValue(maxValue: number): Slider
  • Set the maximum slider value. Default: 1

    Parameters

    • maxValue: number

    Returns Slider

setMinValue

  • setMinValue(minValue: number): Slider
  • Set the minimum slider value. Default: 0

    Parameters

    • minValue: number

    Returns Slider

setStepSize

  • setStepSize(stepSize: number): Slider
  • Set the slider step size. Default: 0.01

    Parameters

    • stepSize: number

    Returns Slider

setTextBoxWidth

  • setTextBoxWidth(width: number): Slider
  • Set the width of the text box. Can be set to 0 to hide the text box.

    Parameters

    • width: number

    Returns Slider

setTextColor

  • setTextColor(color: Color | [r: number, g: number, b: number, a: number]): this

setValue

  • setValue(value: number): Slider