refactor: split engine/gamemaster.ts into gameState.ts
This commit is contained in:
parent
79d56e801f
commit
2fb3833dd8
37
client/src/composables/engine/gameState.ts
Normal file
37
client/src/composables/engine/gameState.ts
Normal file
@ -0,0 +1,37 @@
|
||||
import { EngineContext } from '@/composables/useEngine'
|
||||
import { useUserinfoStore } from "@/stores/UserinfoStore"
|
||||
|
||||
export async function collectQuotes(this: EngineContext): Promise<void> {
|
||||
const userInfoStore = useUserinfoStore()
|
||||
await this.callApi('/api/collectQuotes', {
|
||||
g: userInfoStore.gameId,
|
||||
})
|
||||
}
|
||||
|
||||
export async function startGame(this: EngineContext): Promise<void> {
|
||||
const userInfoStore = useUserinfoStore()
|
||||
await this.callApi('/api/startGame', {
|
||||
g: userInfoStore.gameId,
|
||||
})
|
||||
}
|
||||
|
||||
export async function continueGame(this: EngineContext): Promise<void> {
|
||||
const userInfoStore = useUserinfoStore()
|
||||
await this.callApi('/api/continueGame', {
|
||||
g: userInfoStore.gameId,
|
||||
})
|
||||
}
|
||||
|
||||
export async function resetGame(this: EngineContext): Promise<void> {
|
||||
const userInfoStore = useUserinfoStore()
|
||||
await this.callApi('/api/resetGame', {
|
||||
g: userInfoStore.gameId,
|
||||
})
|
||||
}
|
||||
|
||||
export async function finishGame(this: EngineContext): Promise<void> {
|
||||
const userInfoStore = useUserinfoStore()
|
||||
await this.callApi('/api/finishGame', {
|
||||
g: userInfoStore.gameId,
|
||||
})
|
||||
}
|
@ -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<void> {
|
||||
const userInfoStore = useUserinfoStore()
|
||||
await this.callApi('/api/collectQuotes', {
|
||||
g: userInfoStore.gameId,
|
||||
})
|
||||
}
|
||||
|
||||
export async function startGame(this: EngineContext): Promise<void> {
|
||||
const userInfoStore = useUserinfoStore()
|
||||
await this.callApi('/api/startGame', {
|
||||
g: userInfoStore.gameId,
|
||||
})
|
||||
}
|
||||
|
||||
export async function continueGame(this: EngineContext): Promise<void> {
|
||||
const userInfoStore = useUserinfoStore()
|
||||
await this.callApi('/api/continueGame', {
|
||||
g: userInfoStore.gameId,
|
||||
})
|
||||
}
|
||||
|
||||
export async function resetGame(this: EngineContext): Promise<void> {
|
||||
const userInfoStore = useUserinfoStore()
|
||||
await this.callApi('/api/resetGame', {
|
||||
g: userInfoStore.gameId,
|
||||
})
|
||||
}
|
||||
|
||||
export async function finishGame(this: EngineContext): Promise<void> {
|
||||
const userInfoStore = useUserinfoStore()
|
||||
await this.callApi('/api/finishGame', {
|
||||
g: userInfoStore.gameId,
|
||||
})
|
||||
}
|
||||
|
||||
export async function fetchGameInfo(this: EngineContext): Promise<GameInfo> {
|
||||
const userInfoStore = useUserinfoStore()
|
||||
return await this.callApi('/api/gameinfo', {
|
||||
|
@ -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'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user