mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-03 11:30:45 +00:00
Move indicator fx for warships. (#2871)
Been playing this game for months, and after i feel myself enough experienced about the game, decided to start contributing to the project. This is my first one! ## Description: Move indicator fx for warships. Listening MoveWarshipIntentEvent to draw the fx. Code is basic, respectly layered and written regarding project's structure.  ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: 420coder --------- Co-authored-by: Ryan <7389646+ryanbarlow97@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { renderNumber } from "src/client/Utils";
|
||||
import { EventBus } from "src/core/EventBus";
|
||||
import { UnitType } from "src/core/game/Game";
|
||||
import {
|
||||
BonusEventUpdate,
|
||||
@@ -6,7 +7,9 @@ import {
|
||||
GameUpdateType,
|
||||
} from "src/core/game/GameUpdates";
|
||||
import type { GameView, UnitView } from "../../../core/game/GameView";
|
||||
import { MoveWarshipIntentEvent } from "../../Transport";
|
||||
import { TransformHandler } from "../TransformHandler";
|
||||
import { MoveIndicatorUI } from "../ui/MoveIndicatorUI";
|
||||
import { NavalTarget } from "../ui/NavalTarget";
|
||||
import { NukeTelegraph } from "../ui/NukeTelegraph";
|
||||
import { TextIndicator } from "../ui/TextIndicator";
|
||||
@@ -24,8 +27,18 @@ export class DynamicUILayer implements Layer {
|
||||
constructor(
|
||||
private readonly game: GameView,
|
||||
private transformHandler: TransformHandler,
|
||||
private eventBus: EventBus,
|
||||
) {}
|
||||
|
||||
init() {
|
||||
// Listen for warship move clicks for MoveIndicatorUI
|
||||
this.eventBus.on(MoveWarshipIntentEvent, (e) => {
|
||||
const x = this.game.x(e.tile);
|
||||
const y = this.game.y(e.tile);
|
||||
this.uiElements.push(new MoveIndicatorUI(this.transformHandler, x, y));
|
||||
});
|
||||
}
|
||||
|
||||
shouldTransform(): boolean {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user