mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 13:40:46 +00:00
Enhance TerritoryLayer and theme configuration with player highlight color
- Added playerHighlightColor method to Theme interface and implemented it in PastelTheme and PastelThemeDark classes. - Updated TerritoryLayer to redraw when the theme changes, ensuring consistent visual updates. - Modified hoverHighlightOptions to use the new player highlight color for improved territory visualization.
This commit is contained in:
@@ -85,6 +85,11 @@ export class TerritoryLayer implements Layer {
|
||||
tick() {
|
||||
const tickProfile = FrameProfiler.start();
|
||||
const now = this.nowMs();
|
||||
const currentTheme = this.game.config().theme();
|
||||
if (currentTheme !== this.theme) {
|
||||
this.theme = currentTheme;
|
||||
this.redraw();
|
||||
}
|
||||
if (this.game.inSpawnPhase()) {
|
||||
this.spawnHighlight();
|
||||
}
|
||||
@@ -404,7 +409,7 @@ export class TerritoryLayer implements Layer {
|
||||
}
|
||||
|
||||
private hoverHighlightOptions() {
|
||||
const baseColor = this.theme.spawnHighlightSelfColor();
|
||||
const baseColor = this.theme.playerHighlightColor();
|
||||
const rgba = baseColor.rgba;
|
||||
|
||||
if (this.alternativeView) {
|
||||
|
||||
@@ -205,6 +205,7 @@ export interface Theme {
|
||||
allyColor(): Colord;
|
||||
neutralColor(): Colord;
|
||||
enemyColor(): Colord;
|
||||
playerHighlightColor(): Colord;
|
||||
spawnHighlightColor(): Colord;
|
||||
spawnHighlightSelfColor(): Colord;
|
||||
spawnHighlightTeamColor(): Colord;
|
||||
|
||||
@@ -35,6 +35,8 @@ export class PastelTheme implements Theme {
|
||||
/** Alternate View colors for enemies, red */
|
||||
private _enemyColor = colord("rgb(255,0,0)");
|
||||
|
||||
/** Hover highlight color for player territories */
|
||||
private _playerHighlightColor = colord("rgb(221, 221, 221)");
|
||||
/** Default spawn highlight colors for other players in FFA, yellow */
|
||||
private _spawnHighlightColor = colord("rgb(255,213,79)");
|
||||
/** Added non-default spawn highlight colors for self, full white */
|
||||
@@ -209,6 +211,9 @@ export class PastelTheme implements Theme {
|
||||
enemyColor(): Colord {
|
||||
return this._enemyColor;
|
||||
}
|
||||
playerHighlightColor(): Colord {
|
||||
return this._playerHighlightColor;
|
||||
}
|
||||
|
||||
spawnHighlightColor(): Colord {
|
||||
return this._spawnHighlightColor;
|
||||
|
||||
@@ -8,6 +8,7 @@ export class PastelThemeDark extends PastelTheme {
|
||||
|
||||
private darkWater = colord("rgb(14,11,30)");
|
||||
private darkShorelineWater = colord("rgb(50,50,50)");
|
||||
private darkPlayerHighlight = colord("rgb(99, 42, 42)");
|
||||
|
||||
// | Terrain Type | Magnitude | Base Color Logic | Visual Description |
|
||||
// | :---------------- | :-------- | :---------------------------------------------- | :-------------------- |
|
||||
@@ -59,4 +60,8 @@ export class PastelThemeDark extends PastelTheme {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
playerHighlightColor(): Colord {
|
||||
return this.darkPlayerHighlight;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user