mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 13:00:42 +00:00
remove radial directory
This commit is contained in:
@@ -7,12 +7,12 @@ import { EventBus } from "../../core/EventBus";
|
||||
import { TransformHandler } from "./TransformHandler";
|
||||
import { Layer } from "./layers/Layer";
|
||||
import { EventsDisplay } from "./layers/EventsDisplay";
|
||||
import { RadialMenu } from "./layers/radial/RadialMenu";
|
||||
import { EmojiTable } from "./layers/radial/EmojiTable";
|
||||
import { RadialMenu } from "./layers/RadialMenu";
|
||||
import { EmojiTable } from "./layers/EmojiTable";
|
||||
import { Leaderboard } from "./layers/Leaderboard";
|
||||
import { ControlPanel } from "./layers/ControlPanel";
|
||||
import { UIState } from "./UIState";
|
||||
import { BuildMenu } from "./layers/radial/BuildMenu";
|
||||
import { BuildMenu } from "./layers/BuildMenu";
|
||||
import { UnitLayer } from "./layers/UnitLayer";
|
||||
import { StructureLayer } from "./layers/StructureLayer";
|
||||
import { PlayerInfoOverlay } from "./layers/PlayerInfoOverlay";
|
||||
@@ -28,7 +28,7 @@ export function createRenderer(
|
||||
canvas: HTMLCanvasElement,
|
||||
game: GameView,
|
||||
eventBus: EventBus,
|
||||
clientID: ClientID,
|
||||
clientID: ClientID
|
||||
): GameRenderer {
|
||||
const transformHandler = new TransformHandler(game, eventBus, canvas);
|
||||
|
||||
@@ -64,7 +64,7 @@ export function createRenderer(
|
||||
controlPanel.game = game;
|
||||
|
||||
const eventsDisplay = document.querySelector(
|
||||
"events-display",
|
||||
"events-display"
|
||||
) as EventsDisplay;
|
||||
if (!(eventsDisplay instanceof EventsDisplay)) {
|
||||
consolex.error("events display not found");
|
||||
@@ -74,7 +74,7 @@ export function createRenderer(
|
||||
eventsDisplay.clientID = clientID;
|
||||
|
||||
const playerInfo = document.querySelector(
|
||||
"player-info-overlay",
|
||||
"player-info-overlay"
|
||||
) as PlayerInfoOverlay;
|
||||
if (!(playerInfo instanceof PlayerInfoOverlay)) {
|
||||
consolex.error("player info overlay not found");
|
||||
@@ -119,7 +119,7 @@ export function createRenderer(
|
||||
emojiTable as EmojiTable,
|
||||
buildMenu,
|
||||
uiState,
|
||||
playerInfo,
|
||||
playerInfo
|
||||
),
|
||||
new SpawnTimer(game, transformHandler),
|
||||
leaderboard,
|
||||
@@ -136,7 +136,7 @@ export function createRenderer(
|
||||
canvas,
|
||||
transformHandler,
|
||||
uiState,
|
||||
layers,
|
||||
layers
|
||||
);
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ export class GameRenderer {
|
||||
private canvas: HTMLCanvasElement,
|
||||
public transformHandler: TransformHandler,
|
||||
public uiState: UIState,
|
||||
private layers: Layer[],
|
||||
private layers: Layer[]
|
||||
) {
|
||||
this.context = canvas.getContext("2d");
|
||||
}
|
||||
@@ -172,7 +172,7 @@ export class GameRenderer {
|
||||
this.transformHandler = new TransformHandler(
|
||||
this.game,
|
||||
this.eventBus,
|
||||
this.canvas,
|
||||
this.canvas
|
||||
);
|
||||
|
||||
requestAnimationFrame(() => this.renderGame());
|
||||
@@ -218,7 +218,7 @@ export class GameRenderer {
|
||||
const duration = performance.now() - start;
|
||||
if (duration > 50) {
|
||||
console.warn(
|
||||
`tick ${this.game.ticks()} took ${duration}ms to render frame`,
|
||||
`tick ${this.game.ticks()} took ${duration}ms to render frame`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+12
-13
@@ -1,24 +1,23 @@
|
||||
import { LitElement, html, css } from "lit";
|
||||
import { customElement, state } from "lit/decorators.js";
|
||||
import { EventBus } from "../../../../core/EventBus";
|
||||
import { EventBus } from "../../../core/EventBus";
|
||||
import {
|
||||
Cell,
|
||||
Game,
|
||||
Player,
|
||||
PlayerActions,
|
||||
UnitType,
|
||||
} from "../../../../core/game/Game";
|
||||
import { BuildUnitIntentEvent } from "../../../Transport";
|
||||
import atomBombIcon from "../../../../../resources/images/NukeIconWhite.svg";
|
||||
import hydrogenBombIcon from "../../../../../resources/images/MushroomCloudIconWhite.svg";
|
||||
import warshipIcon from "../../../../../resources/images/BattleshipIconWhite.svg";
|
||||
import missileSiloIcon from "../../../../../resources/images/MissileSiloIconWhite.svg";
|
||||
import goldCoinIcon from "../../../../../resources/images/GoldCoinIcon.svg";
|
||||
import portIcon from "../../../../../resources/images/PortIcon.svg";
|
||||
import shieldIcon from "../../../../../resources/images/ShieldIconWhite.svg";
|
||||
import cityIcon from "../../../../../resources/images/CityIconWhite.svg";
|
||||
import { renderNumber } from "../../../Utils";
|
||||
import { GameView, PlayerView } from "../../../../core/game/GameView";
|
||||
} from "../../../core/game/Game";
|
||||
import { BuildUnitIntentEvent } from "../../Transport";
|
||||
import atomBombIcon from "../../../../resources/images/NukeIconWhite.svg";
|
||||
import hydrogenBombIcon from "../../../../resources/images/MushroomCloudIconWhite.svg";
|
||||
import warshipIcon from "../../../../resources/images/BattleshipIconWhite.svg";
|
||||
import missileSiloIcon from "../../../../resources/images/MissileSiloIconWhite.svg";
|
||||
import goldCoinIcon from "../../../../resources/images/GoldCoinIcon.svg";
|
||||
import portIcon from "../../../../resources/images/PortIcon.svg";
|
||||
import cityIcon from "../../../../resources/images/CityIconWhite.svg";
|
||||
import { renderNumber } from "../../Utils";
|
||||
import { GameView, PlayerView } from "../../../core/game/GameView";
|
||||
|
||||
interface BuildItemDisplay {
|
||||
unitType: UnitType;
|
||||
+32
-32
@@ -1,17 +1,17 @@
|
||||
import { EventBus } from "../../../../core/EventBus";
|
||||
import { EventBus } from "../../../core/EventBus";
|
||||
import {
|
||||
AllPlayers,
|
||||
Cell,
|
||||
Game,
|
||||
Player,
|
||||
PlayerActions,
|
||||
} from "../../../../core/game/Game";
|
||||
import { ClientID } from "../../../../core/Schemas";
|
||||
} from "../../../core/game/Game";
|
||||
import { ClientID } from "../../../core/Schemas";
|
||||
import {
|
||||
ContextMenuEvent,
|
||||
MouseUpEvent,
|
||||
ShowBuildMenuEvent,
|
||||
} from "../../../InputHandler";
|
||||
} from "../../InputHandler";
|
||||
import {
|
||||
SendAllianceRequestIntentEvent,
|
||||
SendAttackIntentEvent,
|
||||
@@ -21,26 +21,26 @@ import {
|
||||
SendEmojiIntentEvent,
|
||||
SendSpawnIntentEvent,
|
||||
SendTargetPlayerIntentEvent,
|
||||
} from "../../../Transport";
|
||||
import { TransformHandler } from "../../TransformHandler";
|
||||
import { Layer } from "../Layer";
|
||||
} from "../../Transport";
|
||||
import { TransformHandler } from "../TransformHandler";
|
||||
import { Layer } from "./Layer";
|
||||
import * as d3 from "d3";
|
||||
import traitorIcon from "../../../../../resources/images/TraitorIconWhite.png";
|
||||
import allianceIcon from "../../../../../resources/images/AllianceIconWhite.png";
|
||||
import boatIcon from "../../../../../resources/images/BoatIconWhite.png";
|
||||
import swordIcon from "../../../../../resources/images/SwordIconWhite.png";
|
||||
import targetIcon from "../../../../../resources/images/TargetIconWhite.png";
|
||||
import emojiIcon from "../../../../../resources/images/EmojiIconWhite.png";
|
||||
import disabledIcon from "../../../../../resources/images/DisabledIcon.png";
|
||||
import donateIcon from "../../../../../resources/images/DonateIconWhite.png";
|
||||
import buildIcon from "../../../../../resources/images/BuildIconWhite.svg";
|
||||
import traitorIcon from "../../../../resources/images/TraitorIconWhite.png";
|
||||
import allianceIcon from "../../../../resources/images/AllianceIconWhite.png";
|
||||
import boatIcon from "../../../../resources/images/BoatIconWhite.png";
|
||||
import swordIcon from "../../../../resources/images/SwordIconWhite.png";
|
||||
import targetIcon from "../../../../resources/images/TargetIconWhite.png";
|
||||
import emojiIcon from "../../../../resources/images/EmojiIconWhite.png";
|
||||
import disabledIcon from "../../../../resources/images/DisabledIcon.png";
|
||||
import donateIcon from "../../../../resources/images/DonateIconWhite.png";
|
||||
import buildIcon from "../../../../resources/images/BuildIconWhite.svg";
|
||||
import { EmojiTable } from "./EmojiTable";
|
||||
import { UIState } from "../../UIState";
|
||||
import { UIState } from "../UIState";
|
||||
import { BuildMenu } from "./BuildMenu";
|
||||
import { consolex } from "../../../../core/Consolex";
|
||||
import { GameView, PlayerView } from "../../../../core/game/GameView";
|
||||
import { TileRef } from "../../../../core/game/GameMap";
|
||||
import { PlayerInfoOverlay } from "../PlayerInfoOverlay";
|
||||
import { consolex } from "../../../core/Consolex";
|
||||
import { GameView, PlayerView } from "../../../core/game/GameView";
|
||||
import { TileRef } from "../../../core/game/GameMap";
|
||||
import { PlayerInfoOverlay } from "./PlayerInfoOverlay";
|
||||
|
||||
enum Slot {
|
||||
Alliance,
|
||||
@@ -97,7 +97,7 @@ export class RadialMenu implements Layer {
|
||||
private emojiTable: EmojiTable,
|
||||
private buildMenu: BuildMenu,
|
||||
private uiState: UIState,
|
||||
private playerInfoOverlay: PlayerInfoOverlay,
|
||||
private playerInfoOverlay: PlayerInfoOverlay
|
||||
) {}
|
||||
|
||||
init() {
|
||||
@@ -106,7 +106,7 @@ export class RadialMenu implements Layer {
|
||||
this.eventBus.on(ShowBuildMenuEvent, (e) => {
|
||||
const clickedCell = this.transformHandler.screenToWorldCoordinates(
|
||||
e.x,
|
||||
e.y,
|
||||
e.y
|
||||
);
|
||||
if (clickedCell == null) {
|
||||
return;
|
||||
@@ -139,7 +139,7 @@ export class RadialMenu implements Layer {
|
||||
.append("g")
|
||||
.attr(
|
||||
"transform",
|
||||
`translate(${this.menuSize / 2},${this.menuSize / 2})`,
|
||||
`translate(${this.menuSize / 2},${this.menuSize / 2})`
|
||||
);
|
||||
|
||||
const pie = d3
|
||||
@@ -162,7 +162,7 @@ export class RadialMenu implements Layer {
|
||||
.append("path")
|
||||
.attr("d", arc)
|
||||
.attr("fill", (d) =>
|
||||
d.data.disabled ? this.disabledColor : d.data.color,
|
||||
d.data.disabled ? this.disabledColor : d.data.color
|
||||
)
|
||||
.attr("stroke", "#ffffff")
|
||||
.attr("stroke-width", "2")
|
||||
@@ -287,7 +287,7 @@ export class RadialMenu implements Layer {
|
||||
|
||||
this.clickedCell = this.transformHandler.screenToWorldCoordinates(
|
||||
event.x,
|
||||
event.y,
|
||||
event.y
|
||||
);
|
||||
if (!this.g.isValidCoord(this.clickedCell.x, this.clickedCell.y)) {
|
||||
return;
|
||||
@@ -316,7 +316,7 @@ export class RadialMenu implements Layer {
|
||||
private handlePlayerActions(
|
||||
myPlayer: PlayerView,
|
||||
actions: PlayerActions,
|
||||
tile: TileRef,
|
||||
tile: TileRef
|
||||
) {
|
||||
this.activateMenuElement(Slot.Build, "#ebe250", buildIcon, () => {
|
||||
this.buildMenu.showMenu(myPlayer, this.clickedCell);
|
||||
@@ -348,8 +348,8 @@ export class RadialMenu implements Layer {
|
||||
new SendBoatAttackIntentEvent(
|
||||
this.g.owner(tile).id(),
|
||||
this.clickedCell,
|
||||
this.uiState.attackRatio * myPlayer.troops(),
|
||||
),
|
||||
this.uiState.attackRatio * myPlayer.troops()
|
||||
)
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -426,8 +426,8 @@ export class RadialMenu implements Layer {
|
||||
this.eventBus.emit(
|
||||
new SendAttackIntentEvent(
|
||||
this.g.owner(clicked).id(),
|
||||
this.uiState.attackRatio * myPlayer.troops(),
|
||||
),
|
||||
this.uiState.attackRatio * myPlayer.troops()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -438,7 +438,7 @@ export class RadialMenu implements Layer {
|
||||
slot: Slot,
|
||||
color: string,
|
||||
icon: string,
|
||||
action: () => void,
|
||||
action: () => void
|
||||
) {
|
||||
const menuItem = this.menuItems.get(slot);
|
||||
menuItem.action = action;
|
||||
Reference in New Issue
Block a user