fix: remove duplicate conquest gold popup on canvas2D

DynamicUILayer subscribed to ConquestEvent and drew a floating "+gold"
text on capture, but the WebGL renderer now draws the same popup via
ConquestPopupPass (fed through applyConquestEvents in uploadFrameData).
The result was two popups stacked on every capture.

Drop the canvas2D handler. Bonus events and unit-death FX use the same
duplication pattern but are left intact for now — separate change when
the WebGL versions are verified visually.
This commit is contained in:
evanpelle
2026-05-16 16:48:06 -07:00
parent 3af1751119
commit 7b8c950bef
+1 -23
View File
@@ -1,11 +1,7 @@
import { renderNumber } from "src/client/Utils";
import { EventBus } from "src/core/EventBus";
import { UnitType } from "src/core/game/Game";
import {
BonusEventUpdate,
ConquestUpdate,
GameUpdateType,
} from "src/core/game/GameUpdates";
import { BonusEventUpdate, GameUpdateType } from "src/core/game/GameUpdates";
import type { GameView, UnitView } from "../../../core/game/GameView";
import { MoveWarshipIntentEvent } from "../../Transport";
import { TransformHandler } from "../TransformHandler";
@@ -18,7 +14,6 @@ import { Layer } from "./Layer";
const TEXT_OFFSET_Y = -5;
const TEXT_STACK_SPACING = 8;
const TEXT_DURATION = 2500;
export class DynamicUILayer implements Layer {
private readonly uiElements: Array<UIElement> = [];
@@ -61,11 +56,6 @@ export class DynamicUILayer implements Layer {
if (bonusEvent === undefined) return;
this.onBonusEvent(bonusEvent);
});
updates[GameUpdateType.ConquestEvent]?.forEach((update) => {
if (update === undefined) return;
this.onConquestEvent(update);
});
}
onBonusEvent(bonus: BonusEventUpdate) {
@@ -89,18 +79,6 @@ export class DynamicUILayer implements Layer {
}
}
onConquestEvent(conquest: ConquestUpdate) {
// Only display text for the current player
const conqueror = this.game.player(conquest.conquerorId);
if (conqueror !== this.game.myPlayer()) {
return;
}
const nameLocation = this.game.player(conquest.conqueredId).nameLocation();
const x = nameLocation.x;
const y = nameLocation.y;
this.addNumber(conquest.gold, x, y + 8, TEXT_DURATION, 0);
}
onUnitEvent(unit: UnitView) {
switch (unit.type()) {
case UnitType.HydrogenBomb: