M5-M7: сцены, лобби, экран игры и цикл матча
Обе сцены собраны через Code Mode, не руками. - loader: поднимает модули, прогревает арт карт, уходит в lobby - lobby: обе UI-ветки в одной сцене (по ARCHITECTURE.md), матч — это смена видимого корня, а не загрузка сцены - GameScreen рисует текущее состояние и доводит узлы твинами, а не проигрывает поток событий: узел карты живёт вместе со своей картой, поэтому "шестёрка ушла из руки на стол" не требует отдельного случая - один тап = ход целиком; логика вынесена в core/rules/intent.ts и покрыта тестами, в том числе проверкой, что она никогда не предложит ход, который правила отвергнут - арт карт переехал в assets/resources: .pac — это инструкция упаковки на сборке, а не рантайм-ассет, и без ссылок на кадры в сборку не попадало ничего. Теперь все 37 спрайтов в одной текстуре 2048x2048 - клики кнопок подписываются в коде, а не через clickEvents сцены - строки интерфейса собраны в одном файле Сборка web-mobile проходит чисто, все ссылки в сцене проверены. Вживую не запускалось: браузер в этом окружении не поднимает главный цикл движка. Подробности — в docs/TECHNICAL.md. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* Every piece of text the player reads, in one place.
|
||||
*
|
||||
* Localisation is out of scope for iteration 1 (see docs/PLAN.md), but keeping
|
||||
* the strings together means adding a language later is a change to this file
|
||||
* and nothing else — rather than a hunt through scenes and components.
|
||||
*/
|
||||
export const Strings = {
|
||||
appTitle: 'Fool',
|
||||
appSubtitle: 'a game of durak',
|
||||
|
||||
newGame: 'New Game',
|
||||
quit: 'Leave',
|
||||
playAgain: 'Play Again',
|
||||
backToLobby: 'Back',
|
||||
|
||||
statsTitle: 'Your record',
|
||||
statsPlayed: 'Played',
|
||||
statsWon: 'Won',
|
||||
statsLost: 'Lost',
|
||||
statsStreak: 'Streak',
|
||||
|
||||
take: 'Take',
|
||||
done: 'Done',
|
||||
|
||||
yourMove: 'Your move',
|
||||
yourDefence: 'Beat it, or take',
|
||||
addMore: 'Add cards, or say done',
|
||||
opponentThinking: 'Opponent is thinking',
|
||||
opponentTook: 'Opponent takes the cards',
|
||||
youTook: 'You take the cards',
|
||||
|
||||
trumpIs: 'Trump',
|
||||
deckLeft: 'Deck',
|
||||
opponentHand: 'Opponent',
|
||||
|
||||
wonTitle: 'You win',
|
||||
lostTitle: 'You are the fool',
|
||||
drawTitle: 'A draw',
|
||||
wonBody: 'Your opponent was left holding the cards.',
|
||||
lostBody: 'You were left holding the cards.',
|
||||
drawBody: 'You both ran out at the same time.',
|
||||
|
||||
cannotPlayThat: 'You cannot play that card',
|
||||
} as const;
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "672ddd76-ded7-498e-97b1-df2d7d30f662",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
import { Color } from 'cc';
|
||||
|
||||
/**
|
||||
* Shared visual constants. Anything a layout or a colour is tuned by lives here
|
||||
* rather than being typed into each scene, so a change lands everywhere at once
|
||||
* and the scene files stay free of magic numbers.
|
||||
*
|
||||
* Lengths are in design units — the screen is always exactly 1080 wide, see
|
||||
* docs/DECISIONS.md.
|
||||
*/
|
||||
export const Layout = {
|
||||
designWidth: 1080,
|
||||
designHeight: 1920,
|
||||
|
||||
/** Card sprite size, matching what scripts/build-art.mjs produces. */
|
||||
cardWidth: 220,
|
||||
cardHeight: 320,
|
||||
|
||||
/** Cards on the table are drawn smaller so six pairs fit comfortably. */
|
||||
tableCardScale: 0.62,
|
||||
/** The opponent's hand is smaller again — it is only ever card backs. */
|
||||
opponentCardScale: 0.5,
|
||||
|
||||
/** Horizontal step between neighbouring cards in the player's hand. */
|
||||
handStep: 128,
|
||||
/** Never let a hand grow wider than this; the step shrinks instead. */
|
||||
handMaxWidth: 940,
|
||||
/** How far the tapped card lifts out of the hand. */
|
||||
handLift: 48,
|
||||
|
||||
/** Offset of a beating card from the card it beats. */
|
||||
beatOffset: { x: 26, y: -34 },
|
||||
|
||||
/** Comfortable minimum for anything tappable, per docs/UI.md. */
|
||||
minTapSize: 120,
|
||||
|
||||
screenMargin: 40,
|
||||
|
||||
/**
|
||||
* Where things sit on the table, in canvas coordinates (origin at the
|
||||
* centre, y up). Vertical positions stay well inside the 1080×1920 design
|
||||
* area so that a 4:3 screen — which crops the top and bottom — still shows
|
||||
* every one of them. See docs/DECISIONS.md.
|
||||
*/
|
||||
region: {
|
||||
opponentHandY: 600,
|
||||
opponentLabelY: 770,
|
||||
deck: { x: -390, y: 150 },
|
||||
trump: { x: -300, y: 120 },
|
||||
discard: { x: 430, y: 150 },
|
||||
/** Centre of the first table row; the second row sits a row-height below. */
|
||||
tableTopY: -20,
|
||||
tableRowStep: 235,
|
||||
tableColumnStep: 180,
|
||||
messageY: 330,
|
||||
actionBarY: -430,
|
||||
playerHandY: -700,
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const Palette = {
|
||||
gold: new Color(244, 194, 69, 255),
|
||||
cream: new Color(247, 240, 222, 255),
|
||||
dim: new Color(174, 196, 182, 255),
|
||||
good: new Color(126, 217, 140, 255),
|
||||
bad: new Color(232, 116, 104, 255),
|
||||
shade: new Color(0, 0, 0, 170),
|
||||
} as const;
|
||||
|
||||
/** How long the standard card movements take, in seconds. */
|
||||
export const Timing = {
|
||||
deal: 0.28,
|
||||
dealStagger: 0.06,
|
||||
play: 0.22,
|
||||
collect: 0.3,
|
||||
flip: 0.16,
|
||||
/** Pause before the bot acts, so its moves can be followed. */
|
||||
botThinking: 0.55,
|
||||
/** Pause after a turn resolves, before the next one starts. */
|
||||
turnBreak: 0.4,
|
||||
} as const;
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"ver": "4.0.24",
|
||||
"importer": "typescript",
|
||||
"imported": true,
|
||||
"uuid": "3ba498f9-9dcb-48dc-bb1d-1de46602c43a",
|
||||
"files": [],
|
||||
"subMetas": {},
|
||||
"userData": {}
|
||||
}
|
||||
Reference in New Issue
Block a user