new Item(id, name, mesh, maxStackSize, tags, data, staticData, wearable, content)
定义一种物品
| Name | Type | Description |
|---|---|---|
id | string | 该物品的id |
name | string | 该物品的显示名称,默认和id相同 |
mesh | string | 该物品的模型。如果这里未指定且 |
maxStackSize | number | 该物品的最大堆叠数量,默认为 |
tags | Array.<string> | 该物品的标签 |
data | object | 该物品的默认数据 |
staticData | object | 该物品的静态数据 |
wearable | Box3Wearable | | 该实体是否可穿戴。如果可以穿戴,那么填入一个 |
content | string | | 该物品打开对话框时,物品的默认对话框正文内容 |
- Source
Members
id :string
该物品的id
- string
- Source
name :string
该物品的显示名称
- string
- Source
maxStackSize :number
该物品的最大堆叠数量
- number
- Source
mesh :string
该物品的模型
如果这里未指定且wearable类型为Box3Wearable,那么会自动读取wearable.mesh作为mesh
- string
- Source
data :object
该物品的默认数据
- object
- Source
tags :Array.<string>
该物品的标签
- Array.<string>
- Source
staticData :object
该物品的静态数据
- object
- Source
wearable :Box3Wearable|boolean
该物品的穿戴配件
- Box3Wearable |
boolean
- Source
content
该物品打开对话框时,物品的默认对话框正文内容
- Source
_onUse :Array.<ThingUseCallback>
当物品被使用时,调用的函数
- Array.<ThingUseCallback>
- Source
_onWear :Array.<ThingUseCallback>
当物品被穿戴时,调用的函数
- Array.<ThingUseCallback>
- Source
_onDiswear :Array.<ThingUseCallback>
当物品被卸下时,调用的函数
- Array.<ThingUseCallback>
- Source
__onUpdateWear :Array.<ThingUseCallback>
当物品被更新穿戴状态时,调用的函数
- Array.<ThingUseCallback>
- Source
id :string
该物品的id
- string
- Source
name :string
该物品的显示名称
- string
- Source
maxStackSize :number
该物品的最大堆叠数量
- number
- Source
mesh :string
该物品的模型
如果这里未指定且wearable类型为Box3Wearable,那么会自动读取wearable.mesh作为mesh
- string
- Source
data :object
该物品的默认数据
- object
- Source
tags :Array.<string>
该物品的标签
- Array.<string>
- Source
staticData :object
该物品的静态数据
- object
- Source
wearable :Box3Wearable|boolean
该物品的穿戴配件
- Box3Wearable |
boolean
- Source
content
该物品打开对话框时,物品的默认对话框正文内容
- Source
_onUse :Array.<ThingUseCallback>
当物品被使用时,调用的函数
- Array.<ThingUseCallback>
- Source
_onWear :Array.<ThingUseCallback>
当物品被穿戴时,调用的函数
- Array.<ThingUseCallback>
- Source
_onDiswear :Array.<ThingUseCallback>
当物品被卸下时,调用的函数
- Array.<ThingUseCallback>
- Source
__onUpdateWear :Array.<ThingUseCallback>
当物品被更新穿戴状态时,调用的函数
- Array.<ThingUseCallback>
- Source
Methods
onUse(callback) → {Item}
当物品被使用时,调用的函数
| Name | Type | Description |
|---|---|---|
callback | ThingUseCallback | 监听器回调函数 |
- Source
自身
- Type:
- Item
onWear(callback) → {Item}
当物品被穿戴时,调用的函数
| Name | Type | Description |
|---|---|---|
callback | ThingUseCallback | 监听器回调函数 |
- Source
自身
- Type:
- Item
onDiswear(callback) → {Item}
当物品被卸下时,调用的函数
| Name | Type | Description |
|---|---|---|
callback | ThingUseCallback | 监听器回调函数 |
- Source
自身
- Type:
- Item
onUpdateWear(callback) → {Item}
当物品被更新穿戴状态时,调用的函数
不仅会在Thing.updateWear调用时触发,也会在onWear、onDiswear调用时触发
| Name | Type | Description |
|---|---|---|
callback | ThingUseCallback | 监听器回调函数 |
- Source
自身
- Type:
- Item
onUse(callback) → {Item}
当物品被使用时,调用的函数
| Name | Type | Description |
|---|---|---|
callback | ThingUseCallback | 监听器回调函数 |
- Source
自身
- Type:
- Item
onWear(callback) → {Item}
当物品被穿戴时,调用的函数
| Name | Type | Description |
|---|---|---|
callback | ThingUseCallback | 监听器回调函数 |
- Source
自身
- Type:
- Item
onDiswear(callback) → {Item}
当物品被卸下时,调用的函数
| Name | Type | Description |
|---|---|---|
callback | ThingUseCallback | 监听器回调函数 |
- Source
自身
- Type:
- Item
onUpdateWear(callback) → {Item}
当物品被更新穿戴状态时,调用的函数
不仅会在Thing.updateWear调用时触发,也会在onWear、onDiswear调用时触发
| Name | Type | Description |
|---|---|---|
callback | ThingUseCallback | 监听器回调函数 |
- Source
自身
- Type:
- Item