猫史档案馆


教程:背包换武器 勿喷!

用户:alopdopsalopdops查看:14 回复:19 评论:14 创建时间:2022-04-16T19:47:34


之前有人说我水,今天直接上代码

world.onPress(async({ button, entity }) => {     if(button != Box3ButtonType.ACTION1 || !entity.isPlayer || entity.player.dead) return;     const result = await entity.player.dialog({         type: Box3DialogType.SELECT,         title: `${entity.player.name}的状态`,         options: ['切换武器','切换视角','脱离卡点'],     });



    if (!result || result === null)      return;     // 判断玩家选了什么选项。     switch (result.index) {     case 0:

 

            const result = await entity.player.dialog({                 type: Box3DialogType.SELECT,                 content: `切换魔法`,                 options: ['剑','剑之刃','蓝之剑','圣之法杖','冰——喵','法仗','星月权杖','穹破刀','弓']             });

 

            if (!result || result === null)              return;

 

            switch (result.index) {                 case 0:                 entity.fashuy = 1                 entity.fashu = `剑`                 entity.act = 90                 const handWears = entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears[0]);                     entity.player.directMessage(`切换成功`)                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh: 'mesh/剑.vb',                     orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI/2),                     scale: new Box3Vector3(0.4, 0.7, 0.4),                     offset: new Box3Vector3(-0.05, 0.4 ,1.4),

 

    });                              break;                 case 1:                 entity. fashuy = 2                 entity.fashu = `剑之刃`                 entity.act = 120                 const handWears1 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears1[0]);                     entity.player.directMessage(`切换成功`);                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh: 'mesh/剑之刃.vb',                     orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI/2),                     offset: new Box3Vector3(-0.05, 0.4 ,1.4),     });         

 

                    break;                 case 2:                 entity.fashu = `蓝之剑`                 entity.act = 105                 const handWears2 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears2[0]);                     entity.player.directMessage(`切换成功`)                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh: 'mesh/蓝之剑.vb',                     orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI/2),                     scale: new Box3Vector3(0.4, 0.7, 0.4),                     offset: new Box3Vector3(-0.05, 0.4 ,1),     });         

 

                    break;                 case 3:                 entity.fashu = `圣之法杖`                 entity.act = 130                 const handWears3 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears3[0]);                     entity.player.directMessage(`切换成功`)                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh: 'mesh/圣之法杖.vb',                     orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI/2.5),                     scale: new Box3Vector3(0.4, 0.7, 0.4),                     offset: new Box3Vector3(-0.05, 0.2 ,0.4)     });

 

                    break;                                           case 4:                 entity.fashu = `冰——喵`                 entity.act = 150                 const handWears4 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears4[0]);                     entity.player.directMessage(`切换成功`)                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh: 'mesh/冰——喵.vb',                     orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI/2),                     scale: new Box3Vector3(0.4, 0.7, 0.4),                     offset: new Box3Vector3(-0.05, 0.4 ,1),     });                              break;                 case 5:                 entity.fashu = `法仗`                 entity.act = 170                 const handWears5= entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears5[0]);                     entity.player.directMessage(`切换成功`)                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh:'mesh/法仗.vb',                     orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI/2),                     scale: new Box3Vector3(0.4, 0.7, 0.4),                     offset: new Box3Vector3(-0.05, 0.4 ,1),     });                              break;                 case 6:                 entity.fashu = `星月权杖`                 entity.act = 125                 const handWears6 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears6[0]);                     entity.player.directMessage(`切换成功`)                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh: 'mesh/星月权杖.vb',                     orientation: new Box3Quaternion(0, 1, -3, 9).rotateY(Math.PI/2),                     scale: new Box3Vector3(0.4, 0.55, 0.4),                     offset: new Box3Vector3(0, 0.7 ,0.6),     });                                          break;                 case 7:                 entity.fashu = `穹破刀`                 entity.act = 135                 const handWears7 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears7[0]);                     entity.player.directMessage(`切换成功`)                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh: 'mesh/穹破刀.vb',                     orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI/2),                     scale: new Box3Vector3(0.4, 0.7, 0.4),                     offset: new Box3Vector3(-0.05, 0.4 ,1),                     });             }              break;             case 1:             const result1 = await entity.player.dialog({                 type: Box3DialogType.SELECT,                 title: `${entity.player.name}的状态`,                 content: `视角切换`,                 options: ['第一人称','第三人称']             });

 

            if (!result1 || result1=== null) return;

 

            switch (result1.index) {                 case 0:                     entity.player.cameraMode = 'FPS'                 break;

 

                case 1:                 entity.player.cameraMode = 'FOLLOW'                 break;                 default:                 }                                  case 2:                     entity.position.set(54,10,58)                 break;             default:     }      });



world.onPlayerJoin(({ entity }) => {     Object.assign(entity, {         particleRate: 7,         particleSize: [2, 4, 8, 4, 10],         particleColor: [             new Box3RGBColor(10, 9, 2),             new Box3RGBColor(5, 0.25, 0.1),             new Box3RGBColor(3, 0.05, 0.05),             new Box3RGBColor(0, 0, 0),             new Box3RGBColor(0, 0, 0),         ],         particleLifetime: 1,         particleVelocitySpread: new Box3Vector3(2, 2, 2),     }); });

有了这代码做出武器试验场模型明自己改!!!


回复

上一页1 页 / 共 1下一页
alopdopsalopdops

自古沙发归作者,嘿嘿嘿。

点赞0


评论


alopdopsalopdops

不水了

点赞0


评论


蓝矮爱乐蓝矮爱乐

//建议用排版把代码做成排版形式

点赞0


评论


AlcalaAlcala

不是你放代码也要注意排版啊

点赞0


评论


Architect_皮卡awaArchitect_皮卡awa

world.onPress(async({ button, entity }) => {     if(button != Box3ButtonType.ACTION1 || !entity.isPlayer || entity.player.dead) return;     const result = await entity.player.dialog({         type: Box3DialogType.SELECT,         title: `${entity.player.name}的状态`,         options: ['切换武器','切换视角','脱离卡点'],     });



    if (!result || result === null)      return;     // 判断玩家选了什么选项。     switch (result.index) {     case 0:
 

            const result = await entity.player.dialog({                 type: Box3DialogType.SELECT,                 content: `切换魔法`,                 options: ['剑','剑之刃','蓝之剑','圣之法杖','冰——喵','法仗','星月权杖','穹破刀','弓']             });
 

            if (!result || result === null)              return;
 

            switch (result.index) {                 case 0:                 entity.fashuy = 1                 entity.fashu = `剑`                 entity.act = 90                 const handWears = entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears[0]);                     entity.player.directMessage(`切换成功`)                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh: 'mesh/剑.vb',                     orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI/2),                     scale: new Box3Vector3(0.4, 0.7, 0.4),                     offset: new Box3Vector3(-0.05, 0.4 ,1.4),
 

    });                              break;                 case 1:                 entity. fashuy = 2                 entity.fashu = `剑之刃`                 entity.act = 120                 const handWears1 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears1[0]);                     entity.player.directMessage(`切换成功`);                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh: 'mesh/剑之刃.vb',                     orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI/2),                     offset: new Box3Vector3(-0.05, 0.4 ,1.4),     });         
 

                    break;                 case 2:                 entity.fashu = `蓝之剑`                 entity.act = 105                 const handWears2 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears2[0]);                     entity.player.directMessage(`切换成功`)                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh: 'mesh/蓝之剑.vb',                     orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI/2),                     scale: new Box3Vector3(0.4, 0.7, 0.4),                     offset: new Box3Vector3(-0.05, 0.4 ,1),     });         
 

                    break;                 case 3:                 entity.fashu = `圣之法杖`                 entity.act = 130                 const handWears3 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears3[0]);                     entity.player.directMessage(`切换成功`)                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh: 'mesh/圣之法杖.vb',                     orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI/2.5),                     scale: new Box3Vector3(0.4, 0.7, 0.4),                     offset: new Box3Vector3(-0.05, 0.2 ,0.4)     });
 

                    break;                                           case 4:                 entity.fashu = `冰——喵`                 entity.act = 150                 const handWears4 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears4[0]);                     entity.player.directMessage(`切换成功`)                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh: 'mesh/冰——喵.vb',                     orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI/2),                     scale: new Box3Vector3(0.4, 0.7, 0.4),                     offset: new Box3Vector3(-0.05, 0.4 ,1),     });                              break;                 case 5:                 entity.fashu = `法仗`                 entity.act = 170                 const handWears5= entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears5[0]);                     entity.player.directMessage(`切换成功`)                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh:'mesh/法仗.vb',                     orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI/2),                     scale: new Box3Vector3(0.4, 0.7, 0.4),                     offset: new Box3Vector3(-0.05, 0.4 ,1),     });                              break;                 case 6:                 entity.fashu = `星月权杖`                 entity.act = 125                 const handWears6 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears6[0]);                     entity.player.directMessage(`切换成功`)                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh: 'mesh/星月权杖.vb',                     orientation: new Box3Quaternion(0, 1, -3, 9).rotateY(Math.PI/2),                     scale: new Box3Vector3(0.4, 0.55, 0.4),                     offset: new Box3Vector3(0, 0.7 ,0.6),     });                                          break;                 case 7:                 entity.fashu = `穹破刀`                 entity.act = 135                 const handWears7 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears7[0]);                     entity.player.directMessage(`切换成功`)                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh: 'mesh/穹破刀.vb',                     orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI/2),                     scale: new Box3Vector3(0.4, 0.7, 0.4),                     offset: new Box3Vector3(-0.05, 0.4 ,1),                     });             }              break;             case 1:             const result1 = await entity.player.dialog({                 type: Box3DialogType.SELECT,                 title: `${entity.player.name}的状态`,                 content: `视角切换`,                 options: ['第一人称','第三人称']             });
 

            if (!result1 || result1=== null) return;
 

            switch (result1.index) {                 case 0:                     entity.player.cameraMode = 'FPS'                 break;
 

                case 1:                 entity.player.cameraMode = 'FOLLOW'                 break;                 default:                 }                                  case 2:                     entity.position.set(54,10,58)                 break;             default:     }      });



world.onPlayerJoin(({ entity }) => {     Object.assign(entity, {         particleRate: 7,         particleSize: [2, 4, 8, 4, 10],         particleColor: [             new Box3RGBColor(10, 9, 2),             new Box3RGBColor(5, 0.25, 0.1),             new Box3RGBColor(3, 0.05, 0.05),             new Box3RGBColor(0, 0, 0),             new Box3RGBColor(0, 0, 0),         ],         particleLifetime: 1,         particleVelocitySpread: new Box3Vector3(2, 2, 2),     }); });

emotion_doge

点赞0


评论


编码喵编码喵

建议不要面相过程,面相对象可以更简便,加油

点赞0


评论


快乐的皮卡丘A快乐的皮卡丘A

#雀食很水,排版都没有

点赞1


评论


灵清帝王吃爆一切厕所灵清帝王吃爆一切厕所

收藏

点赞0


评论


Robot一只屑代码师Robot一只屑代码师

world.onPress(async({ button, entity }) => {     if(button != Box3ButtonType.ACTION1 || !entity.isPlayer || entity.player.dead) return;     const result = await entity.player.dialog({         type: Box3DialogType.SELECT,         title: `${entity.player.name}的状态`,         options: ['切换武器','切换视角','脱离卡点'],     });



    if (!result || result === null)      return;     // 判断玩家选了什么选项。     switch (result.index) {     case 0:
 

            const result = await entity.player.dialog({                 type: Box3DialogType.SELECT,                 content: `切换魔法`,                 options: ['剑','剑之刃','蓝之剑','圣之法杖','冰——喵','法仗','星月权杖','穹破刀','弓']             });
 

            if (!result || result === null)              return;
 

            switch (result.index) {                 case 0:                 entity.fashuy = 1                 entity.fashu = `剑`                 entity.act = 90                 const handWears = entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears[0]);                     entity.player.directMessage(`切换成功`)                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh: 'mesh/剑.vb',                     orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI/2),                     scale: new Box3Vector3(0.4, 0.7, 0.4),                     offset: new Box3Vector3(-0.05, 0.4 ,1.4),
 

    });                              break;                 case 1:                 entity. fashuy = 2                 entity.fashu = `剑之刃`                 entity.act = 120                 const handWears1 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears1[0]);                     entity.player.directMessage(`切换成功`);                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh: 'mesh/剑之刃.vb',                     orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI/2),                     offset: new Box3Vector3(-0.05, 0.4 ,1.4),     });         
 

                    break;                 case 2:                 entity.fashu = `蓝之剑`                 entity.act = 105                 const handWears2 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears2[0]);                     entity.player.directMessage(`切换成功`)                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh: 'mesh/蓝之剑.vb',                     orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI/2),                     scale: new Box3Vector3(0.4, 0.7, 0.4),                     offset: new Box3Vector3(-0.05, 0.4 ,1),     });         
 

                    break;                 case 3:                 entity.fashu = `圣之法杖`                 entity.act = 130                 const handWears3 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears3[0]);                     entity.player.directMessage(`切换成功`)                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh: 'mesh/圣之法杖.vb',                     orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI/2.5),                     scale: new Box3Vector3(0.4, 0.7, 0.4),                     offset: new Box3Vector3(-0.05, 0.2 ,0.4)     });
 

                    break;                                           case 4:                 entity.fashu = `冰——喵`                 entity.act = 150                 const handWears4 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears4[0]);                     entity.player.directMessage(`切换成功`)                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh: 'mesh/冰——喵.vb',                     orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI/2),                     scale: new Box3Vector3(0.4, 0.7, 0.4),                     offset: new Box3Vector3(-0.05, 0.4 ,1),     });                              break;                 case 5:                 entity.fashu = `法仗`                 entity.act = 170                 const handWears5= entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears5[0]);                     entity.player.directMessage(`切换成功`)                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh:'mesh/法仗.vb',                     orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI/2),                     scale: new Box3Vector3(0.4, 0.7, 0.4),                     offset: new Box3Vector3(-0.05, 0.4 ,1),     });                              break;                 case 6:                 entity.fashu = `星月权杖`                 entity.act = 125                 const handWears6 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears6[0]);                     entity.player.directMessage(`切换成功`)                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh: 'mesh/星月权杖.vb',                     orientation: new Box3Quaternion(0, 1, -3, 9).rotateY(Math.PI/2),                     scale: new Box3Vector3(0.4, 0.55, 0.4),                     offset: new Box3Vector3(0, 0.7 ,0.6),     });                                          break;                 case 7:                 entity.fashu = `穹破刀`                 entity.act = 135                 const handWears7 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);                      entity.player.removeWearable(handWears7[0]);                     entity.player.directMessage(`切换成功`)                     entity.player.addWearable({                     bodyPart: Box3BodyPart.RIGHT_HAND,                     mesh: 'mesh/穹破刀.vb',                     orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI/2),                     scale: new Box3Vector3(0.4, 0.7, 0.4),                     offset: new Box3Vector3(-0.05, 0.4 ,1),                     });             }              break;             case 1:             const result1 = await entity.player.dialog({                 type: Box3DialogType.SELECT,                 title: `${entity.player.name}的状态`,                 content: `视角切换`,                 options: ['第一人称','第三人称']             });
 

            if (!result1 || result1=== null) return;
 

            switch (result1.index) {                 case 0:                     entity.player.cameraMode = 'FPS'                 break;
 

                case 1:                 entity.player.cameraMode = 'FOLLOW'                 break;                 default:                 }                                  case 2:                     entity.position.set(54,10,58)                 break;             default:     }      });



world.onPlayerJoin(({ entity }) => {     Object.assign(entity, {         particleRate: 7,         particleSize: [2, 4, 8, 4, 10],         particleColor: [             new Box3RGBColor(10, 9, 2),             new Box3RGBColor(5, 0.25, 0.1),             new Box3RGBColor(3, 0.05, 0.05),             new Box3RGBColor(0, 0, 0),             new Box3RGBColor(0, 0, 0),         ],         particleLifetime: 1,         particleVelocitySpread: new Box3Vector3(2, 2, 2),     }); });

点赞0


评论


Weeb_ETOWeeb_ETO

imgsrc="https://static.codemao.cn/emoji/codemao/%E7%BC%96%E7%A8%8B%E7%8C%AB_%E5%8A%A0%E6%B2%B9.gif"alt="emotion_编程猫_加油"

点赞0


评论


宁毅吖宁毅吖

#水

点赞0


评论


未名用户未名用户

imgsrc="https://static.codemao.cn/emotion/thunder_monkey/%E9%9B%B7%E7%94%B5%E7%8C%B4z.gif"alt="emotion_雷电猴_嗯嗯"

点赞0


评论


屑怪盗屑怪盗

收藏

点赞0


评论


烟魂烟魂

world.onPress(async({
        button,
        entity
}) = >{
        if (button != Box3ButtonType.ACTION1 || !entity.isPlayer || entity.player.dead) return;
        const result = await entity.player.dialog({
                type: Box3DialogType.SELECT,
                title: `$ {
                        entity.player.name
                }的状态`,
                options: ['切换武器', '切换视角', '脱离卡点'],
        });

        if (!result || result === null) return; // 判断玩家选了什么选项。     switch (result.index) {     case 0:
        const result = await entity.player.dialog({
                type: Box3DialogType.SELECT,
                content: `切换魔法`,
                options: ['剑', '剑之刃', '蓝之剑', '圣之法杖', '冰——喵', '法仗', '星月权杖', '穹破刀', '弓']
        });

        if (!result || result === null) return;

        switch (result.index) {
        case 0:
                entity.fashuy = 1 entity.fashu = `剑`entity.act = 90 const handWears = entity.player.wearables(Box3BodyPart.RIGHT_HAND);
                entity.player.removeWearable(handWears[0]);
                entity.player.directMessage(`切换成功`) entity.player.addWearable({
                        bodyPart: Box3BodyPart.RIGHT_HAND,
                        mesh: 'mesh/剑.vb',
                        orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI / 2),
                        scale: new Box3Vector3(0.4, 0.7, 0.4),
                        offset: new Box3Vector3( - 0.05, 0.4, 1.4),

                });
                break;
        case 1:
                entity.fashuy = 2 entity.fashu = `剑之刃`entity.act = 120 const handWears1 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);
                entity.player.removeWearable(handWears1[0]);
                entity.player.directMessage(`切换成功`);
                entity.player.addWearable({
                        bodyPart: Box3BodyPart.RIGHT_HAND,
                        mesh: 'mesh/剑之刃.vb',
                        orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI / 2),
                        offset: new Box3Vector3( - 0.05, 0.4, 1.4),
                });

                break;
        case 2:
                entity.fashu = `蓝之剑`entity.act = 105 const handWears2 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);
                entity.player.removeWearable(handWears2[0]);
                entity.player.directMessage(`切换成功`) entity.player.addWearable({
                        bodyPart: Box3BodyPart.RIGHT_HAND,
                        mesh: 'mesh/蓝之剑.vb',
                        orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI / 2),
                        scale: new Box3Vector3(0.4, 0.7, 0.4),
                        offset: new Box3Vector3( - 0.05, 0.4, 1),
                });

                break;
        case 3:
                entity.fashu = `圣之法杖`entity.act = 130 const handWears3 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);
                entity.player.removeWearable(handWears3[0]);
                entity.player.directMessage(`切换成功`) entity.player.addWearable({
                        bodyPart: Box3BodyPart.RIGHT_HAND,
                        mesh: 'mesh/圣之法杖.vb',
                        orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI / 2.5),
                        scale: new Box3Vector3(0.4, 0.7, 0.4),
                        offset: new Box3Vector3( - 0.05, 0.2, 0.4)
                });

                break;
        case 4:
                entity.fashu = `冰——喵`entity.act = 150 const handWears4 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);
                entity.player.removeWearable(handWears4[0]);
                entity.player.directMessage(`切换成功`) entity.player.addWearable({
                        bodyPart: Box3BodyPart.RIGHT_HAND,
                        mesh: 'mesh/冰——喵.vb',
                        orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI / 2),
                        scale: new Box3Vector3(0.4, 0.7, 0.4),
                        offset: new Box3Vector3( - 0.05, 0.4, 1),
                });
                break;
        case 5:
                entity.fashu = `法仗`entity.act = 170 const handWears5 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);
                entity.player.removeWearable(handWears5[0]);
                entity.player.directMessage(`切换成功`) entity.player.addWearable({
                        bodyPart: Box3BodyPart.RIGHT_HAND,
                        mesh: 'mesh/法仗.vb',
                        orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI / 2),
                        scale: new Box3Vector3(0.4, 0.7, 0.4),
                        offset: new Box3Vector3( - 0.05, 0.4, 1),
                });
                break;
        case 6:
                entity.fashu = `星月权杖`entity.act = 125 const handWears6 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);
                entity.player.removeWearable(handWears6[0]);
                entity.player.directMessage(`切换成功`) entity.player.addWearable({
                        bodyPart: Box3BodyPart.RIGHT_HAND,
                        mesh: 'mesh/星月权杖.vb',
                        orientation: new Box3Quaternion(0, 1, -3, 9).rotateY(Math.PI / 2),
                        scale: new Box3Vector3(0.4, 0.55, 0.4),
                        offset: new Box3Vector3(0, 0.7, 0.6),
                });
                break;
        case 7:
                entity.fashu = `穹破刀`entity.act = 135 const handWears7 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);
                entity.player.removeWearable(handWears7[0]);
                entity.player.directMessage(`切换成功`) entity.player.addWearable({
                        bodyPart: Box3BodyPart.RIGHT_HAND,
                        mesh: 'mesh/穹破刀.vb',
                        orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI / 2),
                        scale: new Box3Vector3(0.4, 0.7, 0.4),
                        offset: new Box3Vector3( - 0.05, 0.4, 1),
                });
        }
        break;
case 1:
        const result1 = await entity.player.dialog({
                type: Box3DialogType.SELECT,
                title: `$ {
                        entity.player.name
                }的状态`,
                content: `视角切换`,
                options: ['第一人称', '第三人称']
        });

        if (!result1 || result1 === null) return;

        switch (result1.index) {
        case 0:
                entity.player.cameraMode = 'FPS'
                break;

        case 1:
                entity.player.cameraMode = 'FOLLOW'
                break;
        default:
        }
case 2:
        entity.position.set(54, 10, 58) break;
default:
}
});

world.onPlayerJoin(({
        entity
}) = >{
        Object.assign(entity, {
                particleRate: 7,
                particleSize: [2, 4, 8, 4, 10],
                particleColor: [new Box3RGBColor(10, 9, 2), new Box3RGBColor(5, 0.25, 0.1), new Box3RGBColor(3, 0.05, 0.05), new Box3RGBColor(0, 0, 0), new Box3RGBColor(0, 0, 0), ],
                particleLifetime: 1,
                particleVelocitySpread: new Box3Vector3(2, 2, 2),
        });
});

点赞0


评论


AokenAoken

收藏

点赞0


评论


李宇捷宇捷李宇捷宇捷

kkm

点赞1


评论


李宇捷宇捷李宇捷宇捷

k..

点赞1


评论


AokenAoken

排版

world.onPress(async ({ button,entity }) => {
    if (button != Box3ButtonType.ACTION1 || !entity.isPlayer || entity.player.dead)return;
    const result = await entity.player.dialog({
        type: Box3DialogType.SELECT,
        title: `${entity.player.name}的状态`,
        options: ['切换武器', '切换视角', '脱离卡点'],
    });

    if (!result || result === null) return; // 判断玩家选了什么选项。     
    switch (result.index) {     
        case 0:
           const result = await entity.player.dialog({
               type: Box3DialogType.SELECT,
               content: `切换魔法`,
               options: ['剑', '剑之刃', '蓝之剑', '圣之法杖', '冰——喵', '法仗', '星月权杖', '穹破刀', '弓']
           });
        
           if (!result || result === null) return;
        
           switch (result.index) {
               case 0:
                   entity.fashuy = 1 
                   entity.fashu = `剑`
                   entity.act = 90
                   const handWears = entity.player.wearables(Box3BodyPart.RIGHT_HAND);
                   entity.player.removeWearable(handWears[0]);
                   entity.player.directMessage(`切换成功`) 
                   entity.player.addWearable({
                       bodyPart: Box3BodyPart.RIGHT_HAND,
                       mesh: 'mesh/剑.vb',
                       orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI / 2),
                       scale: new Box3Vector3(0.4, 0.7, 0.4),
                       offset: new Box3Vector3(-0.05, 0.4, 1.4),
                   });break;
                
                   case 1:
                       entity.fashuy = 2 
                       entity.fashu = `剑之刃`
                       entity.act = 120
                       const handWears1 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);
                       entity.player.removeWearable(handWears1[0]);
                       entity.player.directMessage(`切换成功`);
                       entity.player.addWearable({
                           bodyPart: Box3BodyPart.RIGHT_HAND,
                           mesh: 'mesh/剑之刃.vb',
                           orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI / 2),
                           offset: new Box3Vector3(-0.05, 0.4, 1.4),
                       });break;
                    
                   case 2:
                       entity.fashu = `蓝之剑`
                       entity.act = 105
                       const handWears2 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);
                       entity.player.removeWearable(handWears2[0]);
                       entity.player.directMessage(`切换成功`) 
                       entity.player.addWearable({
                           bodyPart: Box3BodyPart.RIGHT_HAND,
                           mesh: 'mesh/蓝之剑.vb',
                           orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI / 2),
                           scale: new Box3Vector3(0.4, 0.7, 0.4),
                           offset: new Box3Vector3(-0.05, 0.4, 1),
                       });break;
                    
                   case 3:
                       entity.fashu = `圣之法杖`
                       entity.act = 130
                       const handWears3 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);
                       entity.player.removeWearable(handWears3[0]);
                       entity.player.directMessage(`切换成功`) 
                       entity.player.addWearable({
                           bodyPart: Box3BodyPart.RIGHT_HAND,
                           mesh: 'mesh/圣之法杖.vb',
                           orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI / 2.5),
                           scale: new Box3Vector3(0.4, 0.7, 0.4),
                           offset: new Box3Vector3(-0.05, 0.2, 0.4)
                       });break;
                    
                   case 4:
                       entity.fashu = `冰——喵`
                       entity.act = 150
                       const handWears4 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);
                       entity.player.removeWearable(handWears4[0]);
                       entity.player.directMessage(`切换成功`) 
                       entity.player.addWearable({
                           bodyPart: Box3BodyPart.RIGHT_HAND,
                           mesh: 'mesh/冰——喵.vb',
                           orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI / 2),
                           scale: new Box3Vector3(0.4, 0.7, 0.4),
                           offset: new Box3Vector3(-0.05, 0.4, 1),
                       });break;
                    
                   case 5:
                       entity.fashu = `法仗`
                       entity.act = 170
                       const handWears5 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);
                       entity.player.removeWearable(handWears5[0]);
                       entity.player.directMessage(`切换成功`) 
                       entity.player.addWearable({
                           bodyPart: Box3BodyPart.RIGHT_HAND,
                           mesh: 'mesh/法仗.vb',
                           orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI / 2),
                           scale: new Box3Vector3(0.4, 0.7, 0.4),
                           offset: new Box3Vector3(-0.05, 0.4, 1),
                       });break;

                   case 6:
                       entity.fashu = `星月权杖`
                       entity.act = 125
                       const handWears6 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);
                       entity.player.removeWearable(handWears6[0]);
                       entity.player.directMessage(`切换成功`) 
                       entity.player.addWearable({
                           bodyPart: Box3BodyPart.RIGHT_HAND,
                           mesh: 'mesh/星月权杖.vb',
                           orientation: new Box3Quaternion(0, 1, -3, 9).rotateY(Math.PI / 2),
                           scale: new Box3Vector3(0.4, 0.55, 0.4),
                           offset: new Box3Vector3(0, 0.7, 0.6),
                       });break;

                   case 7:
                       entity.fashu = `穹破刀`
                       entity.act = 135
                       const handWears7 = entity.player.wearables(Box3BodyPart.RIGHT_HAND);
                       entity.player.removeWearable(handWears7[0]);
                       entity.player.directMessage(`切换成功`) 
                       entity.player.addWearable({
                           bodyPart: Box3BodyPart.RIGHT_HAND,
                           mesh: 'mesh/穹破刀.vb',
                           orientation: new Box3Quaternion(0.4, 1.3, 0.5).rotateY(Math.PI / 2),
                           scale: new Box3Vector3(0.4, 0.7, 0.4),
                           offset: new Box3Vector3(-0.05, 0.4, 1),
                       });
               }break;

    case 1: 
        const result1 = await entity.player.dialog({
        type: Box3DialogType.SELECT,
        title: `${entity.player.name}的状态`,
        content: `视角切换`,
        options: ['第一人称', '第三人称']
    });

    if (!result1 || result1 === null) return;

    switch (result1.index) {
        case 0:
            entity.player.cameraMode = 'FPS'
            break;
        case 1:
            entity.player.cameraMode = 'FOLLOW'
            break;
        default:
    }
    case 2: entity.position.set(54, 10, 58);break;
    default:
    }
});

world.onPlayerJoin(({ entity }) => {
    Object.assign(entity, {
        particleRate: 7,
        particleSize: [2, 4, 8, 4, 10],
        particleColor: [
            new Box3RGBColor(10, 9, 2), 
            new Box3RGBColor(5, 0.25, 0.1), 
            new Box3RGBColor(3, 0.05, 0.05), 
            new Box3RGBColor(0, 0, 0), 
            new Box3RGBColor(0, 0, 0), 
        ],particleLifetime: 1,
        particleVelocitySpread: new Box3Vector3(2, 2, 2),
    });
});

点赞2


评论


神奇代码岛func王清林神奇代码岛func王清林

  6

点赞0


评论