From b0e420c167c4eb76dab2c26049782536eb1aa1ff Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Mon, 24 Feb 2025 21:01:55 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=88=A0=E9=99=A4=E4=B9=8B=E5=89=8D?= =?UTF-8?q?=E7=9A=84=E7=8A=B6=E6=80=81=E6=A0=8F=E5=92=8C=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/libs/control.js | 3 --- public/project/functions.js | 3 --- src/core/main/custom/toolbar.ts | 43 ------------------------------ src/core/render/preset/graphics.ts | 4 ++- src/module/render/ui/main.tsx | 16 +++++++++++ src/module/render/ui/statusBar.tsx | 11 ++++---- src/plugin/game/ui.ts | 14 ++-------- src/ui/toolEditor.vue | 8 ++---- 8 files changed, 29 insertions(+), 73 deletions(-) diff --git a/public/libs/control.js b/public/libs/control.js index a3254ec..49333c5 100644 --- a/public/libs/control.js +++ b/public/libs/control.js @@ -1284,7 +1284,6 @@ control.prototype.startReplay = function (list) { // '由于不可抗力,录像播放过程中将没有勇士移动动画' // ); Mota.require('var', 'hook').emit('replayStatus', false); - Mota.require('class', 'CustomToolbar').setDefaultTool(true); this.replay(); }; @@ -1380,7 +1379,6 @@ control.prototype.stopReplay = function (force) { core.updateStatusBar(false, true); core.drawTip('停止播放并恢复游戏'); Mota.require('var', 'hook').emit('replayStatus', true); - Mota.require('class', 'CustomToolbar').setDefaultTool(false); }; ////// 回退 ////// @@ -1417,7 +1415,6 @@ control.prototype.rewindReplay = function () { core.control._replay_drawProgress(); core.updateStatusBar(false, true); core.drawTip('成功回退到上一个节点'); - Mota.require('class', 'CustomToolbar').setDefaultTool(true); }); }; diff --git a/public/project/functions.js b/public/project/functions.js index 8aa2985..ca4d56a 100644 --- a/public/project/functions.js +++ b/public/project/functions.js @@ -78,9 +78,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = { }); } - Mota.r(() => { - Mota.require('class', 'CustomToolbar').setDefaultTool(false); - }); const { NightSpecial, HeroSkill } = Mota.require( 'module', 'Mechanism' diff --git a/src/core/main/custom/toolbar.ts b/src/core/main/custom/toolbar.ts index 56ba076..104a55c 100644 --- a/src/core/main/custom/toolbar.ts +++ b/src/core/main/custom/toolbar.ts @@ -411,44 +411,6 @@ export class CustomToolbar extends EventEmitter { static closeAll() { this.list.forEach(v => v.closeAll()); } - - /** - * 设置默认工具栏的内容 - */ - static setDefaultTool(replaying: boolean) { - const mainStorage = GameStorage.for(GameStorage.fromGame('main')); - mainStorage.read(); - let defaultsTool = CustomToolbar.list.find(v => v.id === '@defaults'); - const hasDefaults = !!defaultsTool; - if (!defaultsTool) { - defaultsTool = new CustomToolbar('@defaults', true); - } - defaultsTool.closeAll(); - defaultsTool.items.splice(0); - defaultsTool.add(replaying ? replayingDefaultTool : playingDefaultTool); - if (!mainStorage.getValue('played', false)) { - mainStorage.setValue('played', true); - - // 计算位置,显示在游戏画面下方 - if (!hasDefaults) { - const game = core.dom.gameDraw; - const bottom = game.offsetTop + game.offsetHeight; - const left = game.offsetLeft; - const width = game.offsetWidth; - - if (isMobile) { - // 手机端显示在最下方 - defaultsTool.setPos(16, bottom); - defaultsTool.setSize(window.innerWidth - 32, 85); - } else { - // 电脑显示在屏幕右方 - defaultsTool.setPos(left, bottom); - defaultsTool.setSize(width, 70); - } - } - } - defaultsTool.show(); - } } Mota.require('var', 'loading').once('coreInit', () => { @@ -465,8 +427,3 @@ Mota.require('var', 'loading').once('coreInit', () => { Mota.require('var', 'hook').on('reset', () => { CustomToolbar.showAll(); }); - -Mota.require('var', 'hook').once('reset', () => { - CustomToolbar.setDefaultTool(false); - CustomToolbar.save(); -}); diff --git a/src/core/render/preset/graphics.ts b/src/core/render/preset/graphics.ts index 03271cf..16d3011 100644 --- a/src/core/render/preset/graphics.ts +++ b/src/core/render/preset/graphics.ts @@ -114,6 +114,7 @@ export abstract class GraphicItemBase lineCap: CanvasLineCap = 'butt'; miterLimit: number = 10; fillRule: CanvasFillRule = 'nonzero'; + enableCache: boolean = false; private propFill: boolean = true; private propStroke: boolean = false; @@ -122,7 +123,7 @@ export abstract class GraphicItemBase private actionStroke: boolean = false; private cachePath?: Path2D; - protected pathDirty: boolean = false; + protected pathDirty: boolean = true; /** * 获取这个元素的绘制路径 @@ -141,6 +142,7 @@ export abstract class GraphicItemBase } const path = this.cachePath; if (!path) return; + switch (this.mode) { case GraphicMode.Fill: ctx.fill(path, this.fillRule); diff --git a/src/module/render/ui/main.tsx b/src/module/render/ui/main.tsx index 3131dce..7e467d5 100644 --- a/src/module/render/ui/main.tsx +++ b/src/module/render/ui/main.tsx @@ -71,6 +71,7 @@ const MainScene = defineComponent(() => { }; const map = ref(); + const hideStatus = ref(false); const weather = new WeatherController('main'); onMounted(() => { @@ -114,6 +115,8 @@ const MainScene = defineComponent(() => { const updateStatus = () => { if (!core.status || !core.status.hero || !core.status.floorId) return; + hideStatus.value = core.getFlag('hideStatusBar', false); + const hero = core.status.hero; const floor = core.status.floorId; leftStatus.atk = getHeroStatusOn('atk'); @@ -171,6 +174,7 @@ const MainScene = defineComponent(() => { )} @@ -191,6 +195,7 @@ const MainScene = defineComponent(() => { )} { +