vbox second buy method
This commit is contained in:
parent
0c8f0f819c
commit
3bb0dcca3e
@ -348,7 +348,7 @@
|
|||||||
// opacity: 0;
|
// opacity: 0;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
.equipping {
|
.equipping, .receiving {
|
||||||
transition: border-color 0.5s ease-in;
|
transition: border-color 0.5s ease-in;
|
||||||
border-color: whitesmoke;
|
border-color: whitesmoke;
|
||||||
border-width: 2px;
|
border-width: 2px;
|
||||||
|
|||||||
@ -98,7 +98,7 @@ function Vbox(args) {
|
|||||||
sendVboxCombine,
|
sendVboxCombine,
|
||||||
sendVboxDiscard,
|
sendVboxDiscard,
|
||||||
sendVboxReclaim,
|
sendVboxReclaim,
|
||||||
vboxHighlight,
|
// vboxHighlight,
|
||||||
|
|
||||||
setCombiner,
|
setCombiner,
|
||||||
setInfo,
|
setInfo,
|
||||||
@ -114,6 +114,7 @@ function Vbox(args) {
|
|||||||
|
|
||||||
if (!player) return false;
|
if (!player) return false;
|
||||||
const { vbox } = player;
|
const { vbox } = player;
|
||||||
|
const vboxSelecting = vboxSelected.length;
|
||||||
|
|
||||||
// function setHighlight(type) {
|
// function setHighlight(type) {
|
||||||
// if (type === 'skill') return setVboxHighlight(itemInfo.items.filter(v => v.skill).map(v => v.item));
|
// if (type === 'skill') return setVboxHighlight(itemInfo.items.filter(v => v.skill).map(v => v.item));
|
||||||
@ -157,23 +158,34 @@ function Vbox(args) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function vboxBuySelected() {
|
||||||
|
if (!vboxSelecting) return false;
|
||||||
|
document.activeElement.blur();
|
||||||
|
setVboxSelected([]);
|
||||||
|
sendVboxAccept(vboxSelected[0], vboxSelected[1]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
function availableBtn(v, group, index) {
|
function availableBtn(v, group, index) {
|
||||||
if (!v) return <button disabled class='empty' > </button>;
|
if (!v) return <button disabled class='empty' > </button>;
|
||||||
|
|
||||||
|
const selected = vboxSelected[0] === group && vboxSelected[1] === index;
|
||||||
|
|
||||||
function onClick() {
|
function onClick() {
|
||||||
// double clicked
|
// double clicked
|
||||||
if (vboxSelected[0] === group && vboxSelected[1] === index) {
|
if (selected) {
|
||||||
document.activeElement.blur();
|
return vboxBuySelected();
|
||||||
setVboxSelected([]);
|
|
||||||
return sendVboxAccept(group, index);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return setVboxSelected([group, index]);
|
return setVboxSelected([group, index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const classes = `${selected ? 'highlight' : ''}`;
|
||||||
|
|
||||||
if (shapes[v]) {
|
if (shapes[v]) {
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
|
class={classes}
|
||||||
onMouseOver={e => vboxHover(e, v)}
|
onMouseOver={e => vboxHover(e, v)}
|
||||||
onClick={onClick}>
|
onClick={onClick}>
|
||||||
{shapes[v]()}
|
{shapes[v]()}
|
||||||
@ -183,6 +195,7 @@ function Vbox(args) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
|
class={classes}
|
||||||
onClick={onClick}
|
onClick={onClick}
|
||||||
onMouseOver={e => vboxHover(e, v)}>
|
onMouseOver={e => vboxHover(e, v)}>
|
||||||
{v}
|
{v}
|
||||||
@ -254,7 +267,9 @@ function Vbox(args) {
|
|||||||
const reclaimClass = `vbox-btn reclaim ${reclaiming ? 'reclaiming' : ''}`;
|
const reclaimClass = `vbox-btn reclaim ${reclaiming ? 'reclaiming' : ''}`;
|
||||||
|
|
||||||
function inventoryBtn(v, i) {
|
function inventoryBtn(v, i) {
|
||||||
if (!v && v !== 0) return <button disabled class='empty' > </button>;
|
if (!v && v !== 0) {
|
||||||
|
return <button disabled={!vboxSelecting} class={vboxSelecting ? 'receiving' : 'empty'} > </button>;
|
||||||
|
}
|
||||||
|
|
||||||
function onClick(e) {
|
function onClick(e) {
|
||||||
if (reclaiming) return sendVboxReclaim(i);
|
if (reclaiming) return sendVboxReclaim(i);
|
||||||
@ -319,9 +334,15 @@ function Vbox(args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function inventoryElement() {
|
function inventoryElement() {
|
||||||
|
function inventoryClick() {
|
||||||
|
setReclaiming(false);
|
||||||
|
if (vboxSelecting) vboxBuySelected();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class='vbox-section'
|
<div class='vbox-section'
|
||||||
onClick={() => setReclaiming(false)}
|
onClick={inventoryClick}
|
||||||
onMouseOver={e => hoverInfo(e, 'inventory')}>
|
onMouseOver={e => hoverInfo(e, 'inventory')}>
|
||||||
<div class="vbox-hdr">
|
<div class="vbox-hdr">
|
||||||
<h3 onTouchStart={e => e.target.scrollIntoView(true)}>INVENTORY</h3>
|
<h3 onTouchStart={e => e.target.scrollIntoView(true)}>INVENTORY</h3>
|
||||||
@ -343,8 +364,6 @@ function Vbox(args) {
|
|||||||
//
|
//
|
||||||
// EVERYTHING
|
// EVERYTHING
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
function hoverInfo(e, info) {
|
function hoverInfo(e, info) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
return setInfo(info);
|
return setInfo(info);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user