spawning constructs (no mtx yet)

This commit is contained in:
Mashy
2019-07-26 21:22:11 +10:00
parent b72c819c63
commit abd35b8bef
4 changed files with 27 additions and 2 deletions
+1 -1
View File
@@ -64,7 +64,7 @@ function Team(args) {
return setTeam(team);
}
const constructPanels = constructs.sort(idSort).map(construct => {
const constructPanels = constructs.map(construct => {
const colour = team.indexOf(construct.id);
const selected = colour > -1;
+8
View File
@@ -34,6 +34,13 @@ function registerEvents(store) {
setNav('list');
}
function setNewConstruct(construct) {
const { constructs } = store.getState();
constructs.push(construct);
store.dispatch(actions.setConstructs(constructs));
}
function setInstanceList(list) {
store.dispatch(actions.setInstanceList(list));
}
@@ -226,6 +233,7 @@ function registerEvents(store) {
setActiveItem,
setActiveSkill,
setConstructList,
setNewConstruct,
setGame,
setInstance,
setInstanceList,
+10
View File
@@ -46,6 +46,10 @@ function createSocket(events) {
send(['AccountInstances', {}]);
}
function sendConstructSpawn() {
send(['MtxConstructBuy', {}]);
}
function sendGameState(id) {
send(['GameState', { id }]);
}
@@ -150,6 +154,10 @@ function createSocket(events) {
events.setConstructList(constructs);
}
function onConstructSpawn(construct) {
events.setNewConstruct(construct);
}
function onGameState(game) {
events.setGame(game);
}
@@ -183,6 +191,7 @@ function createSocket(events) {
AccountConstructs: onAccountConstructs,
AccountInstances: onAccountInstances,
AccountShop: onAccountShop,
ConstructSpawn: onConstructSpawn,
GameState: onGameState,
InstanceState: onInstanceState,
ItemInfo: onItemInfo,
@@ -272,6 +281,7 @@ function createSocket(events) {
return {
sendAccountConstructs,
sendAccountInstances,
sendConstructSpawn,
sendGameState,
sendGameReady,
sendGameSkill,