猫史档案馆


大家帮我看看这段代码,哪里错了。

用户:Weeb_ETOWeeb_ETO查看:0 回复:1 评论:0 创建时间:2021-08-21T15:46:30


const qw = world.querySelector('#QW');
qw.enableInteract = true; // 允许进行互动
qw.interactRadius = 16;   // 实体的互动范围
qw.interactHint = qw.id; // 互动提示框显示实体的名称
qw.interactColor = new Box3RGBColor(1, 0, 1);  // 互动提示的文字颜色
qw.onInteract(async ({ entity }) => {
    const result = await entity.player.dialog({
        type: Box3DialogType.TEXT, //对话类型是纯文本
        title: '小卖部老板', //说话人的名字
        content: `欢迎来到小卖部`,//说话内容
        titleBackgroundColor: new Box3RGBAColor(0.968, 0.702, 0.392, 1), // 标题背景颜色。
        hasArrow: true,//开启箭头效果
    });
    const result1 = await entity.player.dialog({
        type: Box3DialogType.SELECT,//对话类型是选项
        title: '小卖部老板',
        content: '你要买什么?',
        options: [' Coca Cola', '辣条', '糖果'],
        titleBackgroundColor: new Box3RGBAColor(0.968, 0.702, 0.392, 1), // 标题背景颜色。
    });
            if (sel) {
                if (sel.value == 'Coca Cola') {
                    const result2 = await entity.player.dialog({
                    title: '小卖部老板',
                    type: Box3DialogType.INPUT, //对话类型是输入框
                    content: `要买多少?`,
                    titleBackgroundColor: new Box3RGBAColor(0.968, 1, 0.392, 1), // 标题背景颜色。
                    placeholder: '当然是...', // 输入框背景上的提示文字。
                    confirmText: '就是它了!',
                    })
                }
                else if (sel.value == '辣条') {
                    const result3 = await entity.player.dialog({
                    title: '小卖部老板',
                    type: Box3DialogType.INPUT, //对话类型是输入框
                    content: `要买多少?`,
                    titleBackgroundColor: new Box3RGBAColor(0.968, 1, 0.392, 1), // 标题背景颜色。
                    placeholder: '当然是...', // 输入框背景上的提示文字。
                    confirmText: '就是它了!',
                    })
                }                    
                else if (sel.value == '糖果') {
                    const result4 = await entity.player.dialog({
                    title: '小卖部老板',
                    type: Box3DialogType.INPUT, //对话类型是输入框
                    content: `要买多少?`,
                    titleBackgroundColor: new Box3RGBAColor(0.968, 1, 0.392, 1), // 标题背景颜色。
                    placeholder: '当然是...', // 输入框背景上的提示文字。
                    confirmText: '就是它了!',
        })
    }


回复

上一页1 页 / 共 1下一页
Weeb_ETOWeeb_ETO

点赞0


评论