diff --git a/README.md b/README.md index 8ff605c..a2546d1 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Full words fall from the top. Type each character of the word sequentially. Multi-line sentences with perspective effect. Continue typing through line breaks. ### Paragraphs -4-line paragraphs with advanced perspective and smooth line transitions. +6-line paragraphs with advanced perspective and smooth line transitions. ## API diff --git a/example/src/App.tsx b/example/src/App.tsx index 2281075..84a6e4f 100755 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -1,14 +1,21 @@ import { useState } from "react"; -import { useGame, type GameMode } from "@vimazing/the-last-startyper"; +import { useGame, type GameMode, type GameOptions } from "@vimazing/the-last-startyper"; import "@vimazing/the-last-startyper/game.css"; import { usePlatformHook, useStateMachine, getScenario, getScenarioNames } from "./usePlatformHook"; +import { greatFallsParagraphs } from "./usePlatformHook/greatFallsContent"; function App() { - const [scenarioId, setScenarioId] = useState("progressive"); - const scenario = getScenario(scenarioId); - const [gameMode, setGameMode] = useState(scenario.initialMode); - const gameManager = useGame({ gameMode }, usePlatformHook); - const { containerRef, gameStatus, scoreManager } = gameManager; + const [scenarioId, setScenarioId] = useState("progressive"); + const scenario = getScenario(scenarioId); + const [gameMode, setGameMode] = useState(scenario.initialMode); + + const getGameOptions = (mode: GameMode): GameOptions => ({ + gameMode: mode, + ...(mode === 'paragraphs' && { wordList: greatFallsParagraphs }), + }); + + const gameManager = useGame(getGameOptions(gameMode), usePlatformHook); + const { containerRef, gameStatus, scoreManager } = gameManager; useStateMachine({ gameManager, @@ -34,12 +41,12 @@ function App() {