From 721edefababf4f7e0fa5bce27add5a87d1e9c4e0 Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Thu, 25 Sep 2025 12:56:45 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=88=A0=E9=99=A4=20game-draw=20?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E5=85=B6=E4=BB=96=E5=86=85=E5=AE=B9=EF=BC=8C?= =?UTF-8?q?=E5=8F=AA=E4=BF=9D=E7=95=99=20render-main?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 10 +- .../src/render/components/input.tsx | 2 +- .../client-modules/src/render/shared.ts | 18 +- .../client-modules/src/render/ui/main.tsx | 35 ++-- packages-user/data-base/src/game.ts | 154 +++++++++--------- public/libs/control.js | 89 +--------- public/libs/ui.js | 14 +- public/main.js | 10 +- public/styles.css | 6 +- 9 files changed, 121 insertions(+), 217 deletions(-) diff --git a/index.html b/index.html index 5be5cff..e833ef9 100644 --- a/index.html +++ b/index.html @@ -20,14 +20,8 @@ -
-
- - - 此浏览器不支持HTML5 - - -
+
+
diff --git a/packages-user/client-modules/src/render/components/input.tsx b/packages-user/client-modules/src/render/components/input.tsx index 68e1eca..9f219b4 100644 --- a/packages-user/client-modules/src/render/components/input.tsx +++ b/packages-user/client-modules/src/render/components/input.tsx @@ -155,7 +155,7 @@ export const Input = defineComponent( now = now.parent; } - // 应用内边距偏移. + // 应用内边距偏移 const { clientLeft, clientTop } = canvas; const trans = new Transform(); trans.translate(clientLeft, clientTop); diff --git a/packages-user/client-modules/src/render/shared.ts b/packages-user/client-modules/src/render/shared.ts index 9a84166..add5d24 100644 --- a/packages-user/client-modules/src/render/shared.ts +++ b/packages-user/client-modules/src/render/shared.ts @@ -2,18 +2,20 @@ export const MAP_BLOCK_WIDTH = 15; export const MAP_BLOCK_HEIGHT = 15; -// 状态栏像素宽高 -export const STATUS_BAR_WIDTH = 180; -export const STATUS_BAR_HEIGHT = 32 * MAP_BLOCK_HEIGHT; - -// 是否启用右侧状态栏 -export const ENABLE_RIGHT_STATUS_BAR = true; -export const STATUS_BAR_COUNT = ENABLE_RIGHT_STATUS_BAR ? 2 : 1; - // 地图像素宽高 export const MAP_WIDTH = 32 * MAP_BLOCK_WIDTH; export const MAP_HEIGHT = 32 * MAP_BLOCK_HEIGHT; +// 状态栏像素宽高 +export const STATUS_BAR_WIDTH = 180; +export const STATUS_BAR_HEIGHT = 32 * MAP_BLOCK_HEIGHT; +// 右侧状态栏的横坐标 +export const RIGHT_STATUS_POS = STATUS_BAR_WIDTH + MAP_WIDTH; + +// 是否启用右侧状态栏 +export const ENABLE_RIGHT_STATUS_BAR = true; +export const STATUS_BAR_COUNT = ENABLE_RIGHT_STATUS_BAR ? 2 : 1; + // 游戏画面像素宽高,宽=地图宽度+状态栏宽度*状态栏数量 export const MAIN_WIDTH = MAP_WIDTH + STATUS_BAR_WIDTH * STATUS_BAR_COUNT; export const MAIN_HEIGHT = MAP_HEIGHT; diff --git a/packages-user/client-modules/src/render/ui/main.tsx b/packages-user/client-modules/src/render/ui/main.tsx index f146135..fae5423 100644 --- a/packages-user/client-modules/src/render/ui/main.tsx +++ b/packages-user/client-modules/src/render/ui/main.tsx @@ -19,8 +19,12 @@ import { import { Textbox, Tip } from '../components'; import { GameUI } from '@motajs/system-ui'; import { + ENABLE_RIGHT_STATUS_BAR, MAIN_HEIGHT, MAIN_WIDTH, + MAP_HEIGHT, + MAP_WIDTH, + RIGHT_STATUS_POS, STATUS_BAR_HEIGHT, STATUS_BAR_WIDTH } from '../shared'; @@ -71,7 +75,7 @@ const MainScene = defineComponent(() => { const mainTextboxProps: Props = { text: '', hidden: true, - loc: [0, 330, 480, 150], + loc: [0, MAP_HEIGHT - 150, MAIN_WIDTH, 150], zIndex: 30, fillStyle: '#fff', titleFill: 'gold', @@ -80,7 +84,7 @@ const MainScene = defineComponent(() => { winskin: 'winskin2.png', interval: 100, lineHeight: 4, - width: 480 + width: MAP_WIDTH }; const map = shallowRef(); @@ -267,10 +271,13 @@ const MainScene = defineComponent(() => { status={leftStatus} hidden={hideStatus.value} > - + { /> - + { noevent >