用户:
翎with珝查看:0 回复:8 评论:0 创建时间:2023-02-19T18:25:44
废话不多说)
下方小车车给代码(
world.onPlayerJoin(async ({ entity }) => {
entity.player.locus_x = [];
entity.player.locus_y = [];
entity.player.locus_z = [];
});
world.onPress(async ({ button, entity }) => {
if (button == 'action1') {
let menus = await entity.player.dialog({
type: Box3DialogType.SELECT,
content: `菜单`,
options: ['轨迹录制']
});
if (!menus) return;
if (menus) {
if (menus.value == '轨迹录制') {
entity.player.locus_x = [];
entity.player.locus_y = [];
entity.player.locus_z = [];
let locus = await entity.player.dialog({
type: Box3DialogType.SELECT,
content: `是否录制\n(录制时可能会发生卡顿)`,
options: ['是', '否']
});
if (!locus) return;
if (locus) {
if (locus.value == '是') {
entity.player.locus_x = [];
entity.player.locus_y = [];
entity.player.locus_z = [];
let times = await entity.player.dialog({
type: Box3DialogType.INPUT,
content: "请输入录制时间(单位:秒)\n(录制时间不能超过120秒且不能少于15秒)",
placeholder: "时间(单位:秒)",
confirmText: "确认"
});
if (!times) return;
if (times >= 15 && times <= 120) {
await locus_start(entity, times);
} else if (times > 120) {
entity.player.dialog({
type: Box3DialogType.TEXT,
content: `录制时间过长`,
});
} else if (times < 15) {
entity.player.dialog({
type: Box3DialogType.TEXT,
content: `录制时间过短`,
});
}
} else return;
};
};
};
};
});
async function locus_start(entity, time) {
entity.player.cancelDialogs();
let i = 0;
while (i++ <= time * (1000 / 10)) {
entity.player.locus_x.push(entity.position.x);
entity.player.locus_y.push(entity.position.y);
entity.player.locus_z.push(entity.position.z);
if (i % 10 == 0) {//性能好就加这个if
entity.player.directMessage(`轨迹录制进度:\n${i / 100}秒/${time * (1000 / 10) / 100}秒`)
};
await sleep(10);
};
entity.player.dialog({
type: Box3DialogType.TEXT,
content: `轨迹录制完毕\n5秒后播放`,
});
await sleep(1000 * 5)
entity.player.cancelDialogs();
var e = world.createEntity({
position: [entity.player.locus_x[0], entity.player.locus_y[0], entity.player.locus_z[0]],
mesh: 'mesh/吉吉喵.vb',
gravity: false,
fixed: false,
collides: false,
scale: new Box3Vector3(1 / 32, 1 / 32, 1 / 32)
});
entity.player.cameraEntity = e;
for (let n = 0; n <= entity.player.locus_x.length; n++) {
e.position.x = entity.player.locus_x[n];
e.position.y = entity.player.locus_y[n];
e.position.z = entity.player.locus_z[n];
if (n % 10 == 0) {//性能好就加这个if
entity.player.directMessage(`轨迹录制进度:\n${i / 100}秒/${time * (1000 / 10) / 100}秒`)
};
await sleep(10);
};
await sleep(1000);
entity.player.dialog({
type: Box3DialogType.TEXT,
content: `轨迹播放完毕`,
});
entity.player.cameraEntity = entity;
await sleep(5000);
e.destroy();
};
AK亨利佐加DanJamesThomasworld.onPlayerJoin(async ({ entity }) => {
entity.player.locus_x = [];
entity.player.locus_y = [];
entity.player.locus_z = [];
});
world.onPress(async ({ button, entity }) => {
if (button == 'action1') {
let menus = await entity.player.dialog({
type: Box3DialogType.SELECT,
content: `菜单`,
options: ['轨迹录制']
});
if (!menus) return;
if (menus) {
if (menus.value == '轨迹录制') {
entity.player.locus_x = [];
entity.player.locus_y = [];
entity.player.locus_z = [];
let locus = await entity.player.dialog({
type: Box3DialogType.SELECT,
content: `是否录制\n(录制时可能会发生卡顿)`,
options: ['是', '否']
});
if (!locus) return;
if (locus) {
if (locus.value == '是') {
entity.player.locus_x = [];
entity.player.locus_y = [];
entity.player.locus_z = [];
let times = await entity.player.dialog({
type: Box3DialogType.INPUT,
content: "请输入录制时间(单位:秒)\n(录制时间不能超过120秒且不能少于15秒)",
placeholder: "时间(单位:秒)",
confirmText: "确认"
});
if (!times) return;
if (times >= 15 && times <= 120) {
await locus_start(entity, times);
} else if (times > 120) {
entity.player.dialog({
type: Box3DialogType.TEXT,
content: `录制时间过长`,
});
} else if (times < 15) {
entity.player.dialog({
type: Box3DialogType.TEXT,
content: `录制时间过短`,
});
}
} else return;
};
};
};
};
});
async function locus_start(entity, time) {
entity.player.cancelDialogs();
let i = 0;
while (i++ <= time * (1000 / 10)) {
entity.player.locus_x.push(entity.position.x);
entity.player.locus_y.push(entity.position.y);
entity.player.locus_z.push(entity.position.z);
if (i % 10 == 0) {//性能好就加这个if
entity.player.directMessage(`轨迹录制进度:\n${i / 100}秒/${time * (1000 / 10) / 100}秒`)
};
await sleep(10);
};
entity.player.dialog({
type: Box3DialogType.TEXT,
content: `轨迹录制完毕\n5秒后播放`,
});
await sleep(1000 * 5)
entity.player.cancelDialogs();
var e = world.createEntity({
position: [entity.player.locus_x[0], entity.player.locus_y[0], entity.player.locus_z[0]],
mesh: 'mesh/吉吉喵.vb',
gravity: false,
fixed: false,
collides: false,
scale: new Box3Vector3(1 / 32, 1 / 32, 1 / 32)
});
entity.player.cameraEntity = e;
for (let n = 0; n <= entity.player.locus_x.length; n++) {
e.position.x = entity.player.locus_x[n];
e.position.y = entity.player.locus_y[n];
e.position.z = entity.player.locus_z[n];
let newjj = world.createEntity({
mesh:'mesh/吉吉喵.vb',
position:e.position,
gravity: false,
fixed: false,
collides: false,
scale: new Box3Vector3(1 / 32, 1 / 32, 1 / 32)
});
newjj.addTag('jjm');
if (n % 10 == 0) {//性能好就加这个if
entity.player.directMessage(`轨迹录制进度:\n${i / 100}秒/${time * (1000 / 10) / 100}秒`)
};
await sleep(10);
};
await sleep(1000);
entity.player.dialog({
type: Box3DialogType.TEXT,
content: `轨迹播放完毕`,
});
entity.player.cameraEntity = entity;
await sleep(5000);
world.querySelectorAll('.jjm').forEach(e=>e.destroy())
e.destroy();
};
这样更炫、更卡(bushi
点赞0
评论