equip from highlight
This commit is contained in:
parent
4fce486edd
commit
748f36fa08
@ -62,9 +62,10 @@ function Cryp(props) {
|
|||||||
? skill.skill
|
? skill.skill
|
||||||
: (<span> </span>);
|
: (<span> </span>);
|
||||||
|
|
||||||
function skillClick() {
|
function skillClick(e) {
|
||||||
if (!skill) return setInfo('highlight', 'skill');
|
if (!skill) setInfo('highlight', 'skill');
|
||||||
setInfo('skill', { skill: skill.skill, cryp });
|
else setInfo('skill', { skill: skill.skill, cryp });
|
||||||
|
e.stopPropagation();
|
||||||
return setActiveCryp(cryp);
|
return setActiveCryp(cryp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,16 +98,23 @@ function Cryp(props) {
|
|||||||
const specs = range(0, 6).map(i => {
|
const specs = range(0, 6).map(i => {
|
||||||
const s = cryp.specs[i];
|
const s = cryp.specs[i];
|
||||||
|
|
||||||
|
function blankSpecClick(e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
setActiveCryp(cryp);
|
||||||
|
setInfo('highlight', 'spec')
|
||||||
|
}
|
||||||
|
|
||||||
if (!s) {
|
if (!s) {
|
||||||
return (
|
return (
|
||||||
<figure key={i} className="gray" onClick={() => setInfo('highlight', 'spec')}>
|
<figure key={i} className="gray" onClick={blankSpecClick}>
|
||||||
{shapes.diamond('stat-icon gray')}
|
{shapes.diamond('stat-icon gray')}
|
||||||
<figcaption>-</figcaption>
|
<figcaption> </figcaption>
|
||||||
</figure>
|
</figure>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function specClick() {
|
function specClick(e) {
|
||||||
|
e.stopPropagation();
|
||||||
setActiveCryp(cryp);
|
setActiveCryp(cryp);
|
||||||
setInfo('spec', { spec: s, cryp });
|
setInfo('spec', { spec: s, cryp });
|
||||||
}
|
}
|
||||||
@ -181,7 +189,7 @@ function InstanceCryps(props) {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={crypListClass}>
|
<div className={crypListClass} onClick={() => setActiveCryp(null)}>
|
||||||
{cryps}
|
{cryps}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -19,9 +19,9 @@ function Vbox(args) {
|
|||||||
sendVboxDiscard,
|
sendVboxDiscard,
|
||||||
sendVboxReclaim,
|
sendVboxReclaim,
|
||||||
sendVboxCombine,
|
sendVboxCombine,
|
||||||
|
sendVboxApply,
|
||||||
setCombiner,
|
setCombiner,
|
||||||
setReclaiming,
|
setReclaiming,
|
||||||
setActiveVar,
|
|
||||||
setInfo,
|
setInfo,
|
||||||
} = args;
|
} = args;
|
||||||
|
|
||||||
@ -85,46 +85,13 @@ function Vbox(args) {
|
|||||||
//
|
//
|
||||||
// INVENTORY
|
// INVENTORY
|
||||||
//
|
//
|
||||||
|
function boundClick(e, i, highlight) {
|
||||||
let boundTimer;
|
|
||||||
function boundTouchStart(e, i) {
|
|
||||||
// e.preventDefault();
|
|
||||||
// e.stopPropagation();
|
|
||||||
boundTimer = (setTimeout(() => {
|
|
||||||
boundTimer = null;
|
|
||||||
return setActiveVar(i);
|
|
||||||
}, LONG_TOUCH_TIME));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function boundTouchEnd(e, i) {
|
|
||||||
if (boundTimer) {
|
|
||||||
clearTimeout(boundTimer);
|
|
||||||
|
|
||||||
if (reclaiming && vbox.bound[i]) sendVboxReclaim(i);
|
|
||||||
else if (vbox.bound[i]) {
|
|
||||||
const insert = combiner.findIndex(j => j === null);
|
|
||||||
if (insert === -1) return setCombiner([i, null, null]);
|
|
||||||
combiner[insert] = i;
|
|
||||||
return setCombiner(combiner);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function boundTouchMove(e) {
|
|
||||||
if (boundTimer) clearTimeout(boundTimer);
|
|
||||||
e.stopPropagation();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function boundClick(e, i) {
|
|
||||||
if (reclaiming && vbox.bound[i]) sendVboxReclaim(i);
|
if (reclaiming && vbox.bound[i]) sendVboxReclaim(i);
|
||||||
|
else if (highlight && activeCryp) sendVboxApply(i);
|
||||||
else if (vbox.bound[i]) {
|
else if (vbox.bound[i]) {
|
||||||
const insert = combiner.findIndex(j => j === null);
|
const insert = combiner.findIndex(j => j === null);
|
||||||
if (insert === -1) return setCombiner([i, null, null]);
|
if (insert === -1) return setCombiner([i, null, null]);
|
||||||
combiner[insert] = i;
|
combiner[insert] = i;
|
||||||
boundTimer = null;
|
|
||||||
return setCombiner(combiner);
|
return setCombiner(combiner);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -141,7 +108,7 @@ function Vbox(args) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const highlight = () => {
|
const highlighted = () => {
|
||||||
if (!value || !info[0] || info[0] !== 'highlight') return false;
|
if (!value || !info[0] || info[0] !== 'highlight') return false;
|
||||||
const v = vboxInfo.vars.find(vi => vi.v === value);
|
const v = vboxInfo.vars.find(vi => vi.v === value);
|
||||||
console.log(v);
|
console.log(v);
|
||||||
@ -150,17 +117,15 @@ function Vbox(args) {
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const highlight = highlighted();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<td
|
<td
|
||||||
key={i}
|
key={i}
|
||||||
draggable="true"
|
draggable="true"
|
||||||
onDragStart={e => e.dataTransfer.setData('text', i)}
|
onDragStart={e => e.dataTransfer.setData('text', i)}
|
||||||
className={`${highlight() ? 'highlight' : ''}`}
|
className={`${highlight ? 'highlight' : ''}`}
|
||||||
onTouchStart={e => boundTouchStart(e, i)}
|
onClick={e => boundClick(e, i, highlight) }>
|
||||||
onTouchEnd={e => boundTouchEnd(e, i)}
|
|
||||||
onTouchMove={e => boundTouchMove(e)}
|
|
||||||
|
|
||||||
onClick={e => boundClick(e, i) }>
|
|
||||||
{convertVar(value)}
|
{convertVar(value)}
|
||||||
</td>
|
</td>
|
||||||
);
|
);
|
||||||
@ -218,7 +183,7 @@ function Vbox(args) {
|
|||||||
return setReclaiming(!reclaiming);
|
return setReclaiming(!reclaiming);
|
||||||
}
|
}
|
||||||
|
|
||||||
const classes = `vbox ${activeVar !== null || activeCryp ? 'hidden' : ''}`;
|
const classes = `vbox`;
|
||||||
const reclaimClass = `instance-btn instance-ui-btn vbox-btn ${reclaiming ? 'reclaiming' : ''}`;
|
const reclaimClass = `instance-btn instance-ui-btn vbox-btn ${reclaiming ? 'reclaiming' : ''}`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@ -18,6 +18,10 @@ const addState = connect(
|
|||||||
vboxInfo,
|
vboxInfo,
|
||||||
} = state;
|
} = state;
|
||||||
|
|
||||||
|
function sendVboxApply(i) {
|
||||||
|
return ws.sendVboxApply(instance.id, activeCryp.id, i);
|
||||||
|
}
|
||||||
|
|
||||||
function sendVboxDiscard() {
|
function sendVboxDiscard() {
|
||||||
return ws.sendVboxDiscard(instance.id);
|
return ws.sendVboxDiscard(instance.id);
|
||||||
}
|
}
|
||||||
@ -47,6 +51,7 @@ const addState = connect(
|
|||||||
sendVboxDiscard,
|
sendVboxDiscard,
|
||||||
sendVboxReclaim,
|
sendVboxReclaim,
|
||||||
sendVboxCombine,
|
sendVboxCombine,
|
||||||
|
sendVboxApply,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user