mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-08-18 00:28:14 +00:00
feat: multi-warship selection with Shift+drag box (#3677)
Resolves #3666 ## Description: Adds RTS-style box selection for warships. Hold Shift and drag (desktop) or long-press and drag (touch/mobile) to draw a selection rectangle — all player-owned warships inside get selected at once. A subsequent click/tap on water sends them all to that location. - `SelectionBoxLayer` — pixel-dashed rectangle in world-space, player territory color; shared between desktop and touch - `UILayer` — same pulsing selection outline on each box-selected warship; clears correctly when switching between single/multi selection - `UnitLayer` — finds warships in screen rect, filters inactive ships before sending; touch support included - `InputHandler` — Shift+drag and touch long-press+drag both emit selection box events; cursor becomes crosshair on Shift; discards active ghost structure on Shift press; configurable via `shiftKey` keybind - `Transport` — single atomic `move_multiple_warships` intent (no split on socket drop) - `Schemas` + `ExecutionManager` + `MoveMultipleWarshipsExecution` — server fans out atomic intent into individual `MoveWarshipExecution` per ship - `DynamicUILayer` — `MoveIndicatorUI` chevron animation on target tile for both single and multi move - `UnitDisplay` — warship tooltip Shift hint via `translateText` - `HelpModal` — new hotkey row: Shift + drag → select multiple warships ## 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 ## UI update ### Mouse + Keyboard https://github.com/user-attachments/assets/3f35ab5e-1f3c-4c5d-bc4f-aabccf64dc60 ### Touch https://github.com/user-attachments/assets/0d6aec3f-44fa-4fee-b5c6-b267b9b14d79 ## ## Please put your Discord username so you can be contacted if a bug or regression is found: fghjk_60845
This commit is contained in:
@@ -164,7 +164,11 @@ describe("Warship", () => {
|
||||
game.addExecution(new WarshipExecution(warship));
|
||||
|
||||
game.addExecution(
|
||||
new MoveWarshipExecution(player1, warship.id(), game.ref(coastX + 5, 15)),
|
||||
new MoveWarshipExecution(
|
||||
player1,
|
||||
[warship.id()],
|
||||
game.ref(coastX + 5, 15),
|
||||
),
|
||||
);
|
||||
|
||||
executeTicks(game, 10);
|
||||
@@ -244,7 +248,7 @@ describe("Warship", () => {
|
||||
);
|
||||
new MoveWarshipExecution(
|
||||
player2,
|
||||
warship.id(),
|
||||
[warship.id()],
|
||||
game.ref(coastX + 5, 15),
|
||||
).init(game, 0);
|
||||
expect(warship.patrolTile()).toBe(originalPatrolTile);
|
||||
@@ -262,7 +266,7 @@ describe("Warship", () => {
|
||||
warship.delete();
|
||||
new MoveWarshipExecution(
|
||||
player1,
|
||||
warship.id(),
|
||||
[warship.id()],
|
||||
game.ref(coastX + 5, 15),
|
||||
).init(game, 0);
|
||||
expect(warship.patrolTile()).toBe(originalPatrolTile);
|
||||
@@ -271,7 +275,7 @@ describe("Warship", () => {
|
||||
test("MoveWarshipExecution fails gracefully if warship not found", async () => {
|
||||
const exec = new MoveWarshipExecution(
|
||||
player1,
|
||||
123,
|
||||
[123],
|
||||
game.ref(coastX + 5, 15),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user