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;
|
teamSelect[insert] = id;
|
||||||
return setTeam(teamSelect);
|
return setTeam(teamSelect);
|
||||||
}
|
}
|
||||||
console.log(constructs.length);
|
|
||||||
const dispConstructs = constructs.length >= ((teamPage + 1) * 6)
|
const dispConstructs = constructs.length >= ((teamPage + 1) * 6)
|
||||||
? constructs.slice(teamPage * 6, (teamPage + 1) * 6)
|
? constructs.slice(teamPage * 6, (teamPage + 1) * 6)
|
||||||
: constructs.slice(teamPage * 6, constructs.length);
|
: constructs.slice(teamPage * 6, constructs.length);
|
||||||
|
|||||||
@ -11,8 +11,8 @@ const Bottom = require('./main.bottom');
|
|||||||
|
|
||||||
const addState = connect(
|
const addState = connect(
|
||||||
state => {
|
state => {
|
||||||
const { game, instance, account, nav } = state;
|
const { game, instance, account, nav, ws } = state;
|
||||||
return { game, instance, account, nav };
|
return { game, instance, account, nav, ws };
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -22,6 +22,7 @@ function Main(props) {
|
|||||||
instance,
|
instance,
|
||||||
account,
|
account,
|
||||||
nav,
|
nav,
|
||||||
|
ws,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
if (!account) {
|
if (!account) {
|
||||||
|
|||||||
@ -169,7 +169,7 @@ function registerEvents(store) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setInstance(v) {
|
function setInstance(v) {
|
||||||
const { account, instance } = store.getState();
|
const { account, instance, ws } = store.getState();
|
||||||
if (v) {
|
if (v) {
|
||||||
const player = v.players.find(p => p.id === account.id);
|
const player = v.players.find(p => p.id === account.id);
|
||||||
store.dispatch(actions.setPlayer(player));
|
store.dispatch(actions.setPlayer(player));
|
||||||
@ -180,7 +180,11 @@ function registerEvents(store) {
|
|||||||
store.dispatch(actions.setActiveConstruct(first));
|
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));
|
return store.dispatch(actions.setInstance(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -43,8 +43,8 @@ function createSocket(events) {
|
|||||||
send(['AccountConstructs', {}]);
|
send(['AccountConstructs', {}]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendAccountInstances() {
|
function sendAccountState() {
|
||||||
send(['AccountInstances', {}]);
|
send(['AccountState', {}]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendAccountSetTeam(ids) {
|
function sendAccountSetTeam(ids) {
|
||||||
@ -323,7 +323,7 @@ function createSocket(events) {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
sendAccountConstructs,
|
sendAccountConstructs,
|
||||||
sendAccountInstances,
|
sendAccountState,
|
||||||
sendAccountSetTeam,
|
sendAccountSetTeam,
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user