Combine vboxselect and combiner. Remove itemEquip and dblclick.
This commit is contained in:
parent
10d3f821e3
commit
e35c688cff
@ -30,7 +30,6 @@ export const setEmail = value => ({ type: 'SET_EMAIL', value });
|
|||||||
export const setInvite = value => ({ type: 'SET_INVITE', value });
|
export const setInvite = value => ({ type: 'SET_INVITE', value });
|
||||||
export const setInstance = value => ({ type: 'SET_INSTANCE', value });
|
export const setInstance = value => ({ type: 'SET_INSTANCE', value });
|
||||||
export const setInstances = value => ({ type: 'SET_INSTANCES', value });
|
export const setInstances = value => ({ type: 'SET_INSTANCES', value });
|
||||||
export const setItemEquip = value => ({ type: 'SET_ITEM_EQUIP', value });
|
|
||||||
export const setItemInfo = value => ({ type: 'SET_ITEM_INFO', value });
|
export const setItemInfo = value => ({ type: 'SET_ITEM_INFO', value });
|
||||||
export const setItemUnequip = value => ({ type: 'SET_ITEM_UNEQUIP', value });
|
export const setItemUnequip = value => ({ type: 'SET_ITEM_UNEQUIP', value });
|
||||||
export const setMtxActive = value => ({ type: 'SET_MTX_ACTIVE', value });
|
export const setMtxActive = value => ({ type: 'SET_MTX_ACTIVE', value });
|
||||||
|
|||||||
@ -37,7 +37,6 @@ const addState = connect(
|
|||||||
dispatch(actions.setReclaiming(false));
|
dispatch(actions.setReclaiming(false));
|
||||||
dispatch(actions.setActiveSkill(null));
|
dispatch(actions.setActiveSkill(null));
|
||||||
dispatch(actions.setInfo(null));
|
dispatch(actions.setInfo(null));
|
||||||
dispatch(actions.setItemEquip(null));
|
|
||||||
dispatch(actions.setItemUnequip([]));
|
dispatch(actions.setItemUnequip([]));
|
||||||
dispatch(actions.setVboxHighlight([]));
|
dispatch(actions.setVboxHighlight([]));
|
||||||
return dispatch(actions.setNav('account'));
|
return dispatch(actions.setNav('account'));
|
||||||
|
|||||||
@ -36,7 +36,6 @@ const addState = connect(
|
|||||||
dispatch(actions.setReclaiming(false));
|
dispatch(actions.setReclaiming(false));
|
||||||
dispatch(actions.setActiveSkill(null));
|
dispatch(actions.setActiveSkill(null));
|
||||||
dispatch(actions.setInfo(null));
|
dispatch(actions.setInfo(null));
|
||||||
dispatch(actions.setItemEquip(null));
|
|
||||||
dispatch(actions.setItemUnequip([]));
|
dispatch(actions.setItemUnequip([]));
|
||||||
dispatch(actions.setVboxHighlight([]));
|
dispatch(actions.setVboxHighlight([]));
|
||||||
dispatch(actions.setMtxActive(null));
|
dispatch(actions.setMtxActive(null));
|
||||||
|
|||||||
@ -29,10 +29,9 @@ const addState = connect(
|
|||||||
function clearItems() {
|
function clearItems() {
|
||||||
dispatch(actions.setCombiner([]));
|
dispatch(actions.setCombiner([]));
|
||||||
dispatch(actions.setReclaiming(false));
|
dispatch(actions.setReclaiming(false));
|
||||||
dispatch(actions.setItemEquip(null));
|
|
||||||
dispatch(actions.setItemUnequip([]));
|
dispatch(actions.setItemUnequip([]));
|
||||||
dispatch(actions.setVboxHighlight([]));
|
dispatch(actions.setVboxHighlight([]));
|
||||||
dispatch(actions.setVboxSelected([]));
|
dispatch(actions.setVboxSelected({ vbox: [], combiner: [] }));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -19,24 +19,19 @@ const addState = connect(
|
|||||||
player,
|
player,
|
||||||
account,
|
account,
|
||||||
itemInfo,
|
itemInfo,
|
||||||
itemEquip,
|
|
||||||
itemUnequip,
|
itemUnequip,
|
||||||
vboxSelected,
|
vboxSelected,
|
||||||
tutorial,
|
tutorial,
|
||||||
} = state;
|
} = state;
|
||||||
|
|
||||||
function sendVboxAcceptEquip(constructId) {
|
function sendVboxAcceptEquip(constructId) {
|
||||||
return ws.sendVboxAcceptEquip(instance.id, vboxSelected[0][0], vboxSelected[0][1], constructId);
|
return ws.sendVboxAcceptEquip(instance.id, vboxSelected.vbox[0][0], vboxSelected.vbox[0][1], constructId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendVboxApply(constructId, i) {
|
function sendVboxApply(constructId, i) {
|
||||||
return ws.sendVboxApply(instance.id, constructId, i);
|
return ws.sendVboxApply(instance.id, constructId, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendUnequip(constructId, item) {
|
|
||||||
return ws.sendVboxUnequip(instance.id, constructId, item);
|
|
||||||
}
|
|
||||||
|
|
||||||
function sendVboxUnequipApply(targetConstructId) {
|
function sendVboxUnequipApply(targetConstructId) {
|
||||||
return ws.sendVboxUnequipApply(instance.id, itemUnequip[0], itemUnequip[1], targetConstructId);
|
return ws.sendVboxUnequipApply(instance.id, itemUnequip[0], itemUnequip[1], targetConstructId);
|
||||||
}
|
}
|
||||||
@ -49,9 +44,7 @@ const addState = connect(
|
|||||||
sendVboxUnequipApply,
|
sendVboxUnequipApply,
|
||||||
sendVboxApply,
|
sendVboxApply,
|
||||||
itemInfo,
|
itemInfo,
|
||||||
itemEquip,
|
|
||||||
itemUnequip,
|
itemUnequip,
|
||||||
sendUnequip,
|
|
||||||
vboxSelected,
|
vboxSelected,
|
||||||
tutorial,
|
tutorial,
|
||||||
};
|
};
|
||||||
@ -66,17 +59,13 @@ const addState = connect(
|
|||||||
dispatch(actions.setInfo(item));
|
dispatch(actions.setInfo(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
function setItemEquip(v) {
|
|
||||||
return dispatch(actions.setItemEquip(v));
|
|
||||||
}
|
|
||||||
|
|
||||||
function setItemUnequip(v) {
|
function setItemUnequip(v) {
|
||||||
dispatch(actions.setVboxSelected([]));
|
dispatch(actions.setVboxSelected({ vbox: [], combiner: [] }));
|
||||||
dispatch(actions.setCombiner([]));
|
dispatch(actions.setCombiner([]));
|
||||||
return dispatch(actions.setItemUnequip(v));
|
return dispatch(actions.setItemUnequip(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
return { quit, setInfo, setItemUnequip, setItemEquip };
|
return { quit, setInfo, setItemUnequip };
|
||||||
}
|
}
|
||||||
|
|
||||||
);
|
);
|
||||||
@ -86,7 +75,6 @@ function Construct(props) {
|
|||||||
// Changing state variables
|
// Changing state variables
|
||||||
construct,
|
construct,
|
||||||
iter,
|
iter,
|
||||||
itemEquip,
|
|
||||||
itemUnequip,
|
itemUnequip,
|
||||||
instance,
|
instance,
|
||||||
player,
|
player,
|
||||||
@ -98,13 +86,16 @@ function Construct(props) {
|
|||||||
sendVboxApply,
|
sendVboxApply,
|
||||||
sendVboxAcceptEquip,
|
sendVboxAcceptEquip,
|
||||||
sendVboxUnequipApply,
|
sendVboxUnequipApply,
|
||||||
sendUnequip,
|
|
||||||
setItemUnequip,
|
setItemUnequip,
|
||||||
setItemEquip,
|
|
||||||
setInfo,
|
setInfo,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const { vbox } = player;
|
const { vbox } = player;
|
||||||
|
|
||||||
|
const itemEquip = vboxSelected.vbox.length === 0 && vboxSelected.combiner.length === 1
|
||||||
|
? vboxSelected.combiner[0]
|
||||||
|
: -1;
|
||||||
|
|
||||||
const duplicateSkill = construct.skills.length !== 0 && construct.skills.every(sk => {
|
const duplicateSkill = construct.skills.length !== 0 && construct.skills.every(sk => {
|
||||||
if (!itemEquip && itemEquip !== 0) return false;
|
if (!itemEquip && itemEquip !== 0) return false;
|
||||||
if (!sk) return false;
|
if (!sk) return false;
|
||||||
@ -115,17 +106,16 @@ function Construct(props) {
|
|||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
if (duplicateSkill || tutorialDisableEquip) return true;
|
if (duplicateSkill || tutorialDisableEquip) return true;
|
||||||
if (itemEquip !== null) return sendVboxApply(construct.id, itemEquip);
|
if (itemEquip !== -1) return sendVboxApply(construct.id, itemEquip);
|
||||||
if (vboxSelected.length === 1) return sendVboxAcceptEquip(construct.id);
|
if (vboxSelected.vbox.length === 1) return sendVboxAcceptEquip(construct.id);
|
||||||
if (itemUnequip.length && itemUnequip[0] !== construct.id) return sendVboxUnequipApply(construct.id);
|
if (itemUnequip.length && itemUnequip[0] !== construct.id) return sendVboxUnequipApply(construct.id);
|
||||||
setItemEquip(null);
|
|
||||||
setItemUnequip([]);
|
setItemUnequip([]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
function hoverInfo(e, info) {
|
function hoverInfo(e, info) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (!info) return false;
|
if (!info) return false;
|
||||||
if (vboxSelected.length || itemEquip > -1) return false;
|
if (vboxSelected.vbox.length || itemEquip > -1) return false;
|
||||||
return setInfo(info);
|
return setInfo(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,15 +135,6 @@ function Construct(props) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function skillDblClick(e) {
|
|
||||||
if (!skill) return false;
|
|
||||||
sendUnequip(construct.id, skill.skill);
|
|
||||||
setItemUnequip([]);
|
|
||||||
e.stopPropagation();
|
|
||||||
e.preventDefault();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const equipping = skillList.includes(vbox.bound[itemEquip]) && !skill
|
const equipping = skillList.includes(vbox.bound[itemEquip]) && !skill
|
||||||
&& !tutorialDisableEquip && !duplicateSkill && i === construct.skills.length;
|
&& !tutorialDisableEquip && !duplicateSkill && i === construct.skills.length;
|
||||||
const border = () => {
|
const border = () => {
|
||||||
@ -176,7 +157,6 @@ function Construct(props) {
|
|||||||
disabled={!skill && !equipping}
|
disabled={!skill && !equipping}
|
||||||
class={classes}
|
class={classes}
|
||||||
onClick={skillClick}
|
onClick={skillClick}
|
||||||
onDblClick={skillDblClick}
|
|
||||||
onMouseOver={e => hoverInfo(e, skill && skill.skill)} >
|
onMouseOver={e => hoverInfo(e, skill && skill.skill)} >
|
||||||
{s}
|
{s}
|
||||||
</button>
|
</button>
|
||||||
@ -202,13 +182,6 @@ function Construct(props) {
|
|||||||
setItemUnequip([construct.id, s, i]);
|
setItemUnequip([construct.id, s, i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function specDblClick(e) {
|
|
||||||
sendUnequip(construct.id, s);
|
|
||||||
setItemUnequip([]);
|
|
||||||
e.stopPropagation();
|
|
||||||
e.preventDefault();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
const highlight = itemUnequip[0] === construct.id && itemUnequip[1] === s && i === itemUnequip[2];
|
const highlight = itemUnequip[0] === construct.id && itemUnequip[1] === s && i === itemUnequip[2];
|
||||||
return (
|
return (
|
||||||
<label onDragStart={ev => {
|
<label onDragStart={ev => {
|
||||||
@ -219,7 +192,6 @@ function Construct(props) {
|
|||||||
key={i}
|
key={i}
|
||||||
class={`${highlight ? 'highlight' : ''}`}
|
class={`${highlight ? 'highlight' : ''}`}
|
||||||
onClick={specClick}
|
onClick={specClick}
|
||||||
onDblClick={specDblClick}
|
|
||||||
onMouseOver={e => hoverInfo(e, s)} >
|
onMouseOver={e => hoverInfo(e, s)} >
|
||||||
{shapes[s]()}
|
{shapes[s]()}
|
||||||
</button>
|
</button>
|
||||||
@ -263,7 +235,6 @@ function Construct(props) {
|
|||||||
|
|
||||||
class InstanceConstructs extends preact.Component {
|
class InstanceConstructs extends preact.Component {
|
||||||
shouldComponentUpdate(newProps) {
|
shouldComponentUpdate(newProps) {
|
||||||
if (newProps.itemEquip !== this.props.itemEquip) return true;
|
|
||||||
if (newProps.itemUnequip !== this.props.itemUnequip) return true;
|
if (newProps.itemUnequip !== this.props.itemUnequip) return true;
|
||||||
if (newProps.tutorial !== this.props.tutorial) return true;
|
if (newProps.tutorial !== this.props.tutorial) return true;
|
||||||
// JSON or Array objects
|
// JSON or Array objects
|
||||||
@ -276,7 +247,6 @@ class InstanceConstructs extends preact.Component {
|
|||||||
render(props) {
|
render(props) {
|
||||||
const {
|
const {
|
||||||
// Changing state variables
|
// Changing state variables
|
||||||
itemEquip,
|
|
||||||
itemUnequip,
|
itemUnequip,
|
||||||
instance,
|
instance,
|
||||||
player,
|
player,
|
||||||
@ -291,8 +261,6 @@ class InstanceConstructs extends preact.Component {
|
|||||||
sendVboxUnequipApply,
|
sendVboxUnequipApply,
|
||||||
setVboxHighlight,
|
setVboxHighlight,
|
||||||
setItemUnequip,
|
setItemUnequip,
|
||||||
setItemEquip,
|
|
||||||
sendUnequip,
|
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
if (!player) return false;
|
if (!player) return false;
|
||||||
@ -305,11 +273,9 @@ class InstanceConstructs extends preact.Component {
|
|||||||
return Construct({
|
return Construct({
|
||||||
iter: i,
|
iter: i,
|
||||||
construct: player.constructs[i],
|
construct: player.constructs[i],
|
||||||
itemEquip,
|
|
||||||
itemUnequip,
|
itemUnequip,
|
||||||
instance,
|
instance,
|
||||||
setItemUnequip,
|
setItemUnequip,
|
||||||
setItemEquip,
|
|
||||||
player,
|
player,
|
||||||
sendVboxApply,
|
sendVboxApply,
|
||||||
sendVboxAcceptEquip,
|
sendVboxAcceptEquip,
|
||||||
@ -317,7 +283,6 @@ class InstanceConstructs extends preact.Component {
|
|||||||
setInfo,
|
setInfo,
|
||||||
itemInfo,
|
itemInfo,
|
||||||
setVboxHighlight,
|
setVboxHighlight,
|
||||||
sendUnequip,
|
|
||||||
vboxSelected,
|
vboxSelected,
|
||||||
tutorial,
|
tutorial,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -37,7 +37,6 @@ const addState = connect(
|
|||||||
dispatch(actions.setReclaiming(false));
|
dispatch(actions.setReclaiming(false));
|
||||||
dispatch(actions.setActiveSkill(null));
|
dispatch(actions.setActiveSkill(null));
|
||||||
dispatch(actions.setInfo(null));
|
dispatch(actions.setInfo(null));
|
||||||
dispatch(actions.setItemEquip(null));
|
|
||||||
dispatch(actions.setItemUnequip([]));
|
dispatch(actions.setItemUnequip([]));
|
||||||
dispatch(actions.setVboxHighlight([]));
|
dispatch(actions.setVboxHighlight([]));
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,7 @@ const addState = connect(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sendVboxCombine() {
|
function sendVboxCombine() {
|
||||||
return ws.sendVboxCombine(instance.id, combiner, vboxSelected);
|
return ws.sendVboxCombine(instance.id, vboxSelected.combiner, vboxSelected.vbox);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendVboxReclaim(i) {
|
function sendVboxReclaim(i) {
|
||||||
@ -70,7 +70,7 @@ const addState = connect(
|
|||||||
function setReclaiming(v) {
|
function setReclaiming(v) {
|
||||||
dispatch(actions.setItemUnequip([]));
|
dispatch(actions.setItemUnequip([]));
|
||||||
dispatch(actions.setCombiner([]));
|
dispatch(actions.setCombiner([]));
|
||||||
dispatch(actions.setVboxSelected([]));
|
dispatch(actions.setVboxSelected({ vbox: [], combiner: [] }));
|
||||||
return dispatch(actions.setReclaiming(v));
|
return dispatch(actions.setReclaiming(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,19 +80,15 @@ const addState = connect(
|
|||||||
|
|
||||||
function setVboxSelected(v) {
|
function setVboxSelected(v) {
|
||||||
dispatch(actions.setItemUnequip([]));
|
dispatch(actions.setItemUnequip([]));
|
||||||
|
dispatch(actions.setVboxSelected(v));
|
||||||
return dispatch(actions.setVboxSelected(v));
|
return dispatch(actions.setVboxSelected(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
function setItemEquip(v) {
|
|
||||||
return dispatch(actions.setItemEquip(v));
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
setCombiner,
|
setCombiner,
|
||||||
setReclaiming,
|
setReclaiming,
|
||||||
setInfo,
|
setInfo,
|
||||||
setVboxSelected,
|
setVboxSelected,
|
||||||
setItemEquip,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,7 +110,6 @@ class Vbox extends preact.Component {
|
|||||||
render(args) {
|
render(args) {
|
||||||
const {
|
const {
|
||||||
// Changing state variables
|
// Changing state variables
|
||||||
combiner,
|
|
||||||
itemUnequip,
|
itemUnequip,
|
||||||
player,
|
player,
|
||||||
reclaiming,
|
reclaiming,
|
||||||
@ -131,26 +126,17 @@ class Vbox extends preact.Component {
|
|||||||
sendVboxDiscard,
|
sendVboxDiscard,
|
||||||
sendVboxReclaim,
|
sendVboxReclaim,
|
||||||
setVboxSelected,
|
setVboxSelected,
|
||||||
setItemEquip,
|
|
||||||
setInfo,
|
setInfo,
|
||||||
setCombiner,
|
|
||||||
setReclaiming,
|
setReclaiming,
|
||||||
} = args;
|
} = args;
|
||||||
|
|
||||||
if (!player) return false;
|
if (!player) return false;
|
||||||
const { vbox } = player;
|
const { vbox } = player;
|
||||||
const vboxSelecting = vboxSelected.length;
|
const { combiner } = vboxSelected;
|
||||||
|
const vboxSelecting = vboxSelected.vbox.length;
|
||||||
|
|
||||||
function combinerChange(newCombiner) {
|
function combinerChange(newCombiner) {
|
||||||
setCombiner(newCombiner);
|
return setVboxSelected({ vbox: vboxSelected.vbox, combiner: newCombiner });
|
||||||
|
|
||||||
if (newCombiner.length === 1) {
|
|
||||||
setItemEquip(newCombiner[0]);
|
|
||||||
} else {
|
|
||||||
setItemEquip(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -159,7 +145,7 @@ class Vbox extends preact.Component {
|
|||||||
function vboxHover(e, v) {
|
function vboxHover(e, v) {
|
||||||
if (v) {
|
if (v) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (vboxSelected[0]) return true; // There is a base skill or spec selected in the vbox
|
if (vboxSelected.vbox[0]) return true; // There is a base skill or spec selected in the vbox
|
||||||
if (combiner.length !== 0) {
|
if (combiner.length !== 0) {
|
||||||
const base = combiner.find(c => !['Red', 'Blue', 'Green'].includes(vbox.bound[c]));
|
const base = combiner.find(c => !['Red', 'Blue', 'Green'].includes(vbox.bound[c]));
|
||||||
if (base || base === 0) return true;
|
if (base || base === 0) return true;
|
||||||
@ -170,36 +156,26 @@ class Vbox extends preact.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function clearVboxSelected() {
|
function clearVboxSelected() {
|
||||||
setVboxSelected([]);
|
setVboxSelected({ vbox: [], combiner });
|
||||||
}
|
}
|
||||||
|
|
||||||
function vboxBuySelected() {
|
function vboxBuySelected() {
|
||||||
if (!vboxSelecting) return false;
|
if (!vboxSelecting) return false;
|
||||||
document.activeElement.blur();
|
document.activeElement.blur();
|
||||||
clearVboxSelected();
|
clearVboxSelected();
|
||||||
sendVboxAccept(vboxSelected[0][0], vboxSelected[0][1]);
|
sendVboxAccept(vboxSelected.vbox[0][0], vboxSelected.vbox[0][1]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function availableBtn(v, group, index) {
|
function availableBtn(v, group, index) {
|
||||||
if (!v) return <button disabled class='empty' key={(group * 10) + index} > </button>;
|
if (!v) return <button disabled class='empty' key={(group * 10) + index} > </button>;
|
||||||
const selected = vboxSelected.length && vboxSelected.some(vs => vs[0] === group && vs[1] === index);
|
const selected = vboxSelected.vbox.length && vboxSelected.vbox.some(vs => vs[0] === group && vs[1] === index);
|
||||||
// state not yet set in double click handler
|
// state not yet set in double click handler
|
||||||
function onDblClick(e) {
|
/*function onDblClick(e) {
|
||||||
clearVboxSelected();
|
clearVboxSelected();
|
||||||
sendVboxAccept(group, index);
|
sendVboxAccept(group, index);
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
function onClick(e) {
|
|
||||||
e.stopPropagation();
|
|
||||||
setItemEquip(null);
|
|
||||||
setInfo(vbox.free[group][index]);
|
|
||||||
if (vboxSelected.length && vboxSelected.some(vs => vs[0] === group && vs[1] === index)) {
|
|
||||||
return setVboxSelected(vboxSelected.filter(vs => !(vs[0] === group && vs[1] === index)));
|
|
||||||
}
|
|
||||||
return setVboxSelected([...vboxSelected, [group, index]]);
|
|
||||||
}
|
|
||||||
|
|
||||||
const combinerItems = combiner.map(j => vbox.bound[j]);
|
const combinerItems = combiner.map(j => vbox.bound[j]);
|
||||||
const combinerCount = countBy(combinerItems, co => co);
|
const combinerCount = countBy(combinerItems, co => co);
|
||||||
@ -216,6 +192,21 @@ class Vbox extends preact.Component {
|
|||||||
} return false;
|
} return false;
|
||||||
}) ? 'combo-border' : '';
|
}) ? 'combo-border' : '';
|
||||||
|
|
||||||
|
function onClick(e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
setInfo(vbox.free[group][index]);
|
||||||
|
if (vboxSelected.vbox.length && vboxSelected.vbox.some(vs => vs[0] === group && vs[1] === index)) {
|
||||||
|
return setVboxSelected({ vbox: vboxSelected.vbox.filter(vs => !(vs[0] === group && vs[1] === index)), combiner });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!vboxSelected.vbox.length && !combiner.length) return setVboxSelected({ vbox: [[group, index]], combiner });
|
||||||
|
if (comboHighlight !== 'combo-border') {
|
||||||
|
return setVboxSelected({ vbox: [[group, index]], combiner: [] });
|
||||||
|
}
|
||||||
|
return setVboxSelected({ vbox: [...vboxSelected.vbox, [group, index]], combiner });
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const classes = `${v.toLowerCase()} ${selected ? 'highlight' : ''} ${comboHighlight}`;
|
const classes = `${v.toLowerCase()} ${selected ? 'highlight' : ''} ${comboHighlight}`;
|
||||||
|
|
||||||
const vboxObject = shapes[v] ? shapes[v]() : v;
|
const vboxObject = shapes[v] ? shapes[v]() : v;
|
||||||
@ -231,7 +222,6 @@ class Vbox extends preact.Component {
|
|||||||
onMouseOver={e => vboxHover(e, v)}
|
onMouseOver={e => vboxHover(e, v)}
|
||||||
onMouseDown={onClick}
|
onMouseDown={onClick}
|
||||||
onClick={e => e.stopPropagation()}
|
onClick={e => e.stopPropagation()}
|
||||||
onDblClick={onDblClick}
|
|
||||||
> {vboxObject}
|
> {vboxObject}
|
||||||
</button>
|
</button>
|
||||||
</label>
|
</label>
|
||||||
@ -439,7 +429,7 @@ class Vbox extends preact.Component {
|
|||||||
function hoverInfo(e, newInfo) {
|
function hoverInfo(e, newInfo) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
if (vboxSelected[0]) return true;
|
if (vboxSelected.vbox[0]) return true;
|
||||||
if (combiner.length !== 0) {
|
if (combiner.length !== 0) {
|
||||||
const base = combiner.find(c => !['Red', 'Blue', 'Green'].includes(vbox.bound[c]));
|
const base = combiner.find(c => !['Red', 'Blue', 'Green'].includes(vbox.bound[c]));
|
||||||
if (base || base === 0) return true;
|
if (base || base === 0) return true;
|
||||||
|
|||||||
@ -188,10 +188,9 @@ function registerEvents(store) {
|
|||||||
store.dispatch(actions.setReclaiming(false));
|
store.dispatch(actions.setReclaiming(false));
|
||||||
store.dispatch(actions.setActiveSkill(null));
|
store.dispatch(actions.setActiveSkill(null));
|
||||||
store.dispatch(actions.setInfo(null));
|
store.dispatch(actions.setInfo(null));
|
||||||
store.dispatch(actions.setItemEquip(null));
|
|
||||||
store.dispatch(actions.setItemUnequip([]));
|
store.dispatch(actions.setItemUnequip([]));
|
||||||
store.dispatch(actions.setVboxHighlight([]));
|
store.dispatch(actions.setVboxHighlight([]));
|
||||||
store.dispatch(actions.setVboxSelected([]));
|
store.dispatch(actions.setVboxSelected({ vbox: [], combiner: [] }));
|
||||||
}
|
}
|
||||||
|
|
||||||
function setAccountInstances(v) {
|
function setAccountInstances(v) {
|
||||||
|
|||||||
@ -10,10 +10,9 @@ function setupKeys(store) {
|
|||||||
key('esc', () => store.dispatch(actions.setReclaiming(false)));
|
key('esc', () => store.dispatch(actions.setReclaiming(false)));
|
||||||
key('esc', () => store.dispatch(actions.setActiveSkill(null)));
|
key('esc', () => store.dispatch(actions.setActiveSkill(null)));
|
||||||
key('esc', () => store.dispatch(actions.setInfo(null)));
|
key('esc', () => store.dispatch(actions.setInfo(null)));
|
||||||
key('esc', () => store.dispatch(actions.setItemEquip(null)));
|
|
||||||
key('esc', () => store.dispatch(actions.setItemUnequip([])));
|
key('esc', () => store.dispatch(actions.setItemUnequip([])));
|
||||||
key('esc', () => store.dispatch(actions.setVboxHighlight([])));
|
key('esc', () => store.dispatch(actions.setVboxHighlight([])));
|
||||||
key('esc', () => store.dispatch(actions.setVboxSelected([])));
|
key('esc', () => store.dispatch(actions.setVboxSelected({ vbox: [], combiner: [] })));
|
||||||
key('esc', () => store.dispatch(actions.setMtxActive(null)));
|
key('esc', () => store.dispatch(actions.setMtxActive(null)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,6 @@ module.exports = {
|
|||||||
instance: createReducer(null, 'SET_INSTANCE'),
|
instance: createReducer(null, 'SET_INSTANCE'),
|
||||||
instanceChat: createReducer(null, 'SET_INSTANCE_CHAT'),
|
instanceChat: createReducer(null, 'SET_INSTANCE_CHAT'),
|
||||||
instances: createReducer([], 'SET_INSTANCES'),
|
instances: createReducer([], 'SET_INSTANCES'),
|
||||||
itemEquip: createReducer(null, 'SET_ITEM_EQUIP'),
|
|
||||||
itemInfo: createReducer({ combos: [], items: [] }, 'SET_ITEM_INFO'),
|
itemInfo: createReducer({ combos: [], items: [] }, 'SET_ITEM_INFO'),
|
||||||
itemUnequip: createReducer([], 'SET_ITEM_UNEQUIP'),
|
itemUnequip: createReducer([], 'SET_ITEM_UNEQUIP'),
|
||||||
mtxActive: createReducer(null, 'SET_MTX_ACTIVE'),
|
mtxActive: createReducer(null, 'SET_MTX_ACTIVE'),
|
||||||
@ -59,7 +58,7 @@ module.exports = {
|
|||||||
tutorial: createReducer(1, 'SET_TUTORIAL'),
|
tutorial: createReducer(1, 'SET_TUTORIAL'),
|
||||||
tutorialGame: createReducer(1, 'SET_TUTORIAL_GAME'),
|
tutorialGame: createReducer(1, 'SET_TUTORIAL_GAME'),
|
||||||
|
|
||||||
vboxSelected: createReducer([], 'SET_VBOX_SELECTED'),
|
vboxSelected: createReducer({ vbox: [], combiner: [] }, 'SET_VBOX_SELECTED'),
|
||||||
|
|
||||||
ws: createReducer(null, 'SET_WS'),
|
ws: createReducer(null, 'SET_WS'),
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user