chore: adjust player tank's size

This commit is contained in:
jakciehan
2026-05-02 13:50:52 +08:00
parent 0e321bcea6
commit 38294c040c
35 changed files with 5767 additions and 348 deletions
+29 -3
View File
@@ -358,7 +358,7 @@ const TeamResultScene = {
ctx.fillStyle = isLocal ? '#FFD700' : '#CCCCCC';
ctx.font = isLocal ? 'bold 10px Arial' : '10px Arial';
ctx.textAlign = 'center';
const name = player.isBot ? t('teamResult.bot') : (player.playerId.length > 10 ? player.playerId.substring(0, 10) + '..' : player.playerId);
const name = player.isBot ? t('teamResult.bot') : this._getDisplayName(player);
ctx.fillText(name + (isLocal ? ' ★' : ''), cols.name, y + rowH / 2);
// Stats
@@ -406,7 +406,7 @@ const TeamResultScene = {
ctx.fillStyle = isLocal ? '#FFD700' : '#CCCCCC';
ctx.font = isLocal ? 'bold 10px Arial' : '10px Arial';
ctx.textAlign = 'center';
const name = player.isBot ? t('teamResult.bot') : (player.playerId.length > 10 ? player.playerId.substring(0, 10) + '..' : player.playerId);
const name = player.isBot ? t('teamResult.bot') : this._getDisplayName(player);
ctx.fillText(name + (isLocal ? ' ★' : ''), cols.name, y + rowH / 2);
// Stats
@@ -451,7 +451,7 @@ const TeamResultScene = {
ctx.fillStyle = '#FFD700';
ctx.font = 'bold 11px Arial';
ctx.textAlign = 'center';
const mvpName = mvp.isBot ? t('teamResult.bot').replace('🤖 ', '') : mvp.playerId;
const mvpName = mvp.isBot ? t('teamResult.bot').replace('🤖 ', '') : this._getDisplayName(mvp);
ctx.fillText(t('teamResult.mvp', { name: mvpName, kills: maxKills }), CENTER_X, y);
}
@@ -583,6 +583,32 @@ const TeamResultScene = {
return;
}
},
/**
* Compute a display name for the results table (≤ 4 CJK chars).
* @private
*/
_getDisplayName(player) {
if (!player) return '';
const profile = GameGlobal.playerProfile;
let raw = '';
if (player.isLocal && profile && profile.nickname) {
raw = profile.nickname;
} else {
raw = player.nickname || '';
}
if (!raw) {
if (profile && typeof profile.getDisplayName === 'function') {
raw = profile.getDisplayName(player.playerId);
} else {
raw = player.playerId || '';
}
}
if (profile && typeof profile.truncate === 'function') {
return profile.truncate(raw, 4);
}
return raw.length > 10 ? raw.substring(0, 10) + '..' : raw;
},
};
module.exports = TeamResultScene;