猫史档案馆


啊啊啊啊啊啊,这个pro版的代码好烦

用户:SCS_user_rbxaHQh5aOSCS_user_rbxaHQh5aO查看:0 回复:3 评论:0 创建时间:2023-08-18T19:30:37


var playerbag = world.querySelector('#背包')
playerbag.enableInteract = true
playerbag.interactHint = '背包'
playerbag.interactRadius = 1000
playerbag.onInteract(async ({ entity }) => {
    const result = await entity.player.dialog({
        type: GameDialogType.SELECT,
        title: "背包",
        titleTextColor: new GameRGBAColor(1, 1, 1),
        titleBackgroundColor: new GameRGBAColor(0, 0, 0),
        options: ['空','空','商城','游戏','好友','工会','背包','系统','游戏'],
        contentTextColor:  new GameRGBAColor(0, 0, 0, 1),
        contentBackgroundColor: new GameRGBAColor(1, 1, 1, 1),
    });
    switch (result.index) {
        case 2:
                playerbag.onInteract(async ({ entity }) => {
                    const result = await entity.player.dialog({
                    type: GameDialogType.SELECT,
                    title: "商城",
                    titleTextColor: new GameRGBAColor(1, 1, 1),
                    titleBackgroundColor: new GameRGBAColor(0, 0, 0),
                    options: ['addd,没用啊'],
                    contentTextColor:  new GameRGBAColor(0, 0, 0, 1),
                    contentBackgroundColor: new GameRGBAColor(1, 1, 1, 1),
                });
            })
            break;
        case 3:
                playerbag.onInteract(async ({ entity }) => {
                    const result = await entity.player.dialog({
                    type: GameDialogType.SELECT,
                    title: "游戏",
                    titleTextColor: new GameRGBAColor(1, 1, 1),
                    titleBackgroundColor: new GameRGBAColor(0, 0, 0),
                    options: ['起床战争','起床战争-无限火力','起床战争-疾速模式'],
                    contentTextColor:  new GameRGBAColor(0, 0, 0, 1),
                    contentBackgroundColor: new GameRGBAColor(1, 1, 1, 1),
                });
            })
            break;
        default:
    }

});

就是选项的位置完全是错的,还有时突然随机

    switch (result.index) {         case 2:                 playerbag.onInteract(async ({ entity }) => {                     const result = await entity.player.dialog({                     type: GameDialogType.SELECT,                     title: "商城",                     titleTextColor: new GameRGBAColor(1, 1, 1),                     titleBackgroundColor: new GameRGBAColor(0, 0, 0),                     options: ['addd,没用啊'],                     contentTextColor:  new GameRGBAColor(0, 0, 0, 1),                     contentBackgroundColor: new GameRGBAColor(1, 1, 1, 1),                 });             })             break;         case 3:                 playerbag.onInteract(async ({ entity }) => {                     const result = await entity.player.dialog({                     type: GameDialogType.SELECT,                     title: "游戏",                     titleTextColor: new GameRGBAColor(1, 1, 1),                     titleBackgroundColor: new GameRGBAColor(0, 0, 0),                     options: ['起床战争','起床战争-无限火力','起床战争-疾速模式'],                     contentTextColor:  new GameRGBAColor(0, 0, 0, 1),                     contentBackgroundColor: new GameRGBAColor(1, 1, 1, 1),                 });             })             break;         default:     }


回复

上一页1 页 / 共 1下一页
SCS_user_rbxaHQh5aOSCS_user_rbxaHQh5aO

额,好像有点……

点赞0


评论


lingyi_objlingyi_obj

https://www.wjx.cn/vm/Ya3BmHB.aspx

帮忙做一下,班级小课题研究,谢谢

点赞0


评论


无尽之海无尽之海

运行了一下。报错:TypeError: Cannot set properties of null (setting 'enablelnteract') at eval (index js:309:26)

这个错误表明,在具体来说,这个错误是在尝试执行 index.js 文件的第309行时出现的。在这行代码中,你正在尝试设置一个名为 enablelnteract 的属性,但是你正在操作的对象是 null。为了解决这个问题,你需要确保你正在操作的对象不是 null。如果你不能确定是哪个对象出了问题,你可能需要检查代码中如何获取或创建这个对象。

点赞1


评论