vbox rearrange, rework reclaim
This commit is contained in:
parent
3dddf4b1a8
commit
7dc4a3f4f4
@ -3,22 +3,21 @@
|
|||||||
align-content: space-between;
|
align-content: space-between;
|
||||||
grid-area: vbox;
|
grid-area: vbox;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-rows: 9em 3em 2em min-content;
|
grid-template-rows: 9.5em 2.5em 4.5em min-content;
|
||||||
grid-template-columns: 7em 25em;
|
grid-template-columns: 7em 21em;
|
||||||
grid-template-areas:
|
grid-template-areas:
|
||||||
"shop-hdr shop"
|
"shop-hdr shop"
|
||||||
"combiner shop"
|
"stash-hdr shop"
|
||||||
"combiner stash"
|
"stash-hdr combiner"
|
||||||
"stash-hdr stash";
|
"stash stash";
|
||||||
border-top: 0.1em solid @gray-exists;
|
border-top: 0.1em solid @gray-exists;
|
||||||
border-right: 0.1em solid @gray-exists;
|
|
||||||
border-bottom: 0.1em solid @gray-exists;
|
border-bottom: 0.1em solid @gray-exists;
|
||||||
|
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
line-height: 0;
|
line-height: 0;
|
||||||
|
|
||||||
.items {
|
.items {
|
||||||
margin-left: 1em;
|
margin-left: 0.5em;
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
margin-top: 0.5em;
|
margin-top: 0.5em;
|
||||||
margin-right: 1em;
|
margin-right: 1em;
|
||||||
@ -27,37 +26,63 @@
|
|||||||
.shop {
|
.shop {
|
||||||
grid-area: shop;
|
grid-area: shop;
|
||||||
border-bottom: 0.1em solid @gray-exists;
|
border-bottom: 0.1em solid @gray-exists;
|
||||||
|
border-right: 0.1em solid @gray-exists;
|
||||||
}
|
}
|
||||||
|
|
||||||
.shop-hdr {
|
.shop-hdr {
|
||||||
grid-area: shop-hdr;
|
grid-area: shop-hdr;
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
border-bottom: 0.1em solid @gray-exists;
|
border-bottom: 0.1em solid @gray-exists;
|
||||||
border-left: 0.1em solid @gray-exists;
|
border-left: 0.1em solid @gray-exists;
|
||||||
|
text-align: center;
|
||||||
|
button {
|
||||||
|
margin-top: 0.5em;
|
||||||
|
line-height: 1.6;
|
||||||
|
height: 4em;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
background-color: #421010;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.combiner {
|
.combiner {
|
||||||
grid-area: combiner;
|
grid-area: combiner;
|
||||||
|
border-bottom: 0.1em solid @gray-exists;
|
||||||
|
border-right: 0.1em solid @gray-exists;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
border-right: 0.1em solid @gray-exists;
|
button {
|
||||||
|
height: 3em;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
background-color: #342100;
|
||||||
|
&[disabled] {
|
||||||
|
color: #342100;
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.stash {
|
.stash {
|
||||||
grid-area: stash;
|
grid-area: stash;
|
||||||
|
.items {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(4, 1fr);
|
||||||
|
grid-gap: 0.5em 1em;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
border-right: 0.1em solid @gray-exists;
|
||||||
|
border-left: 0.1em solid @gray-exists;
|
||||||
}
|
}
|
||||||
|
|
||||||
.stash-hdr {
|
.stash-hdr {
|
||||||
grid-area: stash-hdr;
|
grid-area: stash-hdr;
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: flex-end;
|
|
||||||
border-left: 0.1em solid @gray-exists;
|
border-left: 0.1em solid @gray-exists;
|
||||||
border-top: 0.1em solid @gray-exists;
|
border-right: 0.1em solid @gray-exists;
|
||||||
|
text-align: center;
|
||||||
|
button {
|
||||||
|
margin-top: 0.5em;
|
||||||
|
line-height: 1.6;
|
||||||
|
height: 4em;
|
||||||
|
letter-spacing: 0.1em;
|
||||||
|
background-color: #342100;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.vbox-hdr {
|
.vbox-hdr {
|
||||||
@ -93,14 +118,6 @@
|
|||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
|
||||||
&.reclaim {
|
|
||||||
height: auto;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: @red;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
&[disabled] {
|
&[disabled] {
|
||||||
background: black;
|
background: black;
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
|
|||||||
@ -111,7 +111,7 @@ class InfoComponent extends preact.Component {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={isSkill ? 'info-item' : 'info-item'}>
|
<div class={isSkill ? 'info-item' : 'info-item'}>
|
||||||
<h2>{infoName} {fullInfo.cost}b</h2>
|
<h2>{infoName}</h2>
|
||||||
{header}
|
{header}
|
||||||
{itemSourceInfo}
|
{itemSourceInfo}
|
||||||
{cooldown}
|
{cooldown}
|
||||||
@ -121,10 +121,10 @@ class InfoComponent extends preact.Component {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
const cost = fullInfo.cost ? `- ${fullInfo.cost}b` : false;
|
|
||||||
return (
|
return (
|
||||||
<div class="info-item">
|
<div class="info-item">
|
||||||
<h2>{fullInfo.item} {cost}</h2>
|
<h2>{fullInfo.item}</h2>
|
||||||
{itemDescription()}
|
{itemDescription()}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -253,10 +253,10 @@ class Vbox extends preact.Component {
|
|||||||
<div class='items'>
|
<div class='items'>
|
||||||
<h3
|
<h3
|
||||||
onTouchStart={e => e.target.scrollIntoView(true)}
|
onTouchStart={e => e.target.scrollIntoView(true)}
|
||||||
onMouseOver={e => hoverInfo(e, 'vbox')}> VBOX
|
onMouseOver={e => hoverInfo(e, 'vbox')}> STORE
|
||||||
</h3>
|
</h3>
|
||||||
<div class={`bits ${vbox.bits < 3 ? 'red' : false}`} onMouseOver={e => hoverInfo(e, 'bits')}>
|
<div class={`bits ${vbox.bits < 3 ? 'red' : false}`} onMouseOver={e => hoverInfo(e, 'bits')}>
|
||||||
<h1> {vbox.bits}b </h1>
|
<h2> {vbox.bits}b </h2>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
class='vbox-btn'
|
class='vbox-btn'
|
||||||
@ -291,8 +291,6 @@ class Vbox extends preact.Component {
|
|||||||
const comboHighlight = vboxHighlight && vboxHighlight.includes(v) ? 'combo-border' : '';
|
const comboHighlight = vboxHighlight && vboxHighlight.includes(v) ? 'combo-border' : '';
|
||||||
|
|
||||||
function onClick(type) {
|
function onClick(type) {
|
||||||
if (reclaiming) return sendVboxReclaim(i);
|
|
||||||
|
|
||||||
const combinerContainsIndex = stashSelect.indexOf(i) > -1;
|
const combinerContainsIndex = stashSelect.indexOf(i) > -1;
|
||||||
// removing
|
// removing
|
||||||
if (combinerContainsIndex) {
|
if (combinerContainsIndex) {
|
||||||
@ -360,12 +358,12 @@ class Vbox extends preact.Component {
|
|||||||
let bits = 0;
|
let bits = 0;
|
||||||
shopSelect.forEach(item => bits += item[0] + 1);
|
shopSelect.forEach(item => bits += item[0] + 1);
|
||||||
text = bits
|
text = bits
|
||||||
? <p>Buy<br /> {comboItem} <br/> {bits}b</p>
|
? `Buy ${comboItem} - ${bits}b`
|
||||||
: <p>Combine<br />{comboItem}</p>;
|
: `Combine - ${comboItem}`;
|
||||||
if (vbox.bits >= bits) mouseEvent = sendVboxCombine;
|
if (vbox.bits >= bits) mouseEvent = sendVboxCombine;
|
||||||
} else if (stashSelect.length === 0 && shopSelect.length === 1) {
|
} else if (stashSelect.length === 0 && shopSelect.length === 1) {
|
||||||
const item = shopSelect[0];
|
const item = shopSelect[0];
|
||||||
text = <p>Buy <br/>{vbox.free[item[0]][item[1]]}<br/>{item[0] + 1}b</p>;
|
text = `Buy ${vbox.free[item[0]][item[1]]} ${item[0] + 1}b`;
|
||||||
mouseEvent = vboxBuySelected;
|
mouseEvent = vboxBuySelected;
|
||||||
} else {
|
} else {
|
||||||
for (let i = 0; i < 3; i++) {
|
for (let i = 0; i < 3; i++) {
|
||||||
@ -378,7 +376,7 @@ class Vbox extends preact.Component {
|
|||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<div class='combiner'>
|
<div class='combiner'>
|
||||||
<div clas='items'>
|
<div class='items'>
|
||||||
<button
|
<button
|
||||||
class='vbox-btn'
|
class='vbox-btn'
|
||||||
disabled={!mouseEvent}
|
disabled={!mouseEvent}
|
||||||
@ -407,39 +405,42 @@ class Vbox extends preact.Component {
|
|||||||
onDrop={inventoryClick}
|
onDrop={inventoryClick}
|
||||||
>
|
>
|
||||||
<div class='items'>
|
<div class='items'>
|
||||||
<div class={`vbox-items ${reclaiming ? 'reclaiming' : ''}`}>
|
{range(0, 4).map(i => inventoryBtn(vbox.bound[i], i))}
|
||||||
{range(0, 6).map(i => inventoryBtn(vbox.bound[i], i))}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function inventoryHdr() {
|
function inventoryHdr() {
|
||||||
|
const refund = shopSelect.length === 0 && stashSelect.length === 1
|
||||||
|
? itemInfo.items.find(i => i.item === vbox.bound[stashSelect[0]]).cost
|
||||||
|
: 0;
|
||||||
|
const tutorialDisabled = tutorial && tutorial < 8 && instance.time_control === 'Practice' && instance.rounds.length === 1;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={`stash-hdr ${reclaiming ? 'reclaiming' : ''}`}>
|
<div class={`stash-hdr ${reclaiming ? 'reclaiming' : ''}`}>
|
||||||
<div class='items'>
|
<div class='items'>
|
||||||
<h3
|
<h3
|
||||||
onTouchStart={e => e.target.scrollIntoView(true)}
|
onTouchStart={e => e.target.scrollIntoView(true)}
|
||||||
onMouseOver={e => hoverInfo(e, 'inventory')}> INVENTORY
|
onMouseOver={e => hoverInfo(e, 'inventory')}> STASH
|
||||||
</h3>
|
</h3>
|
||||||
<button
|
<button
|
||||||
disabled={tutorial && tutorial < 8 && instance.time_control === 'Practice' && instance.rounds.length === 1}
|
disabled={tutorialDisabled || !refund}
|
||||||
class='vbox-btn reclaim'
|
class='vbox-btn reclaim'
|
||||||
onMouseOver={e => hoverInfo(e, 'reclaim')}
|
onMouseOver={e => hoverInfo(e, 'reclaim')}
|
||||||
onClick={e => e.stopPropagation()}
|
onClick={e => e.stopPropagation()}
|
||||||
onMouseDown={e => {
|
onMouseDown={e => {
|
||||||
e.stopPropagation()
|
e.stopPropagation();
|
||||||
setReclaiming(!reclaiming)
|
sendVboxReclaim(vboxSelected.stashSelect[0]);
|
||||||
}}>
|
}}>
|
||||||
refund
|
refund <br />
|
||||||
|
{refund}b
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// EVERYTHING
|
// EVERYTHING
|
||||||
//
|
//
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user