mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 17:00:16 +00:00
use renderTroops & renderNumber for playerinfo overlay
This commit is contained in:
@@ -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>
|
||||
`;
|
||||
|
||||
@@ -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)
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user