用户:
烨烨小栗子查看:1 回复:5 评论:1 创建时间:2022-10-27T13:23:53
???????????????
VisualProgramerworld.onPlayerJoin(async({entity})=>{
var playerbag=world.querySelector('#背包')
playerbag.enableInteract = true
playerbag.interactHint = ''
playerbag.interactRadius = 1000
playerbag.onInteract(async ({entity}) => {
var bagst = await entity.player.dialog({
type: Box3DialogType.SELECT,
title: `背包`,
titleTextColor: new Box3RGBAColor(0, 0, 0, 1),
titleBackgroundColor: new Box3RGBAColor(0, 0.3, 1, 1),
content: `坐标:${Math.round(entity.position.x)},${Math.round(entity.position.y)},${Math.round(entity.position.z)}
血量:${entity.maxHp}/${entity.hp}
饱食度:20/20
护甲值:0
盔甲韧性:0
效果`,
contentTextColor: new Box3RGBAColor(0, 0, 0, 1),
contentBackgroundColor: new Box3RGBAColor(1, 1, 1, 1),
options: ['快捷栏','物品栏','护甲'],
})
if(!bagst||bagst==null){
return
}
if(bagst.index==0){
var shortcut = await entity.player.dialog({
type: Box3DialogType.SELECT,
title: `快捷栏`,
titleTextColor: new Box3RGBAColor(0, 0, 0, 1),
titleBackgroundColor: new Box3RGBAColor(0, 0.3, 1, 1),
contentTextColor: new Box3RGBAColor(0, 0, 0, 1),
contentBackgroundColor: new Box3RGBAColor(1, 1, 1, 1),
options: [],
})
if(!shortcut||shortcut==null){
return
}
}else if(bagst.index==1){
var thing = await entity.player.dialog({
type: Box3DialogType.SELECT,
title: `物品栏`,
titleTextColor: new Box3RGBAColor(0, 0, 0, 1),
titleBackgroundColor: new Box3RGBAColor(0, 0.3, 1, 1),
contentTextColor: new Box3RGBAColor(0, 0, 0, 1),
contentBackgroundColor: new Box3RGBAColor(1, 1, 1, 1),
options: [],
})
if(!thing||thing==null){
return
}
}else if(bagst.index==2){
var armor = await entity.player.dialog({
type: Box3DialogType.SELECT,
title: `护甲`,
titleTextColor: new Box3RGBAColor(0, 0, 0, 1),
titleBackgroundColor: new Box3RGBAColor(0, 0.3, 1, 1),
contentTextColor: new Box3RGBAColor(0, 0, 0, 1),
contentBackgroundColor: new Box3RGBAColor(1, 1, 1, 1),
options: [],
})
if(!armor||armor==null){
return
}
}
})
})
这里你需要在地图里放一个模型,然后把这一行#后面的内容改为你模型的名字。比如你模型叫菜单就改为
var playerbag=world.querySelector('#菜单')
后面可以自己调参数
点赞0
评论
world.onPlayerJoin(async({entity})=>{
var playerbag=world.querySelector('#背包')
playerbag.enableInteract = true
playerbag.interactHint = ''
playerbag.interactRadius = 1000
playerbag.onInteract(async ({entity}) => {
var bagst = await entity.player.dialog({
type: Box3DialogType.SELECT,
title: `背包`,
titleTextColor: new Box3RGBAColor(0, 0, 0, 1),
titleBackgroundColor: new Box3RGBAColor(0, 0.3, 1, 1),
content: `坐标:${Math.round(entity.position.x)},${Math.round(entity.position.y)},${Math.round(entity.position.z)}
血量:${entity.maxHp}/${entity.hp}
饱食度:20/20
护甲值:0
盔甲韧性:0
效果`,
contentTextColor: new Box3RGBAColor(0, 0, 0, 1),
contentBackgroundColor: new Box3RGBAColor(1, 1, 1, 1),
options: ['快捷栏','物品栏','护甲'],
})
if(!bagst||bagst==null){
return
}
if(bagst.index==0){
var shortcut = await entity.player.dialog({
type: Box3DialogType.SELECT,
title: `快捷栏`,
titleTextColor: new Box3RGBAColor(0, 0, 0, 1),
titleBackgroundColor: new Box3RGBAColor(0, 0.3, 1, 1),
contentTextColor: new Box3RGBAColor(0, 0, 0, 1),
contentBackgroundColor: new Box3RGBAColor(1, 1, 1, 1),
options: [],
})
if(!shortcut||shortcut==null){
return
}
}else if(bagst.index==1){
var thing = await entity.player.dialog({
type: Box3DialogType.SELECT,
title: `物品栏`,
titleTextColor: new Box3RGBAColor(0, 0, 0, 1),
titleBackgroundColor: new Box3RGBAColor(0, 0.3, 1, 1),
contentTextColor: new Box3RGBAColor(0, 0, 0, 1),
contentBackgroundColor: new Box3RGBAColor(1, 1, 1, 1),
options: [],
})
if(!thing||thing==null){
return
}
}else if(bagst.index==2){
var armor = await entity.player.dialog({
type: Box3DialogType.SELECT,
title: `护甲`,
titleTextColor: new Box3RGBAColor(0, 0, 0, 1),
titleBackgroundColor: new Box3RGBAColor(0, 0.3, 1, 1),
contentTextColor: new Box3RGBAColor(0, 0, 0, 1),
contentBackgroundColor: new Box3RGBAColor(1, 1, 1, 1),
options: [],
})
if(!armor||armor==null){
return
}
}
})
})
这里你需要在地图里放一个模型,然后把这一行#后面的内容改为你模型的名字。比如你模型叫菜单就改为
var playerbag=world.querySelector('#菜单')
后面可以自己调参数
点赞0
评论