Options
All
  • Public
  • Public/Protected
  • All
Menu

Class UIButton

按钮组件。

export

Hierarchy

Index

Constructors

constructor

  • new UIButton(entity: Entity2D): UIButton

Properties

Readonly entity

entity: Entity2D

物体对象。

memberof

Touchable

Readonly id

id: number = ...

Readonly isDestroyed

isDestroyed: boolean = false

Readonly isDestroying

isDestroying: boolean = false

Readonly priority

priority: number = ...

transition

transition: number = 0

状态转移动画效果时长。

memberof

UIButton

Static Priority

Priority: { Align: number; Layout: number; Low: number; Physics: number; Render: number; Tool: number } = ...

Type declaration

  • Align: number
  • Layout: number
  • Low: number
  • Physics: number
  • Render: number
  • Tool: number

Static Optional Serialize

Serialize: (...args: any[]) => any

Type declaration

    • (...args: any[]): any
    • Parameters

      • Rest ...args: any[]

      Returns any

Static State

State: typeof ButtonState = ...

按钮状态类型枚举值

static
memberof

UIButton

Accessors

active

  • get active(): boolean
  • set active(value: boolean): void
  • Returns boolean

  • Parameters

    • value: boolean

    Returns void

activeInHierarchy

  • get activeInHierarchy(): boolean
  • 在场景树中是否active

    readonly
    memberof

    Component

    Returns boolean

disable

  • get disable(): boolean
  • set disable(disable: boolean): void
  • 是否将UIButton设置为不可用

    Returns boolean

  • 是否将UIButton设置为不可用

    memberof

    UIButton

    Parameters

    • disable: boolean

    Returns void

disabledColor

  • get disabledColor(): Color
  • set disabledColor(val: Color): void
  • 不可用状态下按钮的图像混合的颜色。

    Returns Color

  • 不可用状态下按钮的图像混合的颜色。

    readonly
    memberof

    UIButton

    Parameters

    Returns void

disabledSprite

  • 点击状态下按钮的图片。

    Returns SpriteFrame

  • 点击状态下按钮的图片。

    memberof

    UIButton

    Parameters

    Returns void

grayScaleOnDisable

  • get grayScaleOnDisable(): boolean
  • set grayScaleOnDisable(grayScaleOnDisable: boolean): void
  • disable状态下是否将按钮渲染为灰阶

    Returns boolean

  • disable状态下是否将按钮渲染为灰阶

    memberof

    UIButton

    Parameters

    • grayScaleOnDisable: boolean

    Returns void

normalColor

  • get normalColor(): Color
  • set normalColor(color: Color): void
  • 普通状态下按钮图像混合的颜色。

    Returns Color

  • 普通状态下按钮图像混合的颜色。

    memberof

    UIButton

    Parameters

    Returns void

normalSprite

  • 普通状态下按钮的图片。

    Returns SpriteFrame

  • 普通状态下按钮的图片。

    memberof

    UIButton

    Parameters

    Returns void

onClick

  • get onClick(): Delegate<this, Readonly<{ allowThrough: boolean; originalEvent: TouchEvent; touches: DeepImmutableArray<TouchPoint>; type: TouchEventNames; stopTouchThrough: any }>>
  • 点击事件,只有触发过触摸开始事件才可能触发。

    readonly
    memberof

    Touchable

    Returns Delegate<this, Readonly<{ allowThrough: boolean; originalEvent: TouchEvent; touches: DeepImmutableArray<TouchPoint>; type: TouchEventNames; stopTouchThrough: any }>>

onTouchCancel

  • get onTouchCancel(): Delegate<this, Readonly<{ allowThrough: boolean; originalEvent: TouchEvent; touches: DeepImmutableArray<TouchPoint>; type: TouchEventNames; stopTouchThrough: any }>>
  • 触摸取消事件,只有触发过触摸开始事件才可能触发。

    readonly
    memberof

    Touchable

    Returns Delegate<this, Readonly<{ allowThrough: boolean; originalEvent: TouchEvent; touches: DeepImmutableArray<TouchPoint>; type: TouchEventNames; stopTouchThrough: any }>>

onTouchEnd

  • get onTouchEnd(): Delegate<this, Readonly<{ allowThrough: boolean; originalEvent: TouchEvent; touches: DeepImmutableArray<TouchPoint>; type: TouchEventNames; stopTouchThrough: any }>>
  • 触摸结束事件,只有触发过触摸开始事件才可能触发。

    readonly
    memberof

    Touchable

    Returns Delegate<this, Readonly<{ allowThrough: boolean; originalEvent: TouchEvent; touches: DeepImmutableArray<TouchPoint>; type: TouchEventNames; stopTouchThrough: any }>>

onTouchEnter

  • get onTouchEnter(): Delegate<this, Readonly<{ allowThrough: boolean; originalEvent: TouchEvent; touches: DeepImmutableArray<TouchPoint>; type: TouchEventNames; stopTouchThrough: any }>>
  • 触摸进入事件,只有触发过触摸开始事件才可能触发。

    readonly
    memberof

    Touchable

    Returns Delegate<this, Readonly<{ allowThrough: boolean; originalEvent: TouchEvent; touches: DeepImmutableArray<TouchPoint>; type: TouchEventNames; stopTouchThrough: any }>>

onTouchLeave

  • get onTouchLeave(): Delegate<this, Readonly<{ allowThrough: boolean; originalEvent: TouchEvent; touches: DeepImmutableArray<TouchPoint>; type: TouchEventNames; stopTouchThrough: any }>>
  • 触摸离开事件,只有触发过触摸开始事件才可能触发。

    readonly
    memberof

    Touchable

    Returns Delegate<this, Readonly<{ allowThrough: boolean; originalEvent: TouchEvent; touches: DeepImmutableArray<TouchPoint>; type: TouchEventNames; stopTouchThrough: any }>>

onTouchMove

  • get onTouchMove(): Delegate<this, Readonly<{ allowThrough: boolean; originalEvent: TouchEvent; touches: DeepImmutableArray<TouchPoint>; type: TouchEventNames; stopTouchThrough: any }>>
  • 触摸移动事件,只有触发过触摸开始事件才可能触发。

    readonly
    memberof

    Touchable

    Returns Delegate<this, Readonly<{ allowThrough: boolean; originalEvent: TouchEvent; touches: DeepImmutableArray<TouchPoint>; type: TouchEventNames; stopTouchThrough: any }>>

onTouchOut

  • get onTouchOut(): Delegate<this, Readonly<{ allowThrough: boolean; originalEvent: TouchEvent; touches: DeepImmutableArray<TouchPoint>; type: TouchEventNames; stopTouchThrough: any }>>
  • 触摸掠过后移出事件,没有触发过触摸开始事件才能触发。

    readonly
    memberof

    Touchable

    Returns Delegate<this, Readonly<{ allowThrough: boolean; originalEvent: TouchEvent; touches: DeepImmutableArray<TouchPoint>; type: TouchEventNames; stopTouchThrough: any }>>

onTouchOver

  • get onTouchOver(): Delegate<this, Readonly<{ allowThrough: boolean; originalEvent: TouchEvent; touches: DeepImmutableArray<TouchPoint>; type: TouchEventNames; stopTouchThrough: any }>>
  • 触摸掠过事件,没有触发过触摸开始事件才能触发。

    readonly
    memberof

    Touchable

    Returns Delegate<this, Readonly<{ allowThrough: boolean; originalEvent: TouchEvent; touches: DeepImmutableArray<TouchPoint>; type: TouchEventNames; stopTouchThrough: any }>>

onTouchStart

  • get onTouchStart(): Delegate<this, Readonly<{ allowThrough: boolean; originalEvent: TouchEvent; touches: DeepImmutableArray<TouchPoint>; type: TouchEventNames; stopTouchThrough: any }>>
  • 触摸开始事件。

    readonly
    memberof

    Touchable

    Returns Delegate<this, Readonly<{ allowThrough: boolean; originalEvent: TouchEvent; touches: DeepImmutableArray<TouchPoint>; type: TouchEventNames; stopTouchThrough: any }>>

onTouchUp

  • get onTouchUp(): Delegate<this, Readonly<{ allowThrough: boolean; originalEvent: TouchEvent; touches: DeepImmutableArray<TouchPoint>; type: TouchEventNames; stopTouchThrough: any }>>
  • 触摸掠过后移出事件,没有触发过触摸开始事件才能触发。

    readonly
    memberof

    Touchable

    Returns Delegate<this, Readonly<{ allowThrough: boolean; originalEvent: TouchEvent; touches: DeepImmutableArray<TouchPoint>; type: TouchEventNames; stopTouchThrough: any }>>

pressedColor

  • get pressedColor(): Color
  • set pressedColor(val: Color): void
  • 不可用状态下按钮的图像混合的颜色。

    Returns Color

  • 不可用状态下按钮的图像混合的颜色。

    memberof

    UIButton

    Parameters

    Returns void

pressedSprite

  • 点击状态下按钮的图片。

    Returns SpriteFrame

  • 点击状态下按钮的图片。

    memberof

    UIButton

    Parameters

    Returns void

state

  • get state(): ButtonState
  • set state(state: ButtonState): void
  • 当前按钮的状态

    Returns ButtonState

  • 当前按钮的状态

    memberof

    UIButton

    Parameters

    • state: ButtonState

    Returns void

useClickOnDisable

  • get useClickOnDisable(): boolean
  • set useClickOnDisable(clickOnDisable: boolean): void
  • disable状态下是否将按钮渲染为灰阶

    Returns boolean

  • disable状态下是否将按钮渲染为灰阶

    memberof

    UIButton

    Parameters

    • clickOnDisable: boolean

    Returns void

Methods

destroy

  • destroy(): void
  • Returns void

getTypeName

  • getTypeName(): string

isDetached

  • isDetached(): boolean
  • Returns boolean

resetProperties

  • resetProperties(): void

setState

  • setState(state: ButtonState, animation?: boolean, forceUpdate?: boolean): void
  • 设置按钮状态。

    memberof

    UIButton

    Parameters

    • state: ButtonState

      目标状态。

    • animation: boolean = true
    • forceUpdate: boolean = false

    Returns void

Generated using TypeDoc