refactor: update api

This commit is contained in:
2026-04-06 11:31:51 +08:00
parent 0e7aaea7da
commit fa104d10f2
12 changed files with 165 additions and 229 deletions
+3 -3
View File
@@ -2,7 +2,7 @@ import Phaser from 'phaser';
import type {TicTacToeState, TicTacToePart} from '@/game/tic-tac-toe';
import { GameHostScene } from 'boardgame-phaser';
import { spawnEffect, type Spawner } from 'boardgame-phaser';
import {commands} from "@/game/tic-tac-toe";
import {prompts} from "@/game/tic-tac-toe";
const CELL_SIZE = 120;
const BOARD_OFFSET = { x: 100, y: 100 };
@@ -61,7 +61,7 @@ export class GameScene extends GameHostScene<TicTacToeState> {
if (this.state.winner) return;
if (this.isCellOccupied(row, col)) return;
const cmd = commands.play(this.state.currentPlayer, row, col);
const cmd = prompts.play(this.state.currentPlayer, row, col);
const error = this.gameHost.onInput(cmd);
if (error) {
console.warn('Invalid move:', error);
@@ -133,7 +133,7 @@ export class GameScene extends GameHostScene<TicTacToeState> {
).setInteractive({ useHandCursor: true });
bg.on('pointerdown', () => {
this.gameHost.setup('setup');
this.gameHost.start();
});
this.winnerOverlay.add(bg);