mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 11:50:42 +00:00
make names bigger, see farther out
This commit is contained in:
@@ -130,6 +130,6 @@ export function largestRectangleInHistogram(widths: number[]): Rectangle {
|
||||
export function calculateFontSize(rectangle: Rectangle, name: string): number {
|
||||
// This is a simplified calculation. You might want to adjust it based on your specific font and rendering system.
|
||||
const widthConstrained = rectangle.width / name.length;
|
||||
const heightConstrained = rectangle.height / name.length;
|
||||
const heightConstrained = rectangle.height / 3;
|
||||
return Math.min(widthConstrained, heightConstrained);
|
||||
}
|
||||
@@ -86,11 +86,11 @@ export class NameRenderer {
|
||||
isVisible(render: RenderInfo, min: Cell, max: Cell): boolean {
|
||||
const ratio = (max.x - min.x) / Math.max(20, (render.boundingBox.max.x - render.boundingBox.min.x))
|
||||
if (render.player.isBot()) {
|
||||
if (ratio > 25) {
|
||||
if (ratio > 35) {
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
if (ratio > 30) {
|
||||
if (ratio > 35) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
@@ -124,7 +124,7 @@ export class NameRenderer {
|
||||
|
||||
context.fillText(render.player.name(), nameCenterX, nameCenterY - render.fontSize / 2);
|
||||
context.font = `bold ${render.fontSize}px ${this.theme.font()}`;
|
||||
|
||||
|
||||
context.fillText(renderTroops(render.player.troops()), nameCenterX, nameCenterY + render.fontSize);
|
||||
}
|
||||
}
|
||||
@@ -26,12 +26,12 @@ export const devConfig = new class extends DefaultConfig {
|
||||
return 5000
|
||||
}
|
||||
|
||||
troopAdditionRate(player: Player): number {
|
||||
let max = Math.sqrt(player.numTilesOwned()) * 2000 + 10000 + 10000
|
||||
max = Math.min(max, 1_000_000)
|
||||
// troopAdditionRate(player: Player): number {
|
||||
// let max = Math.sqrt(player.numTilesOwned()) * 2000 + 10000 + 10000
|
||||
// max = Math.min(max, 1_000_000)
|
||||
|
||||
let toAdd = 10 + (player.troops() + Math.sqrt(player.troops() * player.numTilesOwned())) / 200 * 100
|
||||
// let toAdd = 10 + (player.troops() + Math.sqrt(player.troops() * player.numTilesOwned())) / 200 * 100
|
||||
|
||||
return Math.min(player.troops() + toAdd, max)
|
||||
}
|
||||
// return Math.min(player.troops() + toAdd, max)
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user