request account state when instance finished, remove account instances from socket
This commit is contained in:
parent
075880d5a7
commit
c82fb404d1
@ -56,7 +56,7 @@ function Collection(args) {
|
||||
teamSelect[insert] = id;
|
||||
return setTeam(teamSelect);
|
||||
}
|
||||
console.log(constructs.length);
|
||||
|
||||
const dispConstructs = constructs.length >= ((teamPage + 1) * 6)
|
||||
? constructs.slice(teamPage * 6, (teamPage + 1) * 6)
|
||||
: constructs.slice(teamPage * 6, constructs.length);
|
||||
|
||||
@ -11,8 +11,8 @@ const Bottom = require('./main.bottom');
|
||||
|
||||
const addState = connect(
|
||||
state => {
|
||||
const { game, instance, account, nav } = state;
|
||||
return { game, instance, account, nav };
|
||||
const { game, instance, account, nav, ws } = state;
|
||||
return { game, instance, account, nav, ws };
|
||||
}
|
||||
);
|
||||
|
||||
@ -22,6 +22,7 @@ function Main(props) {
|
||||
instance,
|
||||
account,
|
||||
nav,
|
||||
ws,
|
||||
} = props;
|
||||
|
||||
if (!account) {
|
||||
|
||||
@ -169,7 +169,7 @@ function registerEvents(store) {
|
||||
}
|
||||
|
||||
function setInstance(v) {
|
||||
const { account, instance } = store.getState();
|
||||
const { account, instance, ws } = store.getState();
|
||||
if (v) {
|
||||
const player = v.players.find(p => p.id === account.id);
|
||||
store.dispatch(actions.setPlayer(player));
|
||||
@ -180,7 +180,11 @@ function registerEvents(store) {
|
||||
store.dispatch(actions.setActiveConstruct(first));
|
||||
}
|
||||
}
|
||||
if (v.phase === 'Finished') setGame(null);
|
||||
if (v.phase === 'Finished') {
|
||||
setGame(null);
|
||||
ws.sendAccountState();
|
||||
}
|
||||
|
||||
return store.dispatch(actions.setInstance(v));
|
||||
}
|
||||
|
||||
|
||||
@ -43,8 +43,8 @@ function createSocket(events) {
|
||||
send(['AccountConstructs', {}]);
|
||||
}
|
||||
|
||||
function sendAccountInstances() {
|
||||
send(['AccountInstances', {}]);
|
||||
function sendAccountState() {
|
||||
send(['AccountState', {}]);
|
||||
}
|
||||
|
||||
function sendAccountSetTeam(ids) {
|
||||
@ -323,7 +323,7 @@ function createSocket(events) {
|
||||
|
||||
return {
|
||||
sendAccountConstructs,
|
||||
sendAccountInstances,
|
||||
sendAccountState,
|
||||
sendAccountSetTeam,
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user