
Lv.1
Never stop.I'm going to win.
签名:活着
在 选项报错了咋办 中回复
const magic = world.querySelector('#传送法阵');
magic.enableInteract = true;
magic.interactRadius = 12;
magic.interactHint = '法阵';
magic.interactColor = new Box3RGBColor(0,0,1);
magic.onInteract(async({entity}) => {
const result = await entity.player.dialog({
type: Box3DialogType.SELECT,
title: "法阵",
titleTextColor: new Box3RGBAColor(0, 0, 0, 1),
titleBackgroundColor: new Box3RGBAColor(0.968, 0.702, 0.392, 1),
content: `${entity.player.name},你可以帮我个忙吗?`,
options: ['矿洞', '太空'], // 将提供玩家选择的选项放入数组里。
contentTextColor: new Box3RGBAColor(0, 0, 0, 1),
contentBackgroundColor: new Box3RGBAColor(1, 1, 1, 1),
lookEye: entity.position.add(entity.player.facingDirection.scale(5)),
lookTarget: entity,
});
// 如果玩家点击了屏幕其他区域,取消了对话框。
if(!result || result === null){
entity.player.directMessage('你是在干啥?');
return;
}
// 判断玩家选了什么选项。
switch (result.index) {
case 0:
// 如果选择了第一项,即:'没问题'
entity.player.directMessage('作者感到很开心,奖励了你一朵大红花!');
entity.player.walkSpeed += 114514
world.say(`${entity.player.name} 帮助了作者,获得了作者的奖励。`)
break;
case 1:
// 如果选择了第二项,即:'现在没空'
entity.player.directMessage('作者失望地离开了。');
break;
default:
// 注意,使用 switch 分支的时候,不要漏了后面的 break;
}
}); 2022-08-17T11:13:50 点赞:0
在 【BOX3】求隐形代码(观战)和隐藏名字代码 中回复
world.onPlayerJoin(({entity})=>{
entity.player.kick()
})
观战代码()()
2023-02-01T17:23:16 点赞:3