chore: adjust player tank's size
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user