feat & fix: 小地图显示剩余怪物 & id优化

This commit is contained in:
AncTe committed 2024-04-21 15:45:06 +08:00
1 parent 020551bd90
commit 59c3b46cfc
15 files changed
+93 -13

No files matched your search

+16
View File
@@ -214,6 +214,7 @@ export class MinimapDrawer {
ox: number = 0;
oy: number = 0;
noBorder: boolean = false;
showInfo: boolean = false;
// cache
drawedThumbnail: Partial<Record<FloorIds, boolean>> = {};
@@ -437,6 +438,21 @@ export class MinimapDrawer {
ctx.fillStyle = '#000';
}
}
if (this.scale > 2) {
ctx.save();
ctx.textAlign = 'center';
ctx.textBaseline = 'middle';
ctx.font = `3px "normal"`;
ctx.strokeStyle = 'black';
Mota.require('fn', 'ensureFloorDamage')(floorId);
const enemyNum = core.status.maps[floorId].enemy.list.length;
ctx.fillStyle = 'rgba(0, 0, 0, 0.6)';
ctx.fillRect(x - 6, y - 2, 12, 4);
ctx.fillStyle = 'white';
ctx.strokeText(`${enemyNum}怪物`, x, y);
ctx.fillText(`${enemyNum}怪物`, x, y);
ctx.restore();
}
}
/**
+5
View File
@@ -396,3 +396,8 @@ export function formatSize(size: number) {
? `${(size / (1 << 20)).toFixed(2)}MB`
: `${(size / (1 << 30)).toFixed(2)}GB`;
}
let num = 0;
export function requireUniqueSymbol() {
return num++;
}