chore: 删除样板不需要的 UI

This commit is contained in:
AncTe committed 2025-09-30 13:25:29 +08:00
1 parent 6c75fa507c
commit fbecb5f8e4
36 files changed
+16 -4583

No files matched your search

@@ -1,6 +1,5 @@
import { KeyCode } from '@motajs/client-base';
import { gameKey, HotkeyJSON } from '@motajs/system-action';
import { hovered, mainUi, openDanmakuPoster } from '@motajs/legacy-ui';
import { GameStorage } from '@motajs/legacy-system';
export const mainScope = Symbol.for('@key_main');
@@ -92,16 +91,6 @@ gameKey
name: '浏览地图_2',
defaults: KeyCode.PageDown
})
.register({
id: 'skillTree',
name: '技能树',
defaults: KeyCode.KeyJ
})
.register({
id: 'desc',
name: '百科全书',
defaults: KeyCode.KeyH
})
//#region 功能按键
.group('function', '功能按键')
.register({
@@ -139,27 +128,6 @@ gameKey
name: '轻按_2',
defaults: KeyCode.Digit7
})
.register({
id: 'mark',
name: '标记怪物',
defaults: KeyCode.KeyM
})
.register({
id: 'special',
name: '鼠标位置怪物属性',
defaults: KeyCode.KeyE
})
.register({
id: 'critical',
name: '鼠标位置怪物临界',
defaults: KeyCode.KeyC
})
.register({
id: 'danmaku',
name: '发送弹幕',
defaults: KeyCode.KeyA,
ctrl: true
})
.register({
id: 'quickEquip_1',
name: '切换/保存套装_1',
@@ -524,12 +492,6 @@ gameKey
.realize('shop', () => {
core.openQuickShop(true);
})
.realize('skillTree', () => {
core.useItem('skill1', true);
})
.realize('desc', () => {
core.useItem('I560', true);
})
.realize('undo', () => {
core.doSL('autoSave', 'load');
})
@@ -542,31 +504,6 @@ gameKey
.realize('getNext', () => {
core.getNextItem();
})
.realize('mark', () => {
const cls = hovered?.event.cls;
if (cls === 'enemys' || cls === 'enemy48') {
// const id = hovered!.event.id as EnemyIds;
// if (hasMarkedEnemy(id)) unmarkEnemy(id);
// else markEnemy(id);
}
})
.realize('special', () => {
if (hovered) {
const { x, y } = hovered;
const enemy = core.status.thisMap.enemy.get(x, y);
if (enemy) mainUi.open('fixedDetail', { panel: 'special' });
}
})
.realize('critical', () => {
if (hovered) {
const { x, y } = hovered;
const enemy = core.status.thisMap.enemy.get(x, y);
if (enemy) mainUi.open('fixedDetail', { panel: 'critical' });
}
})
.realize('danmaku', () => {
openDanmakuPoster();
})
.realize('restart', () => {
core.confirmRestart();
})
@@ -17,7 +17,8 @@ export function patchAudio() {
};
patch.add('playBgm', function (bgm, startTime) {
play(bgm, startTime);
const name = core.getMappedName(bgm) as BgmIds;
play(name, startTime);
});
patch.add('pauseBgm', function () {
pause();
@@ -13,12 +13,13 @@ import { createWeather } from './weather';
export function createGameRenderer() {
const App = defineComponent(_props => {
return () => (
<container width={MAIN_WIDTH} height={MAIN_HEIGHT}>
<container noanti width={MAIN_WIDTH} height={MAIN_HEIGHT}>
{sceneController.render()}
</container>
);
});
mainRenderer.setAntiAliasing(false);
mainRenderer.hide();
createApp(App).mount(mainRenderer);
@@ -1,140 +0,0 @@
import { logger } from '@motajs/common';
import { MotaOffscreenCanvas2D } from '@motajs/render';
import { mainSetting } from '@motajs/legacy-ui';
import { Sprite, Transform } from '@motajs/render';
import { gameListener, hook } from '@user/data-base';
import {
ILayerGroupRenderExtends,
LayerGroup,
LayerGroupFloorBinder
} from '../elements';
export class LayerGroupHalo implements ILayerGroupRenderExtends {
id: string = 'halo';
group!: LayerGroup;
binder!: LayerGroupFloorBinder;
halo!: Halo;
static sprites: Set<Halo> = new Set();
awake(group: LayerGroup): void {
this.group = group;
const ex = group.getExtends('floor-binder');
if (ex instanceof LayerGroupFloorBinder) {
this.binder = ex;
this.halo = new Halo();
this.halo.setHD(true);
this.halo.size(group.width, group.height);
this.halo.setZIndex(75);
this.halo.binder = ex;
group.appendChild(this.halo);
LayerGroupHalo.sprites.add(this.halo);
} else {
logger.error(1401);
group.removeExtends('halo');
}
}
onDestroy(_group: LayerGroup): void {
this.halo?.destroy();
LayerGroupHalo.sprites.delete(this.halo);
}
}
const haloColor: Record<number, string[]> = {
21: ['cyan'],
25: ['purple'],
26: ['blue'],
27: ['red'],
31: ['#3CFF49'],
29: ['#51E9FF'],
32: ['#fff966']
};
class Halo extends Sprite {
/** 单元格大小 */
cellSize: number = 32;
/** 当前楼层,用于获取有哪些光环 */
binder!: LayerGroupFloorBinder;
constructor() {
super('static', true);
this.setRenderFn((canvas, transform) => {
this.drawHalo(canvas, transform);
});
}
drawHalo(canvas: MotaOffscreenCanvas2D, _transform: Transform) {
if (!mainSetting.getValue('screen.halo', true)) return;
const floorId = this.binder.getFloor();
if (!floorId) return;
const col = core.status.maps[floorId].enemy;
if (!col) return;
const [dx, dy] = col.translation;
const list = col.haloList.concat(
Object.keys(flags[`melt_${floorId}`] ?? {}).map(v => {
const [x, y] = v.split(',').map(v => parseInt(v));
return {
type: 'square',
data: {
x: x + dx,
y: y + dy,
d: 3
},
special: 25
};
})
);
const { ctx } = canvas;
const cell = this.cellSize;
ctx.lineWidth = 1;
for (const halo of list) {
if (halo.type === 'square') {
const { x, y, d } = halo.data;
let [color, border] = haloColor[halo.special];
let alpha = 0.1;
let borderAlpha = 0.6;
const { mouseX, mouseY } = gameListener;
if (mouseX === halo.from?.x && mouseY === halo.from?.y) {
alpha = 0.3;
borderAlpha = 0.8;
color = '#ff0';
border = '#ff0';
}
const r = Math.floor(d / 2);
const left = x - r;
const top = y - r;
ctx.fillStyle = color;
ctx.strokeStyle = border ?? color;
ctx.globalAlpha = alpha;
ctx.fillRect(left * cell, top * cell, d * cell, d * cell);
ctx.globalAlpha = borderAlpha;
ctx.strokeRect(left * cell, top * cell, d * cell, d * cell);
}
}
}
}
function updateHalo(block: Block) {
if (block.event.cls === 'enemys' || block.event.cls === 'enemy48') {
LayerGroupHalo.sprites.forEach(v => {
const floor = v.binder.getFloor();
if (floor === core.status.floorId) {
v.update();
}
});
}
}
hook.on('enemyExtract', col => {
LayerGroupHalo.sprites.forEach(v => {
const floor = v.binder.getFloor();
if (col.floorId === floor) {
v.update();
}
});
});
gameListener.on('hoverBlock', updateHalo);
gameListener.on('leaveBlock', updateHalo);
@@ -38,7 +38,6 @@ import { ReplayingStatus } from './toolbar';
import { getHeroStatusOn } from '@user/data-state';
import { hook } from '@user/data-base';
import { FloorDamageExtends, FloorItemDetail } from '../elements';
import { LayerGroupHalo } from '../legacy/halo';
import { FloorChange } from '../legacy/fallback';
import { mainUIController } from './controller';
import {
@@ -57,7 +56,6 @@ const MainScene = defineComponent(() => {
const layerGroupExtends: ILayerGroupRenderExtends[] = [
new FloorDamageExtends(),
new FloorItemDetail(),
new LayerGroupHalo(),
new LayerGroupAnimate(),
new FloorViewport()
];
@@ -252,7 +250,12 @@ const MainScene = defineComponent(() => {
};
return () => (
<container id="main-scene" width={MAIN_WIDTH} height={MAIN_HEIGHT}>
<container
id="main-scene"
width={MAIN_WIDTH}
height={MAIN_HEIGHT}
noanti
>
<LeftStatusBar
loc={[0, 0, STATUS_BAR_WIDTH, STATUS_BAR_HEIGHT]}
status={leftStatus}
@@ -269,6 +272,7 @@ const MainScene = defineComponent(() => {
onClick={clickMap}
onDown={downMap}
onMove={moveMap}
noanti
>
<layer-group id="layer-main" ex={layerGroupExtends} ref={map}>
<layer layer="bg" zIndex={10}></layer>
@@ -127,7 +127,7 @@ export const MainSettings = defineComponent<MainSettingsProps>(props => {
choices={choices}
width={POP_BOX_WIDTH}
onChoose={choose}
maxHeight={MAIN_HEIGHT - 64}
maxHeight={MAIN_HEIGHT - 32}
interval={8}
scope={scope}
/>
@@ -31,7 +31,6 @@ import {
LayerGroup,
LayerGroupFloorBinder
} from '../elements';
import { LayerGroupHalo } from '../legacy/halo';
import { Font } from '@motajs/render-style';
import { clamp, mean } from 'lodash-es';
import { calculateStatisticsOne, StatisticsDataOneFloor } from './statistics';
@@ -65,7 +64,6 @@ export const ViewMap = defineComponent<ViewMapProps>(props => {
const layerGroupExtends: ILayerGroupRenderExtends[] = [
new FloorDamageExtends(),
new FloorItemDetail(),
new LayerGroupHalo(),
new LayerGroupAnimate()
];