diff --git a/client/src/composables/engine/gameState.ts b/client/src/composables/engine/gameState.ts new file mode 100644 index 0000000..17b64d1 --- /dev/null +++ b/client/src/composables/engine/gameState.ts @@ -0,0 +1,37 @@ +import { EngineContext } from '@/composables/useEngine' +import { useUserinfoStore } from "@/stores/UserinfoStore" + +export async function collectQuotes(this: EngineContext): Promise { + const userInfoStore = useUserinfoStore() + await this.callApi('/api/collectQuotes', { + g: userInfoStore.gameId, + }) +} + +export async function startGame(this: EngineContext): Promise { + const userInfoStore = useUserinfoStore() + await this.callApi('/api/startGame', { + g: userInfoStore.gameId, + }) +} + +export async function continueGame(this: EngineContext): Promise { + const userInfoStore = useUserinfoStore() + await this.callApi('/api/continueGame', { + g: userInfoStore.gameId, + }) +} + +export async function resetGame(this: EngineContext): Promise { + const userInfoStore = useUserinfoStore() + await this.callApi('/api/resetGame', { + g: userInfoStore.gameId, + }) +} + +export async function finishGame(this: EngineContext): Promise { + const userInfoStore = useUserinfoStore() + await this.callApi('/api/finishGame', { + g: userInfoStore.gameId, + }) +} diff --git a/client/src/composables/engine/gamemaster.ts b/client/src/composables/engine/gamemaster.ts index 5ff0f9a..34c2528 100644 --- a/client/src/composables/engine/gamemaster.ts +++ b/client/src/composables/engine/gamemaster.ts @@ -2,41 +2,6 @@ import { EngineContext } from '@/composables/useEngine' import type { GameInfo, PlayerEdit } from '@/composables/engine.d' import { useUserinfoStore } from "@/stores/UserinfoStore" -export async function collectQuotes(this: EngineContext): Promise { - const userInfoStore = useUserinfoStore() - await this.callApi('/api/collectQuotes', { - g: userInfoStore.gameId, - }) -} - -export async function startGame(this: EngineContext): Promise { - const userInfoStore = useUserinfoStore() - await this.callApi('/api/startGame', { - g: userInfoStore.gameId, - }) -} - -export async function continueGame(this: EngineContext): Promise { - const userInfoStore = useUserinfoStore() - await this.callApi('/api/continueGame', { - g: userInfoStore.gameId, - }) -} - -export async function resetGame(this: EngineContext): Promise { - const userInfoStore = useUserinfoStore() - await this.callApi('/api/resetGame', { - g: userInfoStore.gameId, - }) -} - -export async function finishGame(this: EngineContext): Promise { - const userInfoStore = useUserinfoStore() - await this.callApi('/api/finishGame', { - g: userInfoStore.gameId, - }) -} - export async function fetchGameInfo(this: EngineContext): Promise { const userInfoStore = useUserinfoStore() return await this.callApi('/api/gameinfo', { diff --git a/client/src/composables/useEngine.ts b/client/src/composables/useEngine.ts index c976b0a..2132538 100644 --- a/client/src/composables/useEngine.ts +++ b/client/src/composables/useEngine.ts @@ -3,7 +3,8 @@ import { callApi, QueryParams } from '@/composables/engine/callApi' import { start, stop } from '@/composables/engine/startStop' import { fetchUpdate } from '@/composables/engine/fetchUpdate' import { loadQuotes, getQuotesRef, deleteQuote, saveQuote } from '@/composables/engine/quotes' -import { collectQuotes, startGame, continueGame, resetGame, finishGame, fetchGameInfo, setGameLang, setGameName, savePlayer, deletePlayer } from '@/composables/engine/gamemaster' +import { fetchGameInfo, setGameLang, setGameName, savePlayer, deletePlayer } from '@/composables/engine/gamemaster' +import { collectQuotes, startGame, continueGame, resetGame, finishGame } from '@/composables/engine/gameState' import { saveSelection } from '@/composables/engine/play' import type { Quotes, GameInfo, PlayerEdit } from '@/composables/engine.d'