mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-22 18:06:39 +00:00
Added Icon te reflect current player state
This commit is contained in:
@@ -2,6 +2,7 @@ import allianceIcon from "../../../../resources/images/AllianceIcon.svg";
|
||||
import allianceRequestIcon from "../../../../resources/images/AllianceRequestIcon.svg";
|
||||
import crownIcon from "../../../../resources/images/CrownIcon.svg";
|
||||
import embargoIcon from "../../../../resources/images/EmbargoIcon.svg";
|
||||
import idleIcon from "../../../../resources/images/IdleIcon.svg";
|
||||
import nukeRedIcon from "../../../../resources/images/NukeIconRed.svg";
|
||||
import nukeWhiteIcon from "../../../../resources/images/NukeIconWhite.svg";
|
||||
import shieldIcon from "../../../../resources/images/ShieldIconBlack.svg";
|
||||
@@ -38,6 +39,7 @@ export class NameLayer implements Layer {
|
||||
private renders: RenderInfo[] = [];
|
||||
private seenPlayers: Set<PlayerView> = new Set();
|
||||
private traitorIconImage: HTMLImageElement;
|
||||
private idleIconImage: HTMLImageElement;
|
||||
private allianceRequestIconImage: HTMLImageElement;
|
||||
private allianceIconImage: HTMLImageElement;
|
||||
private targetIconImage: HTMLImageElement;
|
||||
@@ -58,6 +60,8 @@ export class NameLayer implements Layer {
|
||||
) {
|
||||
this.traitorIconImage = new Image();
|
||||
this.traitorIconImage.src = traitorIcon;
|
||||
this.idleIconImage = new Image();
|
||||
this.idleIconImage.src = idleIcon;
|
||||
this.allianceIconImage = new Image();
|
||||
this.allianceIconImage.src = allianceIcon;
|
||||
this.allianceRequestIconImage = new Image();
|
||||
@@ -349,6 +353,18 @@ export class NameLayer implements Layer {
|
||||
existingTraitor.remove();
|
||||
}
|
||||
|
||||
// Idle icon
|
||||
const existingIdle = iconsDiv.querySelector('[data-icon="idle"]');
|
||||
if (render.player.isIdle()) {
|
||||
if (!existingIdle) {
|
||||
iconsDiv.appendChild(
|
||||
this.createIconElement(this.idleIconImage.src, iconSize, "idle"),
|
||||
);
|
||||
}
|
||||
} else if (existingIdle) {
|
||||
existingIdle.remove();
|
||||
}
|
||||
|
||||
// Alliance icon
|
||||
const existingAlliance = iconsDiv.querySelector('[data-icon="alliance"]');
|
||||
if (myPlayer !== null && myPlayer.isAlliedWith(render.player)) {
|
||||
|
||||
Reference in New Issue
Block a user