team checks on delete
This commit is contained in:
parent
c2d75a0ce0
commit
02f6dffb4a
@ -103,7 +103,7 @@ function Team(args) {
|
|||||||
<h2>
|
<h2>
|
||||||
{constructDeleteId === construct.id ? 'Confirm delete...' : construct.name}
|
{constructDeleteId === construct.id ? 'Confirm delete...' : construct.name}
|
||||||
</h2>
|
</h2>
|
||||||
<button onClick={e => deleteClick(e)} >❌</button>
|
<button onClick={e => deleteClick(e)} >❌</button>
|
||||||
</div>
|
</div>
|
||||||
<ConstructAvatar name={construct.name} id={construct.id} />
|
<ConstructAvatar name={construct.name} id={construct.id} />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -9,10 +9,9 @@ function registerEvents(store) {
|
|||||||
|
|
||||||
// timeout handlers
|
// timeout handlers
|
||||||
store.subscribe(() => {
|
store.subscribe(() => {
|
||||||
const { game, instance, constructs, ws } = store.getState();
|
const { game, instance, ws } = store.getState();
|
||||||
|
|
||||||
if (!ws) return true;
|
if (!ws) return true;
|
||||||
|
|
||||||
if (!game) ws.clearGameStateTimeout();
|
if (!game) ws.clearGameStateTimeout();
|
||||||
if (!instance) ws.clearInstanceStateTimeout();
|
if (!instance) ws.clearInstanceStateTimeout();
|
||||||
});
|
});
|
||||||
@ -30,11 +29,12 @@ function registerEvents(store) {
|
|||||||
store.dispatch(actions.setNav(v));
|
store.dispatch(actions.setNav(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
function setConstructs(constructs) {
|
|
||||||
console.log('EVENT ->', 'constructs', constructs);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setConstructList(constructs) {
|
function setConstructList(constructs) {
|
||||||
|
// check team is in list
|
||||||
|
const { team } = store.getState();
|
||||||
|
const ids = constructs.map(c => c.id);
|
||||||
|
if (!team.every(t => t && ids.includes(t))) store.dispatch(actions.setTeam([null, null, null]));
|
||||||
|
|
||||||
store.dispatch(actions.setConstructs(constructs));
|
store.dispatch(actions.setConstructs(constructs));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,18 +113,6 @@ function registerEvents(store) {
|
|||||||
console.log('event clear item');
|
console.log('event clear item');
|
||||||
}
|
}
|
||||||
|
|
||||||
function setMenu() {
|
|
||||||
console.log('EVENT ->', 'menu', true);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setVbox(items) {
|
|
||||||
console.log('EVENT ->', 'vbox', items);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setScores(scores) {
|
|
||||||
console.log('EVENT ->', 'scores', scores);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setAccountInstances(v) {
|
function setAccountInstances(v) {
|
||||||
return store.dispatch(actions.setInstances(v));
|
return store.dispatch(actions.setInstances(v));
|
||||||
}
|
}
|
||||||
@ -146,18 +134,6 @@ function registerEvents(store) {
|
|||||||
return store.dispatch(actions.setInstance(v));
|
return store.dispatch(actions.setInstance(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
function setZone(zone) {
|
|
||||||
console.log('EVENT ->', 'zone', zone);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setGameList(gameList) {
|
|
||||||
console.log('EVENT ->', 'gameList', gameList);
|
|
||||||
}
|
|
||||||
|
|
||||||
function setConstructStatusUpdate(id, skill, target) {
|
|
||||||
console.log('EVENT ->', 'constructStatusUpdate', { id, skill, target });
|
|
||||||
}
|
|
||||||
|
|
||||||
function setItemInfo(v) {
|
function setItemInfo(v) {
|
||||||
return store.dispatch(actions.setItemInfo(v));
|
return store.dispatch(actions.setItemInfo(v));
|
||||||
}
|
}
|
||||||
@ -214,20 +190,14 @@ function registerEvents(store) {
|
|||||||
setAccount,
|
setAccount,
|
||||||
setActiveSkill,
|
setActiveSkill,
|
||||||
setActiveItem,
|
setActiveItem,
|
||||||
setConstructs,
|
|
||||||
setConstructList,
|
setConstructList,
|
||||||
setGame,
|
setGame,
|
||||||
clearInfo,
|
clearInfo,
|
||||||
setMenu,
|
|
||||||
setInstance,
|
setInstance,
|
||||||
setInstanceList,
|
setInstanceList,
|
||||||
setAccountInstances,
|
setAccountInstances,
|
||||||
setVbox,
|
|
||||||
setWs,
|
setWs,
|
||||||
setGameList,
|
|
||||||
setZone,
|
|
||||||
setPing,
|
setPing,
|
||||||
setScores,
|
|
||||||
setItemInfo,
|
setItemInfo,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -641,6 +641,7 @@ pub fn instance_new(params: InstanceLobbyParams, tx: &mut Transaction, account:
|
|||||||
let mut instance = match params.pve {
|
let mut instance = match params.pve {
|
||||||
true => Instance::new()
|
true => Instance::new()
|
||||||
.set_time_control(TimeControl::Practice)
|
.set_time_control(TimeControl::Practice)
|
||||||
|
.set_max_rounds(10)
|
||||||
.set_name(params.name)?
|
.set_name(params.name)?
|
||||||
.add_bots(),
|
.add_bots(),
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user