quit game and clear interval
This commit is contained in:
parent
5886f9413b
commit
8be14ac546
@ -19,9 +19,10 @@
|
|||||||
"key": "^0.1.11",
|
"key": "^0.1.11",
|
||||||
"keymaster": "^1.6.2",
|
"keymaster": "^1.6.2",
|
||||||
"lodash": "^4.17.11",
|
"lodash": "^4.17.11",
|
||||||
|
"parcel": "^1.9.7",
|
||||||
|
"phaser": "^3.15.1",
|
||||||
"preact": "^8.3.1",
|
"preact": "^8.3.1",
|
||||||
"preact-redux": "^2.0.3",
|
"preact-redux": "^2.0.3",
|
||||||
"parcel": "^1.9.7",
|
|
||||||
"redux": "^4.0.0"
|
"redux": "^4.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@ -11,7 +11,13 @@ const GameContainer = require('./game.container');
|
|||||||
|
|
||||||
const addState = connect(
|
const addState = connect(
|
||||||
function receiveState(state) {
|
function receiveState(state) {
|
||||||
const {game} = state;
|
const { game, ws } = state;
|
||||||
|
|
||||||
|
if (!game) {
|
||||||
|
console.log('out of game');
|
||||||
|
ws.clearGameStateInterval();
|
||||||
|
}
|
||||||
|
|
||||||
return { game };
|
return { game };
|
||||||
},
|
},
|
||||||
function receiveDispatch(dispatch) {
|
function receiveDispatch(dispatch) {
|
||||||
|
|||||||
@ -151,6 +151,14 @@ function createSocket(store) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// -------------
|
||||||
|
// Events
|
||||||
|
// -------------
|
||||||
|
|
||||||
|
function clearGameStateInterval() {
|
||||||
|
clearInterval(gameStateTimeout);
|
||||||
|
}
|
||||||
|
|
||||||
// -------------
|
// -------------
|
||||||
// Handling
|
// Handling
|
||||||
// -------------
|
// -------------
|
||||||
@ -182,6 +190,7 @@ function createSocket(store) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
clearGameStateInterval,
|
||||||
sendAccountLogin,
|
sendAccountLogin,
|
||||||
sendAccountRegister,
|
sendAccountRegister,
|
||||||
sendGameState,
|
sendGameState,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user