Skip to content
BagItemUI

拓展 / BagItemUI

BagItemUI Class
​

背包道具父类,继承这个类来实现自己的道具格子界面,使用BagModule.skin来指定皮肤

Hierarchy ​

Implements ​

Table of contents ​

Accessors
​

countText(): TextBlock client
物品数量文本
iconButton(): Button client
物品图标按钮
nameText(): TextBlock client
物品名称文本
click

Accessors
​

canUpdate(): boolean client
获取是否能触发 UI 中 onUpdate 生命周期函数
fullScreen(inFull: boolean): void client
设置随父节点全屏适配,会验证父节点大小以保证跟随父节点的大小
layer(): number client
获取 UI 的 Layer 层级
rootCanvas(): Canvas client
获取 UI 的根 Canvas 节点
uiObject(): Widget
获取 UI 顶层控件对象
uiWidgetBase(): UserWidget client
获取 UI 顶层控件对象
visible(): boolean client
获取 UI 是否显示

Methods
​

onCreated(): void client
界面创建时被调用
click

Methods
​

destroy(): void client
销毁 UI 对象
detectDrag(dragKey: Keys): EventReply client
触发 DragDrop 事件的检测
detectDragIfPressed(inPointEvent: PointerEvent, dragKey: Keys): EventReply client
事件检测通过,触发 DragDrop 事件的回复。
newDragDrop(inVisualWidget: Widget, inTag?: string, inPayLoad?: any, inPivot?: DragPivot, inOffset?: Vector2): DragDropOperation client
创建 DragDrop 事件
remove(): void client
移除 UI 对象
setVisible(inVisible: boolean SlateVisibility, ...params: any[]): void client
设置 UI 是否显示
addBehavior(key: string, value: any): void client
添加一个全局行为
clearBehavior(): void client
清空全局一个行为
getBehavior(key: string): any client
执行一个全局的行为
removeBehavior(key: string): void client
移除全局一个行为

Accessors ​


countText
​

• Abstract get countText(): TextBlock client

物品数量文本

Returns ​

TextBlockIBagItemSkin.countText

iconButton
​

• Abstract get iconButton(): Button client

物品图标按钮

Returns ​

ButtonIBagItemSkin.iconButton

nameText
​

• Abstract get nameText(): TextBlock client

物品名称文本

Returns ​

TextBlockIBagItemSkin.nameText

Methods ​


onCreated
​

• Protected Abstract onCreated(): void client

界面创建时被调用