puzzle/server/Game.js

24 lines
546 B
JavaScript
Raw Normal View History

2020-11-12 19:19:02 +01:00
import { createPuzzle } from './Puzzle.js'
2020-11-17 22:34:15 +01:00
import GameCommon from './../common/GameCommon.js'
2020-11-12 19:19:02 +01:00
async function createGame(gameId, targetTiles, image) {
2020-11-17 22:34:15 +01:00
const game = {
2020-11-12 19:19:02 +01:00
puzzle: await createPuzzle(targetTiles, image),
players: {},
sockets: [],
evtInfos: {},
}
2020-11-17 22:34:15 +01:00
GameCommon.setGame(gameId, game)
2020-11-12 19:19:02 +01:00
}
export default {
createGame,
2020-11-17 22:34:15 +01:00
exists: GameCommon.exists,
addPlayer: GameCommon.addPlayer,
addSocket: GameCommon.addSocket,
get: GameCommon.get,
getSockets: GameCommon.getSockets,
handleInput: GameCommon.handleInput,
2020-11-12 19:19:02 +01:00
}