mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 09:50:43 +00:00
improved player troops count rendering
This commit is contained in:
@@ -123,17 +123,19 @@ export class NameRenderer {
|
||||
|
||||
context.fillText(render.player.info().name, nameCenterX, nameCenterY - render.fontSize / 2);
|
||||
context.font = `bold ${render.fontSize}px ${this.theme.font()}`;
|
||||
let troops: string = ""
|
||||
if (render.player.troops() > 100000) {
|
||||
troops = String(Math.floor(render.player.troops() / 1000)) + "K"
|
||||
} else if (render.player.troops() > 10000) {
|
||||
troops = String((render.player.troops() / 1000).toFixed(1)) + "K"
|
||||
} else if (render.player.troops() > 1000) {
|
||||
troops = String((render.player.troops() / 1000).toFixed(2)) + "K"
|
||||
let troopsStr: string = ""
|
||||
let troops = render.player.troops() / 10
|
||||
|
||||
if (troops > 100000) {
|
||||
troopsStr = String(Math.floor(troops / 1000)) + "K"
|
||||
} else if (troops > 10000) {
|
||||
troopsStr = String((troops / 1000).toFixed(1)) + "K"
|
||||
} else if (troops > 1000) {
|
||||
troopsStr = String((troops / 1000).toFixed(2)) + "K"
|
||||
}
|
||||
else {
|
||||
troops = String(Math.floor(render.player.troops()))
|
||||
troopsStr = String(Math.floor(troops))
|
||||
}
|
||||
context.fillText(troops, nameCenterX, nameCenterY + render.fontSize);
|
||||
context.fillText(troopsStr, nameCenterX, nameCenterY + render.fontSize);
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ export const devConfig = new class extends DefaultConfig {
|
||||
return 2 * 1000
|
||||
}
|
||||
lobbyLifetime(): number {
|
||||
return 10 * 1000
|
||||
return 5 * 1000
|
||||
}
|
||||
turnIntervalMs(): number {
|
||||
return 100
|
||||
@@ -16,14 +16,14 @@ export const devConfig = new class extends DefaultConfig {
|
||||
return devPlayerConfig
|
||||
}
|
||||
numBots(): number {
|
||||
return 0
|
||||
return 500
|
||||
}
|
||||
}
|
||||
|
||||
export const devPlayerConfig = new class extends DefaultPlayerConfig {
|
||||
startTroops(playerInfo: PlayerInfo): number {
|
||||
if (playerInfo.isBot) {
|
||||
return 5000
|
||||
return 1000
|
||||
}
|
||||
return 5000
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user