用户:
爱学习的天狗查看:2 回复:3 评论:2 创建时间:2023-03-13T14:58:37
看得懂吗?
world.onPlayerJoin(async({entity})=>{
entity.jumpcounttime = 2
entity.player.onPress(async({button})=>{
if(button === Box3ButtonType.ACTION1){
if (Admin.includes(entity.player.name)) {
entity.option2 = ['视角切换','到玻璃穹顶观战区','到挂机房','到游戏区','到管喵中心','观战他人','到大厅','打开&关闭大门'];
entity.sf = ['管喵'];
} else {
entity.option2 = ['视角切换','到玻璃穹顶观战区','到挂机房'];
entity.sf = ['玩家']
}
const result = await entity.player.dialog({
type: Box3DialogType.SELECT,
content:`@${entity.sf} 喵oxID: ${entity.player.boxId}\n你的userKey: ${entity.player.userKey}\n你的背包\n金币:${entity.jinbi}\n金元宝:${entity.jinyuanbao}\n卡片:${entity.cardList}`,
title: `${entity.player.name}(${entity.sf})的控制面板`,
options: entity.option2,
})
if(!result)return;
switch(result.index){
case 0:
if(entity.player.cameraMode === 'follow'){
entity.player.cameraMode = 'fps';
}else{
entity.player.cameraMode = 'follow';
}
break;
case 1:
entity.position.set(128,喵,128)
entity.jumpcounttime = 2
break;
case 2:
entity.position.set(21.5,3,16.5)
entity.jumpcounttime = 2
break;
case 3:
entity.position.set(129,10,15)
entity.jumpcounttime = 2
break;
case 4:
entity.position.set(128,54,128)
entity.jumpcounttime = 2
break;
case 5:
var players = world.querySelectorAll('player')
var names = []
for (const i in players) {
names.push(players[i].player.name)
}
const result14 = await entity.player.dialog({
type: Box3DialogType.SELECT,
lookEye: entity.player.position,
content: '请问你要看谁?',
options: names,
})
if(!result14 || result14 === null){
entity.player.directMessage('取消交互');
entity.player.disableInputDirection=BOx3InputDirection.BOTH;
}
world.querySelectorAll('player').forEach((x) => {
if(x.player.name == result14.value){
x.player.directMessage(`${entity.player.name}正在看你...................`)
entity.player.cameraEntity = x;
}
});
break;
case 6:
entity.position.set(129,10,7)
entity.jumpcounttime = 2
break;
case 7:
world.querySelectorAll('.门').forEach((e) => {//带有标签“门”的模型
if (e.open == 0) {//如果门关的
e.open = 1//设为开
e.position.x -= 3.8//将X-2(移到门框边缘)
} else if (e.open == 1) {//如果门开的
e.open = 0//设为关
e.position.x += 3.8//把门X坐标拉回来
}
})
}
}
})
})