Commit Graph

105 Commits

Author SHA1 Message Date
hypercross 82df3f2a2f docs: update game patterns documentation 2026-04-19 13:10:09 +08:00
hypercross 4d34f9fa78 refactor(framework): use callback instead of events in
dragDropEventEffect

Replace Phaser event emissions with a `DragDropCallback` in
`dragDropEventEffect` to provide a more explicit and type-safe API
for handling drag-and-drop interactions.
2026-04-19 13:04:53 +08:00
hypercross c25759d147 refactor(onitama): extract tweens into factory functions
Centralize Onitama animation logic by moving inline Phaser tweens
into a dedicated `tweens.ts` configuration file. This improves
reusability and cleans up spawners and renderers.

Also updated documentation to warn against adding interruptions to
looped tweens to prevent game logic hangs.
2026-04-19 12:45:05 +08:00
hypercross 3568d99e6e fix(onitama): prevent game hang by removing tween interruptions
Remove tween interruptions from the selection fade-in and pulse
animations to prevent the game state from stopping indefinitely.
2026-04-19 12:29:17 +08:00
hypercross b28da1cad3 refactor(onitama): decouple rendering logic into dedicated renderers
Introduces a centralized configuration system and extracts visual
creation logic from spawners into specialized renderer classes:
- CardRenderer
- HighlightRenderer
- PawnRenderer
- SelectionRenderer

This refactor improves separation of concerns by moving Phaser-specific
drawing and animation code out of the spawner/container logic and into
reusable renderer components.
2026-04-19 11:55:18 +08:00
hypercross c7ef992082 refactor(onitama-game): simplify GameUI initialization 2026-04-19 11:31:03 +08:00
hypercross 3afe78f54f refactor(framework): allow string ID for GameUI container
Update GameUIOptions to accept either an HTMLElement or a string ID.
If a string is provided, the class will attempt to find the element
by ID or create a new div if it does not exist. Also update the root
property to accept a JSX.Element.
2026-04-19 11:30:14 +08:00
hypercross 762ed1a63a docs: rename OnitamaGamePatterns.md to GamePatterns.md 2026-04-19 11:20:49 +08:00
hypercross b0e74a5257 refactor(framework): simplify spawner state management
Consolidate object and data tracking into a single Map in `spawnEffect`
to improve clarity and reduce redundant lookups. Also switch to
type-only
imports for Phaser.
2026-04-19 11:00:01 +08:00
hypercross 648e801dad Style: enforce 2-space indent and double quotes 2026-04-19 10:48:32 +08:00
hypercross ddc9d057fd Chore: Add ESLint configuration and lint scripts 2026-04-19 10:39:01 +08:00
hypercross e14e41461f Fix drag race condition and stale pointer events
Mark items as dragging before updating inventory state to prevent
the spawner from destroying containers mid-drag. Move inventory
removal to drop time for lost items, and add guards to ignore
stale pointer events on inactive containers.
2026-04-19 00:43:43 +08:00
hypercross 5af7140958 Refactor inventory to use Spawner pattern
Replace manual ItemRenderer with InventoryItemSpawner and
GridBackgroundRenderer. Uses spawnEffect to automatically sync item
visuals with game state changes. Separates static grid rendering and
tracks dragged items to prevent spawner conflicts.
2026-04-19 00:24:20 +08:00
hypercross a7095c37fc Refactor inventory drag to use dragDropEventEffect
Replace manual pointer event handling with the framework's
dragDropEventEffect utility. Update DragController to manage
DisposableBag for cleanup and pass containers instead of
pointers to drag callbacks. Add framework path alias to
tsconfig and fix loop variable shadowing in LostItemManager.
2026-04-19 00:12:56 +08:00
hypercross 88d0c5bf55 Refactor: centralize config and split inventory
Move magic numbers and style constants to src/config.ts.
Decompose InventoryWidget into DragController, ItemRenderer,
and LostItemManager for better separation of concerns. Add
createButton utility and remove unused CombatUnitWidget.
Update scenes to import from centralized config.
2026-04-19 00:01:25 +08:00
hypercross d993d55576 Refactor dnd utility and add drag lifecycle events
Attach pointerup and pointermove listeners to scene.input
for reliable tracking. Emit dragstart, dragmove, and
dragend events alongside drag. Rename relativeX/Y to
deltaX/Y in DragDropEvent and integrate DisposableBag.
2026-04-18 23:33:13 +08:00
hypercross eefcef861a Add game architecture patterns documentation
Document layered architecture, spawner patterns, reactive
UI state, and tween interruption for framework users.
Includes best practices and common pitfalls to avoid.
docs: add architecture patterns documentation

Provide a reference guide for implementing board games with the
framework. Covers layered architecture, reactive scenes, spawner
patterns, UI state management, and common development pitfalls.
2026-04-18 23:32:02 +08:00
hypercross 23575dd516 feat: dnd 2026-04-17 21:55:14 +08:00
hypercross 0ecef16a4a fix: inventory interaction 2026-04-17 19:45:34 +08:00
hypercross 28a2623bd1 feat: adding widgets to the game 2026-04-17 18:08:51 +08:00
hypercross f7a6154c68 refactor: update to new version 2026-04-17 17:29:13 +08:00
hypercross 706de4e33a fix: inventory preview not actually there 2026-04-14 15:48:47 +08:00
hypercross 5342f1c09d feat: inventory preview? 2026-04-14 15:22:22 +08:00
hypercross 3ca2a16e29 refactor: global state for scenes 2026-04-14 14:21:51 +08:00
hypercross 7fb9edcbf0 feat: add game process scene 2026-04-14 13:51:11 +08:00
hypercross 65684e6cf5 refactor: udpate to new design 2026-04-14 13:04:34 +08:00
hypercross c9acb7f228 refactor: scene control 2026-04-14 11:10:14 +08:00
hypercross c639218b53 refactor: viewr 2026-04-13 14:57:00 +08:00
hypercross e91e8d2ab7 feat: sts-like-viewer 2026-04-13 12:38:41 +08:00
hyper 02d2f45da2 refactor: fix onitama sizing 2026-04-12 19:24:47 +08:00
hyper e5b53c6332 refactor: fix onitama api usage 2026-04-12 19:09:41 +08:00
hyper ecfa89e383 fix: boop supply 2026-04-12 18:55:35 +08:00
hyper 8bd790db67 refactor: boop sizing 2026-04-12 18:54:18 +08:00
hyper 93587541ce refactor: boop to use new api 2026-04-12 18:47:04 +08:00
hyper cc80cbad06 fix: fading 2026-04-12 18:18:45 +08:00
hyper 6584578316 fix: overlay init 2026-04-12 18:11:23 +08:00
hyper f6f18b4789 fix: wait for fade scene init 2026-04-12 18:02:10 +08:00
hyper 70334fa9e3 refactor: wait to launch scene 2026-04-12 18:00:08 +08:00
hyper fbf3f5e636 refactor:refactor: improve ttt 2026-04-12 17:54:46 +08:00
hyper 9ab7ae3e60 refactor: improved scene manager 2026-04-12 17:52:44 +08:00
hyper fe57583a8f refactor: api 2026-04-12 17:34:25 +08:00
hyper 713a14c128 refactor: simplify scene routing 2026-04-12 17:21:49 +08:00
hyper 50531446c2 feat: scene manager and transitions 2026-04-12 16:52:53 +08:00
hyper f8a19653ba refactor: details 2026-04-12 16:31:10 +08:00
hyper 59fa0e6122 refactor: ReactiveScene 2026-04-12 16:26:52 +08:00
hyper 21a7afa276 chore: fix vite config 2026-04-12 15:02:23 +08:00
hypercross 71ccb8732e refactor: some manual changes 2026-04-08 14:21:33 +08:00
hypercross 92e1a5bec1 feat: rotation and more 2026-04-08 11:49:25 +08:00
hypercross 3e064f437b feat: add more tweens 2026-04-08 11:33:59 +08:00
hypercross 00fd395873 fix: more issues with ui 2026-04-08 11:06:34 +08:00