From 288c76c19421087e7f47e13e0160751034fcbe2e Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Wed, 28 Aug 2024 13:44:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=BB=84=E8=93=9D=E9=97=A8=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/game/mechanism/misc.ts | 45 +++++++++++++++----------------------- 1 file changed, 18 insertions(+), 27 deletions(-) diff --git a/src/game/mechanism/misc.ts b/src/game/mechanism/misc.ts index 41ebf88..28e968f 100644 --- a/src/game/mechanism/misc.ts +++ b/src/game/mechanism/misc.ts @@ -1,5 +1,6 @@ import { backDir, has } from '@/plugin/game/utils'; import { loading } from '../game'; +import type { LayerDoorAnimate } from '@/core/render/preset/floor'; export namespace BluePalace { type DoorConvertInfo = [id: AllIds, x: number, y: number]; @@ -26,9 +27,6 @@ export namespace BluePalace { core.extractBlocks(floorId); 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[] = []; blocks.forEach(v => { if (v.id === 492) { @@ -52,31 +50,24 @@ export namespace BluePalace { core.lockControl(); core.playSound('door.mp3'); - new Promise(res => { - drawDoors(ctx, toConvert, 0); - setTimeout(res, time); - }) - .then(() => { - drawDoors(ctx, toConvert, 1); - return new Promise(res => { - setTimeout(res, time); - }); - }) - .then(() => { - drawDoors(ctx, toConvert, 2); - return new Promise(res => { - setTimeout(res, time); - }); - }) - .then(() => { - drawDoors(ctx, toConvert, 3); - return new Promise(res => { - core.unlockControl(); - core.deleteCanvas('@doorConvert'); - core.doAction(); - setTimeout(res, time); - }); + const Adapter = Mota.require('module', 'Render').RenderAdapter; + const adapter = Adapter.get('door-animate'); + 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(() => { + core.unlockControl(); + core.doAction(); }); + } } // ---------- 传送门部分