Lv.1
在 【求助】GUI如何做可交互的按钮以及显示图片() 中回复
正中央很简单啊,如果是dialog就调top(上下)和right(左右)如果是其他的就挑x和y就完事了(
2023-07-07T11:55:29 点赞:0
在 【求助】GUI如何做可交互的按钮以及显示图片() 中回复
一个最简单的button实例()
照着145的改的()
console.clear();
world.onPlayerJoin(({ entity }) => {
gui.init(entity, {
'test': {
display: true,
bindings: [
{ action: "sendMessage", messageName: "yee", event: "click", selector: "#button" }
],
data: `
<dialog top = "60" right = "20" percentHeight="100" width="300">
<button text = "say" color = "#00FFFF" percentHeight = "5" percentWidth = "20" y = "150" id = "button"></button>
</dialog>
`
}
})
})
gui.onMessage(({ name }) => {
if (name === 'yee') {
world.say('yee~~~')
}
})2023-07-07T12:23:38 点赞:0
在 【PRO编辑器】新版数据库模板 中回复
助力创作节()()顺便看看有没有哪个好心人愿意带我()![]()
再放一段可用来测试的代码(
world.onPress(async ({ entity, button }) => {
if (button == GameButtonType.ACTION1) {
const ask = await entity.player.dialog({
type: 'select',
title: '测试',
content: `你目前[${entity.lv}]级\n[${entity.exp}]点经验\n[${entity.money}]枚金币\n背包:[${entity.itemList}]\n当前状态:${entity.nowDoing}`,
options: ['点我加等级', '点我加经验', '点我加金币']
});
if (!ask) return;
if (ask) {
entity[['lv', 'exp', 'money'][ask.index]]++;
}
}
});2023-07-16T08:13:53 点赞:0