use renderTroops & renderNumber for playerinfo overlay

This commit is contained in:
evanpelle
2025-01-21 14:33:20 -08:00
committed by Evan
parent 8fea4d7bfa
commit 42490e2aef
3 changed files with 4 additions and 7 deletions
-5
View File
@@ -37,11 +37,6 @@ export function placeName(game: Game, player: MutablePlayer): NameViewData {
scalingFactor = 32
}
console.log(`for player ${player.name()}, got scaling factor ${scalingFactor}}`)
// const rawScalingFactor = (boundingBox.max.x - boundingBox.min.x) / 1000
// const scalingFactor = within(Math.floor(rawScalingFactor), .1, 1)
const grid = createGrid(game, player, boundingBox, scalingFactor);
const largestRectangle = findLargestInscribedRectangle(grid);
largestRectangle.x = largestRectangle.x * scalingFactor
@@ -9,6 +9,7 @@ import { MouseMoveEvent } from '../../InputHandler';
import { GameView, PlayerView } from '../../../core/GameView';
import { TileRef } from '../../../core/game/GameMap';
import { PauseGameEvent } from '../../Transport';
import { renderNumber, renderTroops } from '../../Utils';
function euclideanDistWorld(coord: { x: number, y: number }, tileRef: TileRef, game: GameView): number {
const x = game.x(tileRef);
@@ -165,8 +166,8 @@ export class PlayerInfoOverlay extends LitElement implements Layer {
return html`
<div class="info-content">
<div class="player-name ${isAlly ? 'ally' : ''}">${player.name()}</div>
<div class="type-label">Troops: ${player.troops()}</div>
<div class="type-label">Gold: ${player.gold()}</div>
<div class="type-label">Troops: ${renderTroops(player.troops())}</div>
<div class="type-label">Gold: ${renderNumber(player.gold())}</div>
${relationHtml == null ? '' : relationHtml}
</div>
`;
+1
View File
@@ -50,6 +50,7 @@ export async function loadTerrainFromFile(fileData: string): Promise<GameMap> {
rawData[i] = packedByte;
if (packedByte & 0b10000000) numLand++;
}
return new GameMapImpl(width, height, rawData, numLand)
}