info hover init
This commit is contained in:
parent
911d2829bf
commit
7dc350159b
@ -3,7 +3,6 @@ export const setCryps = value => ({ type: 'SET_CRYPS', value });
|
|||||||
export const setItemInfo = value => ({ type: 'SET_ITEM_INFO', value });
|
export const setItemInfo = value => ({ type: 'SET_ITEM_INFO', value });
|
||||||
export const setSkip = value => ({ type: 'SET_SKIP', value });
|
export const setSkip = value => ({ type: 'SET_SKIP', value });
|
||||||
export const setVboxHighlight = value => ({ type: 'SET_VBOX_HIGHLIGHT', value });
|
export const setVboxHighlight = value => ({ type: 'SET_VBOX_HIGHLIGHT', value });
|
||||||
export const setVboxHidden = value => ({ type: 'SET_VBOX_HIDDEN', value });
|
|
||||||
export const setInstances = value => ({ type: 'SET_INSTANCES', value });
|
export const setInstances = value => ({ type: 'SET_INSTANCES', value });
|
||||||
export const setNav = value => ({ type: 'SET_NAV', value });
|
export const setNav = value => ({ type: 'SET_NAV', value });
|
||||||
export const setInstance = value => ({ type: 'SET_INSTANCE', value });
|
export const setInstance = value => ({ type: 'SET_INSTANCE', value });
|
||||||
|
|||||||
@ -1,26 +1,20 @@
|
|||||||
const preact = require('preact');
|
const preact = require('preact');
|
||||||
const range = require('lodash/range');
|
const range = require('lodash/range');
|
||||||
|
|
||||||
const { ITEMS: { SKILLS, COLOURS, SPECS: SPEC_CONSTANT } } = require('./../constants');
|
const { ITEMS: { SPECS: SPEC_CONSTANT } } = require('./../constants');
|
||||||
const { COLOUR_ICONS, STATS, SPECS, convertItem, crypAvatar } = require('../utils');
|
const { COLOUR_ICONS, convertItem } = require('../utils');
|
||||||
const shapes = require('./shapes');
|
|
||||||
|
|
||||||
function Info(args) {
|
function Info(args) {
|
||||||
const {
|
const {
|
||||||
activeCryp,
|
|
||||||
|
|
||||||
info,
|
info,
|
||||||
infoCryp,
|
|
||||||
itemInfo,
|
itemInfo,
|
||||||
|
|
||||||
combiner,
|
combiner,
|
||||||
sendUnequip,
|
|
||||||
instance,
|
instance,
|
||||||
player,
|
player,
|
||||||
vboxHidden,
|
|
||||||
} = args;
|
} = args;
|
||||||
|
|
||||||
function CrypItem() {
|
function Info() {
|
||||||
if (!info) return false;
|
if (!info) return false;
|
||||||
const fullInfo = itemInfo.items.find(i => i.item === info);
|
const fullInfo = itemInfo.items.find(i => i.item === info);
|
||||||
if (!fullInfo) return false;
|
if (!fullInfo) return false;
|
||||||
@ -37,16 +31,11 @@ function Info(args) {
|
|||||||
});
|
});
|
||||||
const teamColours = { red, blue, green };
|
const teamColours = { red, blue, green };
|
||||||
|
|
||||||
const unequipBtn = activeCryp
|
|
||||||
? <button onClick={() => sendUnequip(activeCryp.id, info)}>unequip</button>
|
|
||||||
: null;
|
|
||||||
|
|
||||||
if (isSkill) {
|
if (isSkill) {
|
||||||
return (
|
return (
|
||||||
<div className="info-skill">
|
<div className="info-skill">
|
||||||
<div>{fullInfo.item}</div>
|
<div>{fullInfo.item}</div>
|
||||||
<div>{fullInfo.description}</div>
|
<div>{fullInfo.description}</div>
|
||||||
{unequipBtn}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -89,7 +78,6 @@ function Info(args) {
|
|||||||
<div className="thresholds">
|
<div className="thresholds">
|
||||||
{thresholdEl}
|
{thresholdEl}
|
||||||
</div>
|
</div>
|
||||||
{unequipBtn}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -123,7 +111,7 @@ function Info(args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function ScoreBoard() {
|
function ScoreBoard() {
|
||||||
if (activeCryp || info[0]) return null;
|
if (info[0]) return null;
|
||||||
|
|
||||||
const players = instance.players.map((p, i) => {
|
const players = instance.players.map((p, i) => {
|
||||||
const pText = playerText(p);
|
const pText = playerText(p);
|
||||||
@ -148,7 +136,6 @@ function Info(args) {
|
|||||||
|
|
||||||
function Combos() {
|
function Combos() {
|
||||||
if (info) return false;
|
if (info) return false;
|
||||||
if (activeCryp) return false;
|
|
||||||
if (!player) return false;
|
if (!player) return false;
|
||||||
|
|
||||||
if (!(combiner.every(u => u === null))) {
|
if (!(combiner.every(u => u === null))) {
|
||||||
@ -189,11 +176,9 @@ function Info(args) {
|
|||||||
// ? <h2>game beginning...</h2>
|
// ? <h2>game beginning...</h2>
|
||||||
// : null;
|
// : null;
|
||||||
|
|
||||||
const classes = `info ${vboxHidden ? '' : 'hidden'}`;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={classes} >
|
<div className='info' >
|
||||||
<CrypItem />
|
<Info />
|
||||||
<Combos />
|
<Combos />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -6,29 +6,21 @@ const Info = require('./info.component');
|
|||||||
const addState = connect(
|
const addState = connect(
|
||||||
function receiveState(state) {
|
function receiveState(state) {
|
||||||
const {
|
const {
|
||||||
activeCryp,
|
ws,
|
||||||
combiner,
|
combiner,
|
||||||
info,
|
info,
|
||||||
ws,
|
|
||||||
instance,
|
|
||||||
itemInfo,
|
itemInfo,
|
||||||
vboxHidden,
|
instance,
|
||||||
player,
|
player,
|
||||||
} = state;
|
} = state;
|
||||||
|
|
||||||
function sendUnequip(crypId, item) {
|
|
||||||
return ws.sendVboxUnequip(instance.id, crypId, item);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
activeCryp,
|
ws,
|
||||||
info,
|
|
||||||
combiner,
|
combiner,
|
||||||
sendUnequip,
|
info,
|
||||||
|
itemInfo,
|
||||||
instance,
|
instance,
|
||||||
player,
|
player,
|
||||||
itemInfo,
|
|
||||||
vboxHidden,
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,15 +1,41 @@
|
|||||||
const preact = require('preact');
|
const preact = require('preact');
|
||||||
|
const { connect } = require('preact-redux');
|
||||||
|
|
||||||
const VboxContainer = require('./vbox.container');
|
const Vbox = require('./vbox.component');
|
||||||
const InfoContainer = require('./info.container');
|
const InfoContainer = require('./info.container');
|
||||||
const InstanceCrypsContainer = require('./instance.cryps');
|
const InstanceCrypsContainer = require('./instance.cryps');
|
||||||
const EquipmentContainer = require('./instance.equip');
|
const EquipmentContainer = require('./instance.equip');
|
||||||
|
|
||||||
function InstanceComponent(args) {
|
const actions = require('../actions');
|
||||||
|
|
||||||
|
const addState = connect(
|
||||||
|
function receiveState(state) {
|
||||||
|
const { ws, instance, player } = state;
|
||||||
|
|
||||||
|
function sendInstanceReady() {
|
||||||
|
return ws.sendInstanceReady(instance.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return { instance, player, sendInstanceReady };
|
||||||
|
},
|
||||||
|
|
||||||
|
function receiveDispatch(dispatch) {
|
||||||
|
function setInfo(c) {
|
||||||
|
return dispatch(actions.setInfo(c));
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
setInfo,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
function Instance(args) {
|
||||||
const {
|
const {
|
||||||
instance,
|
instance,
|
||||||
player,
|
player,
|
||||||
sendInstanceReady,
|
sendInstanceReady,
|
||||||
|
setInfo,
|
||||||
} = args;
|
} = args;
|
||||||
|
|
||||||
if (!instance) return false;
|
if (!instance) return false;
|
||||||
@ -44,7 +70,7 @@ function InstanceComponent(args) {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main className="instance" >
|
<main className="instance" onMouseOver={() => setInfo(null)} >
|
||||||
<div className="top">
|
<div className="top">
|
||||||
{actionBtn}
|
{actionBtn}
|
||||||
{timer}
|
{timer}
|
||||||
@ -52,7 +78,7 @@ function InstanceComponent(args) {
|
|||||||
|
|
||||||
<input type="checkbox" id="toggle-vbox"/>
|
<input type="checkbox" id="toggle-vbox"/>
|
||||||
<label id="toggle-vbox-label" htmlFor="toggle-vbox"> </label>
|
<label id="toggle-vbox-label" htmlFor="toggle-vbox"> </label>
|
||||||
<VboxContainer />
|
<Vbox />
|
||||||
<InfoContainer />
|
<InfoContainer />
|
||||||
<EquipmentContainer />
|
<EquipmentContainer />
|
||||||
<InstanceCrypsContainer />
|
<InstanceCrypsContainer />
|
||||||
@ -60,4 +86,4 @@ function InstanceComponent(args) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = InstanceComponent;
|
module.exports = addState(Instance);
|
||||||
|
|||||||
@ -14,6 +14,16 @@ const addState = connect(
|
|||||||
|
|
||||||
return { instance, player, sendInstanceReady };
|
return { instance, player, sendInstanceReady };
|
||||||
},
|
},
|
||||||
|
|
||||||
|
function receiveDispatch(dispatch) {
|
||||||
|
function setInfo(c) {
|
||||||
|
return dispatch(actions.setInfo(c));
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
setInfo,
|
||||||
|
};
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
module.exports = addState(Instance);
|
module.exports = addState(Instance);
|
||||||
|
|||||||
@ -8,7 +8,7 @@ const actions = require('../actions');
|
|||||||
|
|
||||||
const addState = connect(
|
const addState = connect(
|
||||||
function receiveState(state) {
|
function receiveState(state) {
|
||||||
const { ws, instance, player, account, vboxHidden, itemInfo, itemEquip, activeCryp } = state;
|
const { ws, instance, player, account, itemInfo, itemEquip, activeCryp } = state;
|
||||||
|
|
||||||
function sendInstanceReady() {
|
function sendInstanceReady() {
|
||||||
return ws.sendInstanceReady(instance.id);
|
return ws.sendInstanceReady(instance.id);
|
||||||
@ -18,7 +18,7 @@ const addState = connect(
|
|||||||
return ws.sendVboxApply(instance.id, crypId, i);
|
return ws.sendVboxApply(instance.id, crypId, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
return { instance, player, account, sendInstanceReady, sendVboxApply, vboxHidden, itemInfo, itemEquip, activeCryp };
|
return { instance, player, account, sendInstanceReady, sendVboxApply, itemInfo, itemEquip, activeCryp };
|
||||||
},
|
},
|
||||||
|
|
||||||
function receiveDispatch(dispatch) {
|
function receiveDispatch(dispatch) {
|
||||||
@ -196,7 +196,6 @@ function InstanceCryps(props) {
|
|||||||
setActiveCryp,
|
setActiveCryp,
|
||||||
|
|
||||||
sendVboxApply,
|
sendVboxApply,
|
||||||
vboxHidden,
|
|
||||||
itemInfo,
|
itemInfo,
|
||||||
setVboxHighlight,
|
setVboxHighlight,
|
||||||
setItemUnequip,
|
setItemUnequip,
|
||||||
@ -220,7 +219,7 @@ function InstanceCryps(props) {
|
|||||||
setVboxHighlight,
|
setVboxHighlight,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const classes = `cryp-list ${vboxHidden ? '' : 'hidden'}`;
|
const classes = `cryp-list`;
|
||||||
return (
|
return (
|
||||||
<div className={classes} onClick={() => setActiveCryp(null)}>
|
<div className={classes} onClick={() => setActiveCryp(null)}>
|
||||||
{cryps}
|
{cryps}
|
||||||
|
|||||||
@ -4,7 +4,7 @@ const { connect } = require('preact-redux');
|
|||||||
|
|
||||||
const LoginContainer = require('./login.container');
|
const LoginContainer = require('./login.container');
|
||||||
const GameContainer = require('./game.container');
|
const GameContainer = require('./game.container');
|
||||||
const InstanceContainer = require('./instance.container');
|
const Instance = require('./instance.component');
|
||||||
const Team = require('./team');
|
const Team = require('./team');
|
||||||
const List = require('./list');
|
const List = require('./list');
|
||||||
|
|
||||||
@ -32,7 +32,6 @@ function Main(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (game) {
|
if (game) {
|
||||||
console.log('game time');
|
|
||||||
return (
|
return (
|
||||||
<GameContainer />
|
<GameContainer />
|
||||||
);
|
);
|
||||||
@ -40,7 +39,7 @@ function Main(props) {
|
|||||||
|
|
||||||
if (instance) {
|
if (instance) {
|
||||||
return (
|
return (
|
||||||
<InstanceContainer />
|
<Instance />
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,32 +1,98 @@
|
|||||||
const preact = require('preact');
|
const preact = require('preact');
|
||||||
const range = require('lodash/range');
|
const range = require('lodash/range');
|
||||||
|
const { connect } = require('preact-redux');
|
||||||
|
|
||||||
const shapes = require('./shapes');
|
const shapes = require('./shapes');
|
||||||
|
|
||||||
const { convertItem } = require('./../utils');
|
const { convertItem } = require('./../utils');
|
||||||
|
const actions = require('../actions');
|
||||||
|
|
||||||
|
const addState = connect(
|
||||||
|
function receiveState(state) {
|
||||||
|
const {
|
||||||
|
ws,
|
||||||
|
instance,
|
||||||
|
player,
|
||||||
|
combiner,
|
||||||
|
reclaiming,
|
||||||
|
vboxHighlight,
|
||||||
|
itemInfo,
|
||||||
|
} = state;
|
||||||
|
|
||||||
|
function sendVboxDiscard() {
|
||||||
|
return ws.sendVboxDiscard(instance.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendVboxAccept(group, index) {
|
||||||
|
return ws.sendVboxAccept(instance.id, group, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendVboxCombine() {
|
||||||
|
return ws.sendVboxCombine(instance.id, combiner);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendVboxReclaim(i) {
|
||||||
|
return ws.sendVboxReclaim(instance.id, i);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return {
|
||||||
|
combiner,
|
||||||
|
instance,
|
||||||
|
player,
|
||||||
|
reclaiming,
|
||||||
|
sendVboxAccept,
|
||||||
|
sendVboxCombine,
|
||||||
|
sendVboxDiscard,
|
||||||
|
sendVboxReclaim,
|
||||||
|
vboxHighlight,
|
||||||
|
itemInfo,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
function receiveDispatch(dispatch) {
|
||||||
|
function setCombiner(c) {
|
||||||
|
return dispatch(actions.setCombiner(c));
|
||||||
|
}
|
||||||
|
|
||||||
|
function setReclaiming(v) {
|
||||||
|
return dispatch(actions.setReclaiming(v));
|
||||||
|
}
|
||||||
|
|
||||||
|
function setInfo(item) {
|
||||||
|
return dispatch(actions.setInfo(item));
|
||||||
|
}
|
||||||
|
|
||||||
|
function setVboxHighlight(v) {
|
||||||
|
return dispatch(actions.setVboxHighlight(v));
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
setCombiner,
|
||||||
|
setReclaiming,
|
||||||
|
setInfo,
|
||||||
|
setVboxHighlight,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
);
|
||||||
|
|
||||||
function Vbox(args) {
|
function Vbox(args) {
|
||||||
const {
|
const {
|
||||||
activeCryp,
|
|
||||||
setActiveCryp,
|
|
||||||
combiner,
|
combiner,
|
||||||
info,
|
|
||||||
instance,
|
instance,
|
||||||
|
itemInfo,
|
||||||
player,
|
player,
|
||||||
reclaiming,
|
reclaiming,
|
||||||
sendVboxAccept,
|
sendVboxAccept,
|
||||||
sendVboxApply,
|
|
||||||
sendVboxCombine,
|
sendVboxCombine,
|
||||||
sendVboxDiscard,
|
sendVboxDiscard,
|
||||||
sendVboxReclaim,
|
sendVboxReclaim,
|
||||||
|
vboxHighlight,
|
||||||
|
|
||||||
setCombiner,
|
setCombiner,
|
||||||
setInfo,
|
setInfo,
|
||||||
setReclaiming,
|
setReclaiming,
|
||||||
showTeam,
|
|
||||||
vboxHidden,
|
|
||||||
vboxHighlight,
|
|
||||||
setVboxHighlight,
|
setVboxHighlight,
|
||||||
itemInfo,
|
|
||||||
} = args;
|
} = args;
|
||||||
|
|
||||||
if (!player) return false;
|
if (!player) return false;
|
||||||
@ -82,18 +148,18 @@ function Vbox(args) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function vboxHover(e, v) {
|
||||||
|
if (v) {
|
||||||
|
setInfo(v);
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
const freeRows = free.map((row, i) => {
|
const freeRows = free.map((row, i) => {
|
||||||
const cells = row.map((c, j) => {
|
const cells = row.map((c, j) => {
|
||||||
const highlighted = c && vboxHighlight.includes(c);
|
const highlighted = c && vboxHighlight.includes(c);
|
||||||
|
|
||||||
function freeClick() {
|
|
||||||
if (c) {
|
|
||||||
setActiveCryp(null);
|
|
||||||
return setInfo(c);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return <td
|
return <td
|
||||||
key={j}
|
key={j}
|
||||||
className={`${highlighted ? 'highlight' : ''}`}
|
className={`${highlighted ? 'highlight' : ''}`}
|
||||||
@ -101,8 +167,9 @@ function Vbox(args) {
|
|||||||
onTouchEnd={e => vboxTouchEnd(e, i, j)}
|
onTouchEnd={e => vboxTouchEnd(e, i, j)}
|
||||||
onTouchMove={e => vboxTouchMove(e)}
|
onTouchMove={e => vboxTouchMove(e)}
|
||||||
|
|
||||||
onClick={freeClick}
|
// onClick={freeClick}
|
||||||
onDblClick={() => sendVboxAccept(j, i) }
|
onDblClick={() => sendVboxAccept(j, i) }
|
||||||
|
onMouseOver={(e) => vboxHover(e, c)}
|
||||||
>
|
>
|
||||||
{convertItem(c)}
|
{convertItem(c)}
|
||||||
</td>;
|
</td>;
|
||||||
@ -118,19 +185,13 @@ function Vbox(args) {
|
|||||||
//
|
//
|
||||||
// INVENTORY
|
// INVENTORY
|
||||||
//
|
//
|
||||||
function boundClick(e, i, highlight) {
|
function boundClick(e, i) {
|
||||||
const value = vbox.bound[i];
|
const value = vbox.bound[i];
|
||||||
if (reclaiming && value) sendVboxReclaim(i);
|
if (reclaiming && value) return sendVboxReclaim(i);
|
||||||
else if (highlight && activeCryp) {
|
if (value) {
|
||||||
sendVboxApply(i);
|
|
||||||
setVboxHighlight([]);
|
|
||||||
showTeam();
|
|
||||||
} else if (value) {
|
|
||||||
const insert = combiner.findIndex(j => j === null);
|
const insert = combiner.findIndex(j => j === null);
|
||||||
if (insert === -1) return combinerChange([i, null, null]);
|
if (insert === -1) return combinerChange([i, null, null]);
|
||||||
combiner[insert] = i;
|
combiner[insert] = i;
|
||||||
setInfo(value);
|
|
||||||
setActiveCryp(null);
|
|
||||||
return combinerChange(combiner);
|
return combinerChange(combiner);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -153,6 +214,7 @@ function Vbox(args) {
|
|||||||
<td
|
<td
|
||||||
key={i}
|
key={i}
|
||||||
className={`${highlighted ? 'highlight' : ''}`}
|
className={`${highlighted ? 'highlight' : ''}`}
|
||||||
|
onMouseOver={(e) => vboxHover(e, value)}
|
||||||
onClick={e => boundClick(e, i, highlighted) }>
|
onClick={e => boundClick(e, i, highlighted) }>
|
||||||
{convertItem(value)}
|
{convertItem(value)}
|
||||||
</td>
|
</td>
|
||||||
@ -211,7 +273,7 @@ function Vbox(args) {
|
|||||||
return setReclaiming(!reclaiming);
|
return setReclaiming(!reclaiming);
|
||||||
}
|
}
|
||||||
|
|
||||||
const classes = `vbox ${vboxHidden ? 'hidden' : ''}`;
|
const classes = `vbox`;
|
||||||
const reclaimClass = `instance-btn instance-ui-btn vbox-btn reclaim ${reclaiming ? 'reclaiming' : ''}`;
|
const reclaimClass = `instance-btn instance-ui-btn vbox-btn reclaim ${reclaiming ? 'reclaiming' : ''}`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -258,4 +320,4 @@ function Vbox(args) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = Vbox;
|
module.exports = addState(Vbox);
|
||||||
|
|||||||
@ -1,101 +0,0 @@
|
|||||||
const { connect } = require('preact-redux');
|
|
||||||
|
|
||||||
const actions = require('../actions');
|
|
||||||
|
|
||||||
const Vbox = require('./vbox.component');
|
|
||||||
|
|
||||||
const addState = connect(
|
|
||||||
function receiveState(state) {
|
|
||||||
const {
|
|
||||||
ws,
|
|
||||||
instance,
|
|
||||||
player,
|
|
||||||
combiner,
|
|
||||||
reclaiming,
|
|
||||||
activeItem,
|
|
||||||
activeCryp,
|
|
||||||
info,
|
|
||||||
vboxHidden,
|
|
||||||
vboxHighlight,
|
|
||||||
itemInfo,
|
|
||||||
} = state;
|
|
||||||
|
|
||||||
function sendVboxApply(i) {
|
|
||||||
return ws.sendVboxApply(instance.id, activeCryp.id, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
function sendVboxDiscard() {
|
|
||||||
return ws.sendVboxDiscard(instance.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
function sendVboxAccept(group, index) {
|
|
||||||
return ws.sendVboxAccept(instance.id, group, index);
|
|
||||||
}
|
|
||||||
|
|
||||||
function sendVboxCombine() {
|
|
||||||
return ws.sendVboxCombine(instance.id, combiner);
|
|
||||||
}
|
|
||||||
|
|
||||||
function sendVboxReclaim(i) {
|
|
||||||
return ws.sendVboxReclaim(instance.id, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
instance,
|
|
||||||
player,
|
|
||||||
combiner,
|
|
||||||
reclaiming,
|
|
||||||
activeItem,
|
|
||||||
activeCryp,
|
|
||||||
info,
|
|
||||||
itemInfo,
|
|
||||||
vboxHidden,
|
|
||||||
vboxHighlight,
|
|
||||||
sendVboxAccept,
|
|
||||||
sendVboxDiscard,
|
|
||||||
sendVboxReclaim,
|
|
||||||
sendVboxCombine,
|
|
||||||
sendVboxApply,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
function receiveDispatch(dispatch) {
|
|
||||||
function setCombiner(c) {
|
|
||||||
return dispatch(actions.setCombiner(c));
|
|
||||||
}
|
|
||||||
|
|
||||||
function setReclaiming(v) {
|
|
||||||
return dispatch(actions.setReclaiming(v));
|
|
||||||
}
|
|
||||||
|
|
||||||
function setInfo(item) {
|
|
||||||
return dispatch(actions.setInfo(item));
|
|
||||||
}
|
|
||||||
|
|
||||||
function setActiveCryp(v) {
|
|
||||||
return dispatch(actions.setActiveCryp(v));
|
|
||||||
}
|
|
||||||
|
|
||||||
function setVboxHighlight(v) {
|
|
||||||
return dispatch(actions.setVboxHighlight(v));
|
|
||||||
}
|
|
||||||
|
|
||||||
function showTeam() {
|
|
||||||
dispatch(actions.setInfo(null));
|
|
||||||
dispatch(actions.setVboxHidden(true));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
setCombiner,
|
|
||||||
setActiveCryp,
|
|
||||||
setReclaiming,
|
|
||||||
setInfo,
|
|
||||||
setVboxHighlight,
|
|
||||||
showTeam,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
);
|
|
||||||
|
|
||||||
module.exports = addState(Vbox);
|
|
||||||
@ -143,7 +143,6 @@ function registerEvents(store) {
|
|||||||
const player = v.players.find(p => p.id === account.id);
|
const player = v.players.find(p => p.id === account.id);
|
||||||
if (player) store.dispatch(actions.setPlayer(player));
|
if (player) store.dispatch(actions.setPlayer(player));
|
||||||
if (v) ws.startInstanceStateTimeout(v.id);
|
if (v) ws.startInstanceStateTimeout(v.id);
|
||||||
if (v.phase === 'Lobby') store.dispatch(actions.setVboxHidden(true));
|
|
||||||
return store.dispatch(actions.setInstance(v));
|
return store.dispatch(actions.setInstance(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,26 +13,25 @@ function createReducer(defaultState, actionType) {
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
account: createReducer(null, 'SET_ACCOUNT'),
|
account: createReducer(null, 'SET_ACCOUNT'),
|
||||||
activeCryp: createReducer(null, 'SET_ACTIVE_CRYP'),
|
activeCryp: createReducer(null, 'SET_ACTIVE_CRYP'),
|
||||||
activeSkill: createReducer(null, 'SET_ACTIVE_SKILL'),
|
|
||||||
activeItem: createReducer(null, 'SET_ACTIVE_VAR'),
|
activeItem: createReducer(null, 'SET_ACTIVE_VAR'),
|
||||||
|
activeSkill: createReducer(null, 'SET_ACTIVE_SKILL'),
|
||||||
combiner: createReducer([null, null, null], 'SET_COMBINER'),
|
combiner: createReducer([null, null, null], 'SET_COMBINER'),
|
||||||
cryps: createReducer([], 'SET_CRYPS'),
|
cryps: createReducer([], 'SET_CRYPS'),
|
||||||
game: createReducer(null, 'SET_GAME'),
|
game: createReducer(null, 'SET_GAME'),
|
||||||
info: createReducer(null, 'SET_INFO'),
|
info: createReducer(null, 'SET_INFO'),
|
||||||
itemEquip: createReducer(null, 'SET_ITEM_EQUIP'),
|
|
||||||
itemUnequip: createReducer(null, 'SET_ITEM_UNEQUIP'),
|
|
||||||
instance: createReducer(null, 'SET_INSTANCE'),
|
instance: createReducer(null, 'SET_INSTANCE'),
|
||||||
instances: createReducer([], 'SET_INSTANCES'),
|
instances: createReducer([], 'SET_INSTANCES'),
|
||||||
skip: createReducer(false, 'SET_SKIP'),
|
itemEquip: createReducer(null, 'SET_ITEM_EQUIP'),
|
||||||
|
itemInfo: createReducer({ combos: [], items: [] }, 'SET_ITEM_INFO'),
|
||||||
|
itemUnequip: createReducer(null, 'SET_ITEM_UNEQUIP'),
|
||||||
nav: createReducer(null, 'SET_NAV'),
|
nav: createReducer(null, 'SET_NAV'),
|
||||||
ping: createReducer(null, 'SET_PING'),
|
ping: createReducer(null, 'SET_PING'),
|
||||||
player: createReducer(null, 'SET_PLAYER'),
|
player: createReducer(null, 'SET_PLAYER'),
|
||||||
reclaiming: createReducer(false, 'SET_RECLAIMING'),
|
reclaiming: createReducer(false, 'SET_RECLAIMING'),
|
||||||
resolution: createReducer(null, 'SET_RESOLUTION'),
|
resolution: createReducer(null, 'SET_RESOLUTION'),
|
||||||
team: createReducer([null, null, null], 'SET_SELECTED_CRYPS'),
|
|
||||||
showLog: createReducer(false, 'SET_SHOW_LOG'),
|
showLog: createReducer(false, 'SET_SHOW_LOG'),
|
||||||
vboxHidden: createReducer(false, 'SET_VBOX_HIDDEN'),
|
skip: createReducer(false, 'SET_SKIP'),
|
||||||
|
team: createReducer([null, null, null], 'SET_SELECTED_CRYPS'),
|
||||||
vboxHighlight: createReducer([], 'SET_VBOX_HIGHLIGHT'),
|
vboxHighlight: createReducer([], 'SET_VBOX_HIGHLIGHT'),
|
||||||
itemInfo: createReducer({ combos: [], items: [] }, 'SET_ITEM_INFO'),
|
|
||||||
ws: createReducer(null, 'SET_WS'),
|
ws: createReducer(null, 'SET_WS'),
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user