From b08074a2f3358089d58824dd7e143faa5b14ea28 Mon Sep 17 00:00:00 2001 From: Adrien Jaguenet Date: Thu, 17 Sep 2026 00:56:59 +0200 Subject: [PATCH] Visual improvements --- client/css/style.css | 90 ++++++++++++++++++++++++++++++++- client/index.html | 24 +++++++-- client/js/app.js | 66 ++++++++++++++++++++++-- client/js/game_screen.js | 39 +++++++++++++- client/js/map_view.js | 56 ++++++++++++++++++-- client/js/modals.js | 10 ++-- client/js/net.js | 10 ++++ server/game_server.js | 58 +++++++++++++++++++-- server/server.js | 3 ++ shared/data.js | 28 ++++++++-- shared/game_state.js | 104 ++++++++++++++++++++++++++++++++------ tests/app_test.js | 56 +++++++++++++++++++- tests/data_test.js | 10 ++++ tests/game_screen_test.js | 40 +++++++++++++++ tests/game_server_test.js | 35 ++++++++++++- tests/map_view_test.js | 15 ++++++ tests/modals_test.js | 6 +-- tests/run_tests.js | 2 + tests/server_test.js | 7 ++- 19 files changed, 610 insertions(+), 49 deletions(-) diff --git a/client/css/style.css b/client/css/style.css index e193212..9db8283 100644 --- a/client/css/style.css +++ b/client/css/style.css @@ -28,7 +28,7 @@ html, body { /* ---------------------------------------------------------------- menus -- */ -#screen-menu, #screen-new, #screen-join { +#screen-menu, #screen-new, #screen-join, #screen-choose { display: none; align-items: center; justify-content: center; @@ -36,7 +36,7 @@ html, body { radial-gradient(circle at 50% 20%, rgba(60, 90, 140, 0.35), transparent 60%), linear-gradient(180deg, #0b1220, #05070c); } -#screen-menu.active, #screen-new.active, #screen-join.active { display: flex; } +#screen-menu.active, #screen-new.active, #screen-join.active, #screen-choose.active { display: flex; } .menu-card { width: 380px; @@ -104,6 +104,36 @@ input:focus, select:focus { border-color: var(--accent); } .game-list li:hover { background: rgba(110, 175, 255, 0.15); } .game-list li.selected { background: rgba(110, 175, 255, 0.3); } +/* Flag + name pickers used on the new-game and join screens. */ +.civ-list { + list-style: none; + margin: 6px 0 14px; + padding: 0; + max-height: 220px; + overflow-y: auto; + border-radius: 8px; + background: rgba(0, 0, 0, 0.3); + border: 1px solid rgba(150, 190, 240, 0.15); +} +.civ-list li { + display: flex; + align-items: center; + gap: 10px; + padding: 7px 12px; + cursor: pointer; + border-bottom: 1px solid rgba(255,255,255,0.05); +} +.civ-list li:hover { background: rgba(110, 175, 255, 0.15); } +.civ-list li.selected { background: rgba(110, 175, 255, 0.3); } +.civ-list img { + width: 32px; + height: 32px; + object-fit: cover; + border-radius: 3px; + border: 1px solid rgba(255, 255, 255, 0.15); + flex: 0 0 auto; +} + /* ------------------------------------------------------------- world map -- */ #screen-game.active { display: block; } @@ -211,6 +241,21 @@ input:focus, select:focus { border-color: var(--accent); } justify-content: center; } .unit .body img { width: 78%; height: 78%; image-rendering: auto; } +/* Owner's flag pinned to the top-left quarter of the unit. */ +.unit .unit-flag { + position: absolute; + top: 0; + left: 0; + width: 50%; + height: 50%; + object-fit: cover; + border: 1px solid rgba(0, 0, 0, 0.65); + border-radius: 6px 0 4px 0; + box-shadow: 0 1px 2px rgba(0, 0, 0, 0.5); + pointer-events: none; + z-index: 3; + display: block; +} .unit.selected .body { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9), 0 2px 6px rgba(0,0,0,0.6); } .unit .health { position: absolute; @@ -350,6 +395,47 @@ input:focus, select:focus { border-color: var(--accent); } } .unit-stat:hover { color: var(--text); } +/* Chat-like feed of short-lived news in the lower-left corner. */ +.game-feed { + position: absolute; + left: 14px; + bottom: 14px; + width: 320px; + max-width: calc(50vw - 30px); + display: flex; + flex-direction: column; + gap: 4px; + pointer-events: none; + z-index: 40; +} +.feed-line { + align-self: flex-start; + max-width: 100%; + padding: 6px 10px; + border-radius: 7px; + background: rgba(8, 12, 20, 0.86); + border: 1px solid rgba(150, 190, 240, 0.35); + color: var(--text); + font-size: 12px; + line-height: 1.35; + box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5); + opacity: 1; + transform: translateY(0); + transition: opacity 0.4s ease, transform 0.4s ease; + animation: feed-in 0.18s ease; +} +.feed-line.leaving { opacity: 0; transform: translateY(8px); } +.feed-line.feed-alert { + background: rgba(80, 14, 14, 0.92); + border-color: #ff6a6a; + color: #ffd9d9; + font-weight: 600; +} +@keyframes feed-in { + from { opacity: 0; transform: translateY(8px); } + to { opacity: 1; transform: translateY(0); } +} + .tooltip { position: absolute; z-index: 80; diff --git a/client/index.html b/client/index.html index 9ec5bd2..384f69e 100644 --- a/client/index.html +++ b/client/index.html @@ -25,19 +25,19 @@

New game

@@ -76,6 +76,19 @@
+ +
+ +
+
@@ -140,6 +153,9 @@
+ +
+