feat: one look for every part: generated parchment, cloth and wood patterns, one header band, framed docks with one shadow, always-visible styled scrollbars
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
01809247a2
commit
da7b644b79
|
|
@ -9,7 +9,7 @@ This is the Nuxt client for a browser strategy game in the style of Tribal Wars.
|
||||||
- **Transport** is WS-first through the `ws` singleton from `@blax-software/networking`, the same as learn-atc. HTTP is only for login and register, which return the bearer token. Load the `blax-websockets` skill before you write `ws.send` or `ws.listen` code.
|
- **Transport** is WS-first through the `ws` singleton from `@blax-software/networking`, the same as learn-atc. HTTP is only for login and register, which return the bearer token. Load the `blax-websockets` skill before you write `ws.send` or `ws.listen` code.
|
||||||
- **Dense and plain, like the old browser strategy games** (the reference is Die Stämme; notes and screenshots in the sibling repo `game-village-politics-research` (`../game-village-politics-research/die-staemme/`), kept out of this repo). A 16 px root (17 px from 1800 px wide; rem sizes only, `text-sm` for body text, no fixed `text-[13px]`), square frames with thin lines, tan header bands, tight table rows (`.grid-table`), small squared buttons (`.btn-primary` dark wood, `.btn-attack` red for attacks only), thin notice bars. Actions are buttons, not text links: `.btn` for screen links and commands, `.btn-fill` for the "(20)" that fills an amount field; names inside lists and tables stay links. Bigger text must not add line wraps: keep rows `whitespace-nowrap` where they were one line. No rounded cards, pills, big padding or decorative icons: an icon only where it carries meaning. Theme and component classes live in `app/assets/css/main.css`; hand-written inline SVG graphics in `app/components/icon/`, colours in `app/utils/palette.ts`. No paid, hosted or licensed assets: no icon packs, web fonts or images from outside the repo, and nothing copied from Die Stämme.
|
- **Dense and plain, like the old browser strategy games** (the reference is Die Stämme; notes and screenshots in the sibling repo `game-village-politics-research` (`../game-village-politics-research/die-staemme/`), kept out of this repo). A 16 px root (17 px from 1800 px wide; rem sizes only, `text-sm` for body text, no fixed `text-[13px]`), square frames with thin lines, tan header bands, tight table rows (`.grid-table`), small squared buttons (`.btn-primary` dark wood, `.btn-attack` red for attacks only), thin notice bars. Actions are buttons, not text links: `.btn` for screen links and commands, `.btn-fill` for the "(20)" that fills an amount field; names inside lists and tables stay links. Bigger text must not add line wraps: keep rows `whitespace-nowrap` where they were one line. No rounded cards, pills, big padding or decorative icons: an icon only where it carries meaning. Theme and component classes live in `app/assets/css/main.css`; hand-written inline SVG graphics in `app/components/icon/`, colours in `app/utils/palette.ts`. No paid, hosted or licensed assets: no icon packs, web fonts or images from outside the repo, and nothing copied from Die Stämme.
|
||||||
- **The village is a ground-level land view** (`app/components/village/Diorama.vue`, geometry in `app/diorama/`): isometric low-poly, drawn as inline SVG, no WebGL. The land fills the frame edge to edge (no island, no sky), cut to the container's shape; narrow screens scroll sideways. There are no tiles or positions: the server only sends each building's `space` and the village's `space.used/max`, and the client lays everything out deterministically in id order. The village core sits in the middle (headquarters on the plaza, storage, hiding places and rally point around it, inside the wall ring when there is one, a dirt edge without). Resource sites stand outside in their zones: iron mines at the rocky hill (upper left), clay pits on clay ground (lower left), timber camps at the forest edge (lower right), farms with fields (right); dirt roads lead from the gates to each zone and forest fills the rest. Levels start at 1. Each type has a model per level tier (1–4, 5–14, 15+); the wall goes stakes → timber → stone with towers. Buildings are focusable buttons that enter the building (`buildingRoute`): the headquarters opens construction, the rally point its commands, a military building its recruiting, every other building its own screen (`/village/<id>/building/<bid>`); each of these screens starts with `VillageBuildingHeader`: a close-up (`VillageCloseup`, `app/diorama/closeup.ts`: the building large on its ground, its props and forest, its assigned workers walking to where they work and back carrying what they make), what it does now and one level up (`effects`/`next_effects` from the server), workers, priority, upgrade and demolish. The open building stays outlined in the village, and clicking it again returns to the overview. Buildings are clickable anywhere on their outline (`hit`, a convex hull round their polygons and ground ring), the thin wall also along a wide band on its ring, and their level badges and countdowns as well; a type that doesn't stand yet keeps an invisible empty plot that opens its build card. Buildings never move or light up on hover: only a click outlines the ground under them. Ambient life is welcome and stays out of the way: flat ground shadows, smoke from chimneys, forges and kilns, villagers walking the roads to the zones they work in; all motion stops under `prefers-reduced-motion`. The same models draw the building portraits on screen headers, the HQ list and the building cards (`VillageBuildingPortrait`). The world map groups forests, lakes and rocky hills by smooth noise of the coordinates, and village markers grow in five sizes with points. Map coordinates run around 0|0, negative included (−500 to 499 on a 1000-field map, lowest value from `map.view`'s `min`); continents are named from the top-left like Die Stämme, so 0|0 is the corner of K44, K45, K54 and K55. Use `app/utils/map.ts` for bounds and continents, never `0` or `500` literals.
|
- **The village is a ground-level land view** (`app/components/village/Diorama.vue`, geometry in `app/diorama/`): isometric low-poly, drawn as inline SVG, no WebGL. The land fills the frame edge to edge (no island, no sky), cut to the container's shape; narrow screens scroll sideways. There are no tiles or positions: the server only sends each building's `space` and the village's `space.used/max`, and the client lays everything out deterministically in id order. The village core sits in the middle (headquarters on the plaza, storage, hiding places and rally point around it, inside the wall ring when there is one, a dirt edge without). Resource sites stand outside in their zones: iron mines at the rocky hill (upper left), clay pits on clay ground (lower left), timber camps at the forest edge (lower right), farms with fields (right); dirt roads lead from the gates to each zone and forest fills the rest. Levels start at 1. Each type has a model per level tier (1–4, 5–14, 15+); the wall goes stakes → timber → stone with towers. Buildings are focusable buttons that enter the building (`buildingRoute`): the headquarters opens construction, the rally point its commands, a military building its recruiting, every other building its own screen (`/village/<id>/building/<bid>`); each of these screens starts with `VillageBuildingHeader`: a close-up (`VillageCloseup`, `app/diorama/closeup.ts`: the building large on its ground, its props and forest, its assigned workers walking to where they work and back carrying what they make), what it does now and one level up (`effects`/`next_effects` from the server), workers, priority, upgrade and demolish. The open building stays outlined in the village, and clicking it again returns to the overview. Buildings are clickable anywhere on their outline (`hit`, a convex hull round their polygons and ground ring), the thin wall also along a wide band on its ring, and their level badges and countdowns as well; a type that doesn't stand yet keeps an invisible empty plot that opens its build card. Buildings never move or light up on hover: only a click outlines the ground under them. Ambient life is welcome and stays out of the way: flat ground shadows, smoke from chimneys, forges and kilns, villagers walking the roads to the zones they work in; all motion stops under `prefers-reduced-motion`. The same models draw the building portraits on screen headers, the HQ list and the building cards (`VillageBuildingPortrait`). The world map groups forests, lakes and rocky hills by smooth noise of the coordinates, and village markers grow in five sizes with points. Map coordinates run around 0|0, negative included (−500 to 499 on a 1000-field map, lowest value from `map.view`'s `min`); continents are named from the top-left like Die Stämme, so 0|0 is the corner of K44, K45, K54 and K55. Use `app/utils/map.ts` for bounds and continents, never `0` or `500` literals.
|
||||||
- **Flat medieval colours only**, in the diorama and everywhere else: no gradients (CSS or SVG), no blur or backdrop-blur, no SVG filters or glows, no translucent overlays. Depth comes from the three flat shades per face in `app/diorama/iso.ts`, solid borders and hard shadows. Keep components small and typed, with state in composables (`useVillage`, `useWorld`).
|
- **Flat medieval colours only**, in the diorama and everywhere else: no gradients (CSS or SVG), no blur or backdrop-blur, no SVG filters or glows, no translucent overlays. Depth comes from the three flat shades per face in `app/diorama/iso.ts`, solid borders and hard shadows. Surfaces carry small repeating patterns generated in code at startup (`app/utils/patterns.ts` → `--pat-*` custom properties, set by `plugins/patterns.client.ts`, painted per `bg-parchment-*`/`bg-wood-*` class and on `.panel`, `.frame`, `.btn-primary` in `main.css`): parchment flecks, woven header bands with a stitched hem, wood grain; flat opaque shades a step off the surface, never images or opacity. Keep them minimal. One look for every part: each header band is `.panel-head` with a `.panel-title`, everything that floats over the village has the `.float` hard shadow and sits in a bordered frame, and every vertical scroll area is `.scroll-y`, whose bar always shows so content never shifts sideways; the one scrollbar style (wood handle with notches in a parchment track) lives in `main.css`. Pages keep the page scrollbar; the fullscreen village sets `html.stage` and never scrolls. Keep components small and typed, with state in composables (`useVillage`, `useWorld`).
|
||||||
- **The village fills the screen.** On the village's own screens (`/village/<id>/…`) `GameVillageFrame` draws the diorama fixed across the whole browser window and docks everything over it, solid and opaque: the menu and the village bar along the top, the overview boxes in a right column (on phones a bottom sheet on the overview), and the open screen (headquarters, recruit, rally point, workforce) in a `UiWindow` on the left that folds and closes back to the overview; on the overview the left slot holds the build card of an empty plot picked in the village (`useVillageSelection`). Screen grids inside a window use container queries (`@4xl:`), not viewport breakpoints. The village scales to fit, no pan: the frame measures what the bars, the right column, the phone tab bar and the bottom sheet cover (`inset`), `buildScene` fits the whole village into the rest, and ground and forest are generated for the whole stage, so nothing of the village is ever cut off. Windows are docked now and meant to become draggable later, so `UiWindow` holds no position logic. This is where the game deliberately leaves Die Stämme's look behind.
|
- **The village fills the screen.** On the village's own screens (`/village/<id>/…`) `GameVillageFrame` draws the diorama fixed across the whole browser window and docks everything over it, solid and opaque: the menu and the village bar along the top, the overview boxes in a right column (on phones a bottom sheet on the overview), and the open screen (headquarters, recruit, rally point, workforce) in a `UiWindow` on the left that folds and closes back to the overview; on the overview the left slot holds the build card of an empty plot picked in the village (`useVillageSelection`). Screen grids inside a window use container queries (`@4xl:`), not viewport breakpoints. The village scales to fit, no pan: the frame measures what the bars, the right column, the phone tab bar and the bottom sheet cover (`inset`), `buildScene` fits the whole village into the rest, and ground and forest are generated for the whole stage, so nothing of the village is ever cut off. Windows are docked now and meant to become draggable later, so `UiWindow` holds no position logic. This is where the game deliberately leaves Die Stämme's look behind.
|
||||||
- **One game shell for the rest.** The map and reports sit in one centred column (1100 px). All world pages use `layouts/game.vue` (on village screens `GameVillageFrame` draws the same parts over the village): the dark main menu (`GameMenuBar`: village, map, reports with its count inline, each with a hover dropdown of its sub-pages; server clock; account dropdown), then the village header (`GameVillageBar`, in two pieces with the village showing between them: on the left the quick bar with the village's screens over the village row, on the right the stock in thin cells and incoming troops; the space between lets clicks through), thin notices, and the content in a `.frame`. On phones the screens move to a bottom tab bar (`GameTabBar`). The header's village is the URL's on village screens and the last opened one elsewhere; `GameVillageFrame` holds its one `useVillage()` and shares it through `useVillageContext()`. Pages outside a world use `layouts/default.vue` (menu only). A page has one of two shapes: a title with box tabs (`UiSubTabs`: buildings like the rally point) or a title with a sub-menu on the left (`UiSideMenu`: lists like reports). One key per screen (`useShortcuts`): V overview, H headquarters, T recruit, P rally point, W workforce, M map, R reports. The overview stays clean: the village and a narrow column of boxes (incoming attacks, production, units, population, construction); tables live on the building screens. The map shows a popup over a hovered village and actions under a clicked one. The village row starts with the quest book (`QuestBook`, a native `<dialog>` without a veil): it opens by itself when `quests.claimable` goes up, and a goal's "show me" opens its screen, a building goal the headquarters with `?hint=<type>` marking that row.
|
- **One game shell for the rest.** The map and reports sit in one centred column (1100 px). All world pages use `layouts/game.vue` (on village screens `GameVillageFrame` draws the same parts over the village): the dark main menu (`GameMenuBar`: village, map, reports with its count inline, each with a hover dropdown of its sub-pages; server clock; account dropdown), then the village header (`GameVillageBar`, in two pieces with the village showing between them: on the left the quick bar with the village's screens over the village row, on the right the stock in thin cells and incoming troops; the space between lets clicks through), thin notices, and the content in a `.frame`. On phones the screens move to a bottom tab bar (`GameTabBar`). The header's village is the URL's on village screens and the last opened one elsewhere; `GameVillageFrame` holds its one `useVillage()` and shares it through `useVillageContext()`. Pages outside a world use `layouts/default.vue` (menu only). A page has one of two shapes: a title with box tabs (`UiSubTabs`: buildings like the rally point) or a title with a sub-menu on the left (`UiSideMenu`: lists like reports). One key per screen (`useShortcuts`): V overview, H headquarters, T recruit, P rally point, W workforce, M map, R reports. The overview stays clean: the village and a narrow column of boxes (incoming attacks, production, units, population, construction); tables live on the building screens. The map shows a popup over a hovered village and actions under a clicked one. The village row starts with the quest book (`QuestBook`, a native `<dialog>` without a veil): it opens by itself when `quests.claimable` goes up, and a goal's "show me" opens its screen, a building goal the headquarters with `?hint=<type>` marking that row.
|
||||||
- All user-facing text goes through i18n keys, with `en` as the first locale. Sources are `i18n/locales/` and `i18n/pages/` (`@blax-software/i18n` layout); register a new page file in `i18n/messageloader.ts`. vue-i18n reads a bare `|` as a plural separator and drops what follows, so coordinates in messages are written `"{x}{'|'}{y}"` inside a double-quoted string.
|
- All user-facing text goes through i18n keys, with `en` as the first locale. Sources are `i18n/locales/` and `i18n/pages/` (`@blax-software/i18n` layout); register a new page file in `i18n/messageloader.ts`. vue-i18n reads a bare `|` as a plural separator and drops what follows, so coordinates in messages are written `"{x}{'|'}{y}"` inside a double-quoted string.
|
||||||
|
|
|
||||||
|
|
@ -60,8 +60,17 @@
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* The page always keeps its scrollbar, so nothing shifts when content grows; the
|
||||||
|
fullscreen village (html.stage) doesn't scroll at all. */
|
||||||
|
html {
|
||||||
|
overflow-y: scroll;
|
||||||
|
}
|
||||||
|
html.stage {
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
body {
|
body {
|
||||||
@apply bg-[#cdb488] font-sans text-ink-900 antialiased;
|
@apply bg-[#cdb488] font-sans text-ink-900 antialiased;
|
||||||
|
background-image: var(--pat-backdrop);
|
||||||
}
|
}
|
||||||
|
|
||||||
button:not(:disabled),
|
button:not(:disabled),
|
||||||
|
|
@ -75,12 +84,95 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* One scrollbar everywhere: a dark wooden handle with carved notches in a parchment
|
||||||
|
* track. Firefox only knows the two colours.
|
||||||
|
*/
|
||||||
|
@supports not selector(::-webkit-scrollbar) {
|
||||||
|
* {
|
||||||
|
scrollbar-color: var(--color-wood-700) var(--color-parchment-200);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
::-webkit-scrollbar {
|
||||||
|
width: 14px;
|
||||||
|
height: 14px;
|
||||||
|
}
|
||||||
|
::-webkit-scrollbar-track {
|
||||||
|
background-color: var(--color-parchment-200);
|
||||||
|
background-image: var(--pat-parchment-200);
|
||||||
|
border-left: 1px solid var(--color-wood-700);
|
||||||
|
}
|
||||||
|
::-webkit-scrollbar-track:horizontal {
|
||||||
|
border-left: 0;
|
||||||
|
border-top: 1px solid var(--color-wood-700);
|
||||||
|
}
|
||||||
|
::-webkit-scrollbar-thumb {
|
||||||
|
background-color: var(--color-wood-700);
|
||||||
|
background-image: var(--pat-notches);
|
||||||
|
border: 3px solid var(--color-parchment-200);
|
||||||
|
}
|
||||||
|
::-webkit-scrollbar-thumb:hover {
|
||||||
|
background-color: var(--color-wood-800);
|
||||||
|
}
|
||||||
|
::-webkit-scrollbar-corner {
|
||||||
|
background-color: var(--color-parchment-200);
|
||||||
|
}
|
||||||
|
::-webkit-scrollbar-button {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Generated patterns (app/utils/patterns.ts) on every surface of a colour: parchment
|
||||||
|
* flecks, woven bands, wood grain. The colour stays the utility's; only the texture is added.
|
||||||
|
*/
|
||||||
@layer components {
|
@layer components {
|
||||||
|
.bg-parchment-50 {
|
||||||
|
background-image: var(--pat-parchment-50);
|
||||||
|
}
|
||||||
|
.bg-parchment-100 {
|
||||||
|
background-image: var(--pat-parchment-100);
|
||||||
|
}
|
||||||
|
.bg-parchment-200 {
|
||||||
|
background-image: var(--pat-parchment-200);
|
||||||
|
}
|
||||||
|
.bg-parchment-300 {
|
||||||
|
background-image: var(--pat-parchment-300);
|
||||||
|
}
|
||||||
|
.bg-wood-950 {
|
||||||
|
background-image: var(--pat-wood-950);
|
||||||
|
}
|
||||||
|
.bg-wood-900 {
|
||||||
|
background-image: var(--pat-wood-900);
|
||||||
|
}
|
||||||
|
.bg-wood-800 {
|
||||||
|
background-image: var(--pat-wood-800);
|
||||||
|
}
|
||||||
|
.bg-wood-700 {
|
||||||
|
background-image: var(--pat-wood-700);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@layer components {
|
||||||
|
/* What floats over the village (bars, boxes, windows, cards) casts one hard shadow. */
|
||||||
|
.float {
|
||||||
|
box-shadow: 3px 3px 0 0 var(--color-wood-950);
|
||||||
|
}
|
||||||
|
/* A scroll area that always shows its bar, so its content never shifts sideways. */
|
||||||
|
.scroll-y {
|
||||||
|
overflow-y: scroll;
|
||||||
|
overscroll-behavior: contain;
|
||||||
|
}
|
||||||
|
|
||||||
.panel {
|
.panel {
|
||||||
@apply border border-wood-700 bg-parchment-50;
|
@apply border border-wood-700 bg-parchment-50;
|
||||||
|
background-image: var(--pat-parchment-50);
|
||||||
}
|
}
|
||||||
|
/* Every header band alike: woven cloth with a stitched hem along its bottom. */
|
||||||
.panel-head {
|
.panel-head {
|
||||||
@apply flex flex-wrap items-center justify-between gap-2 border-b border-wood-700 bg-parchment-300 px-2 py-1;
|
@apply flex flex-wrap items-center justify-between gap-2 border-b border-wood-700 bg-parchment-300 px-2 py-1;
|
||||||
|
background-image: var(--pat-stitch), var(--pat-parchment-300);
|
||||||
|
background-repeat: repeat-x, repeat;
|
||||||
|
background-position: left bottom, 0 0;
|
||||||
}
|
}
|
||||||
.panel-title {
|
.panel-title {
|
||||||
@apply font-display text-base leading-snug font-semibold text-wood-950;
|
@apply font-display text-base leading-snug font-semibold text-wood-950;
|
||||||
|
|
@ -97,6 +189,7 @@
|
||||||
/* The everyday button: dark wood with light text. */
|
/* The everyday button: dark wood with light text. */
|
||||||
.btn-primary {
|
.btn-primary {
|
||||||
@apply border-wood-950 bg-wood-800 text-parchment-50 hover:bg-wood-700 disabled:hover:bg-wood-800;
|
@apply border-wood-950 bg-wood-800 text-parchment-50 hover:bg-wood-700 disabled:hover:bg-wood-800;
|
||||||
|
background-image: var(--pat-wood-800);
|
||||||
}
|
}
|
||||||
/* Attacks only. */
|
/* Attacks only. */
|
||||||
.btn-attack {
|
.btn-attack {
|
||||||
|
|
@ -104,6 +197,7 @@
|
||||||
}
|
}
|
||||||
.btn-outline {
|
.btn-outline {
|
||||||
@apply border-wood-600 bg-parchment-100 text-wood-900 hover:bg-parchment-200;
|
@apply border-wood-600 bg-parchment-100 text-wood-900 hover:bg-parchment-200;
|
||||||
|
background-image: var(--pat-parchment-100);
|
||||||
}
|
}
|
||||||
.btn-ghost {
|
.btn-ghost {
|
||||||
@apply border-transparent text-wood-800 hover:bg-parchment-200;
|
@apply border-transparent text-wood-800 hover:bg-parchment-200;
|
||||||
|
|
@ -147,6 +241,7 @@
|
||||||
/* The framed content column on the backdrop. */
|
/* The framed content column on the backdrop. */
|
||||||
.frame {
|
.frame {
|
||||||
@apply border border-wood-900 bg-parchment-100;
|
@apply border border-wood-900 bg-parchment-100;
|
||||||
|
background-image: var(--pat-parchment-100);
|
||||||
}
|
}
|
||||||
/* A data table: tan header band, tight rows, thin lines. */
|
/* A data table: tan header band, tight rows, thin lines. */
|
||||||
.grid-table {
|
.grid-table {
|
||||||
|
|
@ -154,6 +249,7 @@
|
||||||
}
|
}
|
||||||
.grid-table th {
|
.grid-table th {
|
||||||
@apply border-b border-wood-700 bg-parchment-200 px-1.5 py-0.5 text-left text-xs font-semibold text-ink-700;
|
@apply border-b border-wood-700 bg-parchment-200 px-1.5 py-0.5 text-left text-xs font-semibold text-ink-700;
|
||||||
|
background-image: var(--pat-parchment-200);
|
||||||
}
|
}
|
||||||
.grid-table td {
|
.grid-table td {
|
||||||
@apply border-b border-parchment-300 px-1.5 py-0.5;
|
@apply border-b border-parchment-300 px-1.5 py-0.5;
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ async function rename() {
|
||||||
<template>
|
<template>
|
||||||
<div class="pointer-events-none flex flex-wrap items-start justify-between gap-1 text-sm">
|
<div class="pointer-events-none flex flex-wrap items-start justify-between gap-1 text-sm">
|
||||||
<div class="pointer-events-auto flex max-w-full min-w-0 flex-col items-start gap-1">
|
<div class="pointer-events-auto flex max-w-full min-w-0 flex-col items-start gap-1">
|
||||||
<nav class="hidden border border-wood-700 bg-parchment-200 md:flex" :aria-label="$t('village.screens.label')">
|
<nav class="float hidden border border-wood-700 bg-parchment-200 md:flex" :aria-label="$t('village.screens.label')">
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
v-for="s in VILLAGE_SCREENS"
|
v-for="s in VILLAGE_SCREENS"
|
||||||
:key="s.name"
|
:key="s.name"
|
||||||
|
|
@ -58,7 +58,7 @@ async function rename() {
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="flex max-w-full min-w-0 items-stretch border border-wood-700 bg-parchment-200">
|
<div class="float flex max-w-full min-w-0 items-stretch border border-wood-700 bg-parchment-200">
|
||||||
<!-- The quest book, with what waits in it. -->
|
<!-- The quest book, with what waits in it. -->
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
|
@ -114,7 +114,7 @@ async function rename() {
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="pointer-events-auto flex w-full items-stretch border border-wood-700 bg-parchment-200 sm:w-auto">
|
<div class="float pointer-events-auto flex w-full items-stretch border border-wood-700 bg-parchment-200 sm:w-auto">
|
||||||
<!-- The stock: four resources, the storage cap and the villagers, each in its own cell. -->
|
<!-- The stock: four resources, the storage cap and the villagers, each in its own cell. -->
|
||||||
<div class="grid flex-1 grid-cols-5 sm:flex">
|
<div class="grid flex-1 grid-cols-5 sm:flex">
|
||||||
<NuxtLink v-for="r in (['wood', 'clay', 'iron', 'food'] as const)" :key="r" :to="`${base}/workforce`" class="cell flex hover:bg-parchment-100">
|
<NuxtLink v-for="r in (['wood', 'clay', 'iron', 'food'] as const)" :key="r" :to="`${base}/workforce`" class="cell flex hover:bg-parchment-100">
|
||||||
|
|
|
||||||
|
|
@ -65,6 +65,9 @@ const screenTitle = computed(() => {
|
||||||
})
|
})
|
||||||
const picked = computed(() => !!plot.value)
|
const picked = computed(() => !!plot.value)
|
||||||
|
|
||||||
|
// The fullscreen village never scrolls the page; other pages keep their scrollbar.
|
||||||
|
useHead(() => ({ htmlAttrs: { class: stage.value ? 'stage' : '' } }))
|
||||||
|
|
||||||
|
|
||||||
// What the bars, the right column and the phone tab bar cover, so the whole village fits
|
// What the bars, the right column and the phone tab bar cover, so the whole village fits
|
||||||
// into the rest of the screen while land and forest run on beneath them.
|
// into the rest of the screen while land and forest run on beneath them.
|
||||||
|
|
@ -148,7 +151,7 @@ useShortcuts(() => {
|
||||||
|
|
||||||
<div class="flex min-h-0 flex-1 items-start gap-2 p-1 pb-14 sm:p-2 md:pb-2">
|
<div class="flex min-h-0 flex-1 items-start gap-2 p-1 pb-14 sm:p-2 md:pb-2">
|
||||||
<!-- Left: the open screen in a window, or on the overview the card of what is picked. -->
|
<!-- Left: the open screen in a window, or on the overview the card of what is picked. -->
|
||||||
<div v-if="overview" v-show="picked" class="pointer-events-auto max-h-full w-full overflow-y-auto sm:w-80">
|
<div v-if="overview" v-show="picked" class="scroll-y float pointer-events-auto max-h-full w-full border border-wood-900 bg-parchment-200 p-1.5 sm:w-80">
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
<UiWindow v-else class="w-full max-w-[66rem]" :title="screenTitle" :close-to="base">
|
<UiWindow v-else class="w-full max-w-[66rem]" :title="screenTitle" :close-to="base">
|
||||||
|
|
@ -159,7 +162,7 @@ useShortcuts(() => {
|
||||||
<div
|
<div
|
||||||
v-if="v.village.value"
|
v-if="v.village.value"
|
||||||
ref="sideColumn"
|
ref="sideColumn"
|
||||||
class="pointer-events-auto ml-auto max-h-full w-64 shrink-0 overflow-y-auto"
|
class="scroll-y float pointer-events-auto ml-auto max-h-full w-[17.5rem] shrink-0 border border-wood-900 bg-parchment-200"
|
||||||
:class="overview && !picked ? 'max-lg:w-full max-lg:self-end max-lg:max-h-[45dvh]' : 'hidden lg:block'"
|
:class="overview && !picked ? 'max-lg:w-full max-lg:self-end max-lg:max-h-[45dvh]' : 'hidden lg:block'"
|
||||||
>
|
>
|
||||||
<VillageOverviewSidebar :village="v.village.value" :base="base" :seconds-until="v.secondsUntil" />
|
<VillageOverviewSidebar :village="v.village.value" :base="base" :seconds-until="v.secondsUntil" />
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ async function go(goal: QuestGoal) {
|
||||||
<template>
|
<template>
|
||||||
<dialog
|
<dialog
|
||||||
ref="dialog"
|
ref="dialog"
|
||||||
class="quest-book m-auto w-[min(46rem,calc(100vw-1rem))] border border-wood-900 bg-parchment-100 p-0 text-ink-900 shadow-[4px_4px_0_0_rgba(43,29,14,1)]"
|
class="quest-book m-auto w-[min(46rem,calc(100vw-1rem))] border border-wood-900 bg-parchment-100 p-0 float text-ink-900"
|
||||||
:aria-label="$t('quests.title')"
|
:aria-label="$t('quests.title')"
|
||||||
@close="open = false"
|
@close="open = false"
|
||||||
>
|
>
|
||||||
|
|
|
||||||
|
|
@ -19,8 +19,8 @@ const folded = defineModel<boolean>('folded', { default: false })
|
||||||
Kept free of position logic so it can become draggable later.
|
Kept free of position logic so it can become draggable later.
|
||||||
-->
|
-->
|
||||||
<template>
|
<template>
|
||||||
<section class="pointer-events-auto flex max-h-full min-h-0 flex-col border border-wood-900 bg-parchment-100 shadow-[3px_3px_0_0_rgba(43,29,14,1)]">
|
<section class="pointer-events-auto flex max-h-full min-h-0 flex-col float border border-wood-900 bg-parchment-100">
|
||||||
<header class="flex shrink-0 items-center gap-1 border-b border-wood-700 bg-parchment-300 px-2 py-0.5">
|
<header class="panel-head shrink-0 flex-nowrap gap-1 py-0.5">
|
||||||
<span class="panel-title min-w-0 flex-1 truncate">{{ title }}</span>
|
<span class="panel-title min-w-0 flex-1 truncate">{{ title }}</span>
|
||||||
<button type="button" class="btn btn-ghost px-1" :title="$t(folded ? 'window.unfold' : 'window.fold')" :aria-expanded="!folded" @click="folded = !folded">
|
<button type="button" class="btn btn-ghost px-1" :title="$t(folded ? 'window.unfold' : 'window.fold')" :aria-expanded="!folded" @click="folded = !folded">
|
||||||
<IconUi :name="folded ? 'plus' : 'minus'" class="size-3.5" />
|
<IconUi :name="folded ? 'plus' : 'minus'" class="size-3.5" />
|
||||||
|
|
@ -35,7 +35,7 @@ const folded = defineModel<boolean>('folded', { default: false })
|
||||||
<span class="sr-only">{{ $t('window.close') }}</span>
|
<span class="sr-only">{{ $t('window.close') }}</span>
|
||||||
</button>
|
</button>
|
||||||
</header>
|
</header>
|
||||||
<div v-show="!folded" class="@container min-h-0 overflow-y-auto">
|
<div v-show="!folded" class="@container scroll-y min-h-0">
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ function order(o: BuildOrder) {
|
||||||
<template>
|
<template>
|
||||||
<aside class="space-y-2 p-2 text-sm">
|
<aside class="space-y-2 p-2 text-sm">
|
||||||
<section v-if="incoming.length" class="side-box border-blood-700">
|
<section v-if="incoming.length" class="side-box border-blood-700">
|
||||||
<h2 class="side-title bg-blood-700 text-parchment-50">{{ $t('village.side.incoming') }}</h2>
|
<h2 class="panel-head panel-title side-alarm">{{ $t('village.side.incoming') }}</h2>
|
||||||
<ul class="side-body">
|
<ul class="side-body">
|
||||||
<li v-for="m in incoming" :key="m.id" class="flex items-center gap-2 text-blood-700">
|
<li v-for="m in incoming" :key="m.id" class="flex items-center gap-2 text-blood-700">
|
||||||
<IconUi name="attack" class="size-4" />
|
<IconUi name="attack" class="size-4" />
|
||||||
|
|
@ -38,7 +38,7 @@ function order(o: BuildOrder) {
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="side-box">
|
<section class="side-box">
|
||||||
<h2 class="side-title">{{ $t('village.side.production') }}</h2>
|
<h2 class="panel-head panel-title">{{ $t('village.side.production') }}</h2>
|
||||||
<ul class="side-body">
|
<ul class="side-body">
|
||||||
<li v-for="{ r, rate } in production" :key="r" class="flex items-center gap-2">
|
<li v-for="{ r, rate } in production" :key="r" class="flex items-center gap-2">
|
||||||
<IconResource :resource="r" class="size-4" />
|
<IconResource :resource="r" class="size-4" />
|
||||||
|
|
@ -51,7 +51,7 @@ function order(o: BuildOrder) {
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="side-box">
|
<section class="side-box">
|
||||||
<h2 class="side-title">{{ $t('village.side.units') }}</h2>
|
<h2 class="panel-head panel-title">{{ $t('village.side.units') }}</h2>
|
||||||
<div class="side-body">
|
<div class="side-body">
|
||||||
<ul v-if="troops.length || village.levy.militia">
|
<ul v-if="troops.length || village.levy.militia">
|
||||||
<li v-for="[unit, count] in troops" :key="unit" class="flex items-center gap-2">
|
<li v-for="[unit, count] in troops" :key="unit" class="flex items-center gap-2">
|
||||||
|
|
@ -76,7 +76,7 @@ function order(o: BuildOrder) {
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="side-box">
|
<section class="side-box">
|
||||||
<h2 class="side-title">{{ $t('village.population.title') }}</h2>
|
<h2 class="panel-head panel-title">{{ $t('village.population.title') }}</h2>
|
||||||
<dl class="grid grid-cols-[1fr_auto] gap-x-2 gap-y-1 px-2.5 py-1.5">
|
<dl class="grid grid-cols-[1fr_auto] gap-x-2 gap-y-1 px-2.5 py-1.5">
|
||||||
<dt>{{ $t('village.population.villagers') }}</dt>
|
<dt>{{ $t('village.population.villagers') }}</dt>
|
||||||
<dd class="text-right font-semibold tabular-nums">{{ village.population.villagers }}</dd>
|
<dd class="text-right font-semibold tabular-nums">{{ village.population.villagers }}</dd>
|
||||||
|
|
@ -90,7 +90,7 @@ function order(o: BuildOrder) {
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section class="side-box">
|
<section class="side-box">
|
||||||
<h2 class="side-title">{{ $t('village.side.construction') }}</h2>
|
<h2 class="panel-head panel-title">{{ $t('village.side.construction') }}</h2>
|
||||||
<div class="side-body">
|
<div class="side-body">
|
||||||
<ol v-if="village.queue.length">
|
<ol v-if="village.queue.length">
|
||||||
<li v-for="o in village.queue" :key="o.id" class="flex items-center gap-2">
|
<li v-for="o in village.queue" :key="o.id" class="flex items-center gap-2">
|
||||||
|
|
@ -120,11 +120,15 @@ function order(o: BuildOrder) {
|
||||||
<style scoped>
|
<style scoped>
|
||||||
@reference "~/assets/css/main.css";
|
@reference "~/assets/css/main.css";
|
||||||
|
|
||||||
|
/* The same panel as everywhere; the column around them is the frame. */
|
||||||
.side-box {
|
.side-box {
|
||||||
@apply border border-wood-700 bg-parchment-50;
|
@apply border border-wood-700 bg-parchment-50;
|
||||||
|
background-image: var(--pat-parchment-50);
|
||||||
}
|
}
|
||||||
.side-title {
|
/* Incoming attacks: the band in oxblood, no cloth texture. */
|
||||||
@apply border-b border-wood-700 bg-parchment-300 px-1.5 py-0.5 text-sm font-bold text-wood-950;
|
.side-alarm {
|
||||||
|
@apply border-blood-800 bg-blood-700 text-parchment-50;
|
||||||
|
background-image: none;
|
||||||
}
|
}
|
||||||
.side-body {
|
.side-body {
|
||||||
@apply space-y-0.5 px-1.5 py-1;
|
@apply space-y-0.5 px-1.5 py-1;
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
// Paints the generated patterns into CSS custom properties before the first screen.
|
||||||
|
export default defineNuxtPlugin(() => {
|
||||||
|
const root = document.documentElement
|
||||||
|
for (const [name, value] of Object.entries(patternVars())) root.style.setProperty(name, value)
|
||||||
|
})
|
||||||
|
|
@ -0,0 +1,100 @@
|
||||||
|
// Small repeating patterns, generated from a seed when the game starts, so surfaces
|
||||||
|
// read as parchment, woven cloth and wood without any image files. Every tile uses flat,
|
||||||
|
// opaque colours a shade off its surface and leaves the rest transparent, so the surface
|
||||||
|
// colour shows through: no gradients, no opacity.
|
||||||
|
|
||||||
|
/** Deterministic pseudo-random numbers in [0, 1). */
|
||||||
|
function random(seed: number) {
|
||||||
|
let s = seed >>> 0
|
||||||
|
return () => {
|
||||||
|
s = (s + 0x6d2b79f5) >>> 0
|
||||||
|
let t = s
|
||||||
|
t = Math.imul(t ^ (t >>> 15), t | 1)
|
||||||
|
t ^= t + Math.imul(t ^ (t >>> 7), t | 61)
|
||||||
|
return ((t ^ (t >>> 14)) >>> 0) / 4294967296
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** `a` moved towards `b` by `t` (0..1), both #rrggbb. */
|
||||||
|
function mix(a: string, b: string, t: number) {
|
||||||
|
const ch = (hex: string, i: number) => parseInt(hex.slice(1 + i * 2, 3 + i * 2), 16)
|
||||||
|
const out = [0, 1, 2].map((i) => Math.round(ch(a, i) + (ch(b, i) - ch(a, i)) * t).toString(16).padStart(2, '0'))
|
||||||
|
return `#${out.join('')}`
|
||||||
|
}
|
||||||
|
|
||||||
|
const svg = (w: number, h: number, body: string) =>
|
||||||
|
`url("data:image/svg+xml,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" width="${w}" height="${h}" shape-rendering="crispEdges">${body}</svg>`)}")`
|
||||||
|
|
||||||
|
const INK = '#2b1d10'
|
||||||
|
const LIGHT = '#f3e7c9'
|
||||||
|
|
||||||
|
/** Parchment: scattered flecks and short fibres a shade darker than the page. */
|
||||||
|
function parchment(base: string, seed: number) {
|
||||||
|
const r = random(seed)
|
||||||
|
const dark = mix(base, INK, 0.07)
|
||||||
|
const light = mix(base, LIGHT, 0.25)
|
||||||
|
let body = ''
|
||||||
|
for (let i = 0; i < 26; i++) {
|
||||||
|
const x = Math.floor(r() * 96)
|
||||||
|
const y = Math.floor(r() * 96)
|
||||||
|
body += r() < 0.7 ? `<rect x="${x}" y="${y}" width="1" height="1" fill="${r() < 0.75 ? dark : light}"/>` : `<rect x="${x}" y="${y}" width="${2 + Math.floor(r() * 3)}" height="1" fill="${dark}"/>`
|
||||||
|
}
|
||||||
|
return svg(96, 96, body)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Woven cloth for header bands: a fine diagonal twill. */
|
||||||
|
function twill(base: string) {
|
||||||
|
const line = mix(base, INK, 0.06)
|
||||||
|
let body = ''
|
||||||
|
for (let i = 0; i < 6; i++) body += `<rect x="${i}" y="${i}" width="1" height="1" fill="${line}"/><rect x="${(i + 3) % 6}" y="${i}" width="1" height="1" fill="${line}"/>`
|
||||||
|
return svg(6, 6, body)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Wood: long grain lines, lighter streaks in a darker board, with the odd knot. */
|
||||||
|
function wood(base: string, seed: number) {
|
||||||
|
const r = random(seed)
|
||||||
|
const grain = mix(base, LIGHT, 0.07)
|
||||||
|
const dark = mix(base, '#000000', 0.18)
|
||||||
|
let body = ''
|
||||||
|
for (let y = 1; y < 24; y += 3 + Math.floor(r() * 3)) {
|
||||||
|
let x = 0
|
||||||
|
while (x < 160) {
|
||||||
|
const len = 12 + Math.floor(r() * 40)
|
||||||
|
body += `<rect x="${x}" y="${y + (r() < 0.3 ? 1 : 0)}" width="${len}" height="1" fill="${r() < 0.8 ? grain : dark}"/>`
|
||||||
|
x += len + 4 + Math.floor(r() * 18)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const kx = Math.floor(r() * 150)
|
||||||
|
body += `<rect x="${kx}" y="10" width="3" height="2" fill="${dark}"/>`
|
||||||
|
return svg(160, 24, body)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** A running stitch along the bottom of a band, like a sewn hem. */
|
||||||
|
function stitch(color: string) {
|
||||||
|
return svg(10, 4, `<rect x="1" y="1" width="5" height="1" fill="${color}"/>`)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Notches across a scrollbar's handle, like a carved grip. */
|
||||||
|
function notches(base: string) {
|
||||||
|
return svg(8, 6, `<rect x="0" y="2" width="8" height="1" fill="${mix(base, LIGHT, 0.16)}"/>`)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The CSS custom properties main.css paints its surfaces with: `--pat-<name>`.
|
||||||
|
* Seeds are fixed, so every visit gets the same patterns.
|
||||||
|
*/
|
||||||
|
export function patternVars(): Record<string, string> {
|
||||||
|
return {
|
||||||
|
'--pat-parchment-50': parchment('#f3e7c9', 11),
|
||||||
|
'--pat-parchment-100': parchment('#e8d6ad', 12),
|
||||||
|
'--pat-parchment-200': parchment('#dcc595', 13),
|
||||||
|
'--pat-parchment-300': twill('#c4a676'),
|
||||||
|
'--pat-wood-950': wood('#1f150c', 21),
|
||||||
|
'--pat-wood-900': wood('#2f2013', 22),
|
||||||
|
'--pat-wood-800': wood('#3e2b1a', 23),
|
||||||
|
'--pat-wood-700': wood('#57391f', 24),
|
||||||
|
'--pat-stitch': stitch('#75502e'),
|
||||||
|
'--pat-notches': notches('#57391f'),
|
||||||
|
'--pat-backdrop': parchment('#cdb488', 31),
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue