refactor: simplify CombatTestScene instantiation in App
Remove manual instantiation of CombatTestScene in favor of passing the class directly to PhaserScene, allowing the framework to handle scene lifecycle.
This commit is contained in:
parent
887da22baa
commit
a181932fb3
|
|
@ -12,7 +12,6 @@ import { createCombatState } from "@/state/combatState";
|
|||
import type { CombatState } from "boardgame-core/samples/slay-the-spire-like";
|
||||
|
||||
export default function App() {
|
||||
const combatScene = useMemo(() => new CombatTestScene(), []);
|
||||
const gameHost = useMemo(
|
||||
() => createGameHost(createCombatState() as GameModule<CombatState>),
|
||||
[],
|
||||
|
|
@ -23,11 +22,7 @@ export default function App() {
|
|||
<div className="flex-1 flex relative justify-center items-center">
|
||||
<PhaserGame initialScene="IndexScene" config={GAME_CONFIG}>
|
||||
<PhaserScene scene={IndexScene} />
|
||||
<PhaserScene
|
||||
sceneKey="CombatTestScene"
|
||||
scene={combatScene}
|
||||
data={{ gameHost }}
|
||||
/>
|
||||
<PhaserScene scene={CombatTestScene} data={{ gameHost }} />
|
||||
<PhaserScene scene={InventoryTestScene} />
|
||||
<PhaserScene scene={MapViewerScene} />
|
||||
<PhaserScene scene={GridViewerScene} />
|
||||
|
|
|
|||
Loading…
Reference in New Issue