mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-01-19 20:59:37 +08:00
fix: 黄蓝门转换动画
This commit is contained in:
parent
85af7259ec
commit
288c76c194
@ -1,5 +1,6 @@
|
|||||||
import { backDir, has } from '@/plugin/game/utils';
|
import { backDir, has } from '@/plugin/game/utils';
|
||||||
import { loading } from '../game';
|
import { loading } from '../game';
|
||||||
|
import type { LayerDoorAnimate } from '@/core/render/preset/floor';
|
||||||
|
|
||||||
export namespace BluePalace {
|
export namespace BluePalace {
|
||||||
type DoorConvertInfo = [id: AllIds, x: number, y: number];
|
type DoorConvertInfo = [id: AllIds, x: number, y: number];
|
||||||
@ -26,9 +27,6 @@ export namespace BluePalace {
|
|||||||
core.extractBlocks(floorId);
|
core.extractBlocks(floorId);
|
||||||
const blocks = core.status.maps[floorId].blocks;
|
const blocks = core.status.maps[floorId].blocks;
|
||||||
|
|
||||||
const ctx = core.createCanvas(`@doorConvert`, 0, 0, 480, 480, 35);
|
|
||||||
const time = core.values.animateSpeed / 3;
|
|
||||||
|
|
||||||
const toConvert: DoorConvertInfo[] = [];
|
const toConvert: DoorConvertInfo[] = [];
|
||||||
blocks.forEach(v => {
|
blocks.forEach(v => {
|
||||||
if (v.id === 492) {
|
if (v.id === 492) {
|
||||||
@ -52,32 +50,25 @@ export namespace BluePalace {
|
|||||||
core.lockControl();
|
core.lockControl();
|
||||||
core.playSound('door.mp3');
|
core.playSound('door.mp3');
|
||||||
|
|
||||||
new Promise<void>(res => {
|
const Adapter = Mota.require('module', 'Render').RenderAdapter;
|
||||||
drawDoors(ctx, toConvert, 0);
|
const adapter = Adapter.get<LayerDoorAnimate>('door-animate');
|
||||||
setTimeout(res, time);
|
const texture = Mota.require('module', 'Render').texture;
|
||||||
|
if (adapter) {
|
||||||
|
Promise.all(
|
||||||
|
toConvert.map(v => {
|
||||||
|
const block = core.initBlock(
|
||||||
|
v[1],
|
||||||
|
v[2],
|
||||||
|
texture.idNumberMap[v[0]]
|
||||||
|
);
|
||||||
|
return adapter.all('openDoor', block);
|
||||||
})
|
})
|
||||||
.then(() => {
|
).then(() => {
|
||||||
drawDoors(ctx, toConvert, 1);
|
|
||||||
return new Promise<void>(res => {
|
|
||||||
setTimeout(res, time);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
drawDoors(ctx, toConvert, 2);
|
|
||||||
return new Promise<void>(res => {
|
|
||||||
setTimeout(res, time);
|
|
||||||
});
|
|
||||||
})
|
|
||||||
.then(() => {
|
|
||||||
drawDoors(ctx, toConvert, 3);
|
|
||||||
return new Promise<void>(res => {
|
|
||||||
core.unlockControl();
|
core.unlockControl();
|
||||||
core.deleteCanvas('@doorConvert');
|
|
||||||
core.doAction();
|
core.doAction();
|
||||||
setTimeout(res, time);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// ---------- 传送门部分
|
// ---------- 传送门部分
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user