猫史档案馆


为什么会报错(GUI模板)()()()

用户:老李头13zl老李头13zl查看:2 回复:2 评论:2 创建时间:2023-07-03T17:32:38


<html>
    <head>
    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 ? "启用" : "禁用"}`);
    });
})
    </head>
</html>


回复

上一页1 页 / 共 1下一页
145a145a

为什么html

点赞0


评论


FML饭米粒FML饭米粒

<html></html>

<head></head>

去掉)这不是html)

况且这玩意貌似是xml)不是html

点赞1


评论