猫史档案馆


【神奇代码岛】新编辑器GUI模板

用户:小宏XeLa小宏XeLa查看:13261 回复:24 评论:25 创建时间:2023-06-18T18:11:15


 

world.onPlayerJoin(({ entity }) => {
    entity.point = new GameVector3(0, 0, 0);
    entity.player.onPress(({ raycast, button }) => {
        if (button === "action0")
            entity.point = raycast.voxelIndex.clone();
    });
    entity.player.enable3DCursor = true;
    gui.init(entity, {
        "panel": {
            display: true,
            data: `<dialog width="300" percentHeight="100" top="60" right="20" id="">
            <group percentWidth="100" height="120" y="0">
                <label text="玩家坐标" height="35" y="5"  x="10"  percentWidth="100" color="#fff" fontSize="20"></label>
                <label text="" height="25" y="35" x="10" percentWidth="100" color="#fff" id="positionshowdx"></label>
                <label text="" height="25" y="60" x="10" percentWidth="100" color="#fff" id="positionshowdy"></label>
                <label text="" height="25" y="85" x="10" percentWidth="100" color="#fff" id="positionshowdz"></label>
            </group>
            <group percentWidth="100" height="120" y="130">
                <label text="记录点坐标" height="35" y="5"  x="10"  percentWidth="100" color="#fff" fontSize="20"></label>
                <label text="" height="25" y="35" x="10" percentWidth="100" color="#fff" id="pointshowx"></label>
                <label text="" height="25" y="60" x="10" percentWidth="100" color="#fff" id="pointshowy"></label>
                <label text="" height="25" y="85" x="10" percentWidth="100" color="#fff" id="pointshowz"></label>
            </group>
        </dialog>`
        }
    })
    var recordY = entity.position.y;
    world.onTick(() => {
        var space = entity.position.y - recordY;
        var isup = space > 0;
        var isdown = space < 0;
        var Ystatus = `${isdown ? "下降" : (isup ? "上升" : "")}中,变化幅度:`;
        recordY = entity.position.y;
        gui.setAttribute(entity, "#positionshowdx", "text", `X:${~~entity.position.x}`);
        gui.setAttribute(entity, "#positionshowdy", "text", `Y:${~~entity.position.y}` + (Ystatus.length > 7 ? `(${Ystatus}${(space).toFixed(2)})` : ""));
        gui.setAttribute(entity, "#positionshowdz", "text", `Z:${~~entity.position.z}`);
        gui.setAttribute(entity, "#pointshowx", "text", `X:${~~entity.point.x}`);
        gui.setAttribute(entity, "#pointshowy", "text", `Y:${~~entity.point.y}`);
        gui.setAttribute(entity, "#pointshowz", "text", `Z:${~~entity.point.z}`);
        gui.setAttribute(entity, "#flystatus", "text", `状态:${entity.player.canFly ? "启用" : "禁用"}`);
    });
})


回复

上一页第 1 页 / 共 1 页下一页
SHEL深空无尽SHEL深空无尽

泰酷辣沙发(

点赞0


评论

抢!)

再抢)

我抢你沙发!


SHEL深空无尽SHEL深空无尽

泰酷辣(

点赞0


评论


AK亨利佐加DanJamesThomasAK亨利佐加DanJamesThomas

板凳(

点赞0


评论


SHEL深空无尽SHEL深空无尽

说下原理彳亍不(

API找不到(

点赞0


评论


FML饭米粒FML饭米粒

允许自己写html了?!

实在是太棒了)))

点赞1


评论


乐大王乐大王

加一句:while(1){}

点赞0


评论

哇~您真是知识渊博啊~

哇~您真是知识渊博啊~

()()()

作者表示:你礼貌吗?

while(1){}会卡死()(

哇,您真是知识渊博啊~for(;;){}可以解决卡死的问题。

大家不要听作者的,他的代码会卡死,for(;;){}可以解决卡死的问题

for(;;){}是卡死上+卡死 [doge]

[doge]


SCS_user_LoeheodVOQSCS_user_LoeheodVOQ

试了下,渲染好像是后端渲染图片传到前端,想xss不可能的

点赞0


评论


阳光猫阳光猫

emotion_编程猫_点赞

点赞0


评论


𝙲ℴ𝗌𝔦𝒹ₑ𝑟𝙲ℴ𝗌𝔦𝒹ₑ𝑟

真的h5?(疑惑)

点赞0


评论

有点像, 不确定

作者说是x


小鹿UUyM小鹿UUyM

666!

点赞0


评论


编码喵编码喵

怎么检测按钮按下啊

点赞1


评论


小宏XeLa小宏XeLa

温馨提示:这是xml

点赞1


评论

为什么我在岛三见到了xml(

我是已经落后时代了吗???新编辑器支持xml和html?

只支持xml

很好上手的()只要有示例就可以当API用的那种)

你死哪里去了?(复古2个月前的话)

6()


企鹅vItY企鹅vItY

其他玩家退出会报错哎……

点赞1


评论

自己写个当玩家退出时结束循环呗()


暗夜极光暗夜极光

ddd

点赞0


评论


爽快的小电鼠bMMb爽快的小电鼠bMMb

ddd

点赞0


评论


沙拉黄沙拉黄

对于我这种旧编辑器代码师并且退岛了一段时间的人,这串代码让我燃起了当年学习代码的决心......

点赞1


评论


老李头13zl老李头13zl

为什么我放了这代码,总是过一会就把我踢出地图啊

点赞1


评论

顶一下

666


ChenGe_12ChenGe_12

挖坟

点赞0


评论


治愈绾兮治愈绾兮

收藏()

点赞0


评论

怎么不收藏我的新版数据库模板(bushi

我只是不会xml()


sky-*^O^*sky-*^O^*

emotion_编程猫_点赞emotion_编程猫_点赞非常赞

点赞0


评论


烟魂烟魂

这么一说那就简单了gui

点赞0


评论


沙拉黄沙拉黄

为什么非要写dialog标签的id......emotion_编程猫_搓头

点赞0


评论


坦率的血翼蝠5801新号坦率的血翼蝠5801新号

头大了(doge

点赞0


评论


夜影行者夜影行者

收藏

点赞0


评论