inventory -> stash

This commit is contained in:
Mashy 2019-11-22 10:06:39 +10:00
parent 945f0828c1
commit a353dcca95
5 changed files with 24 additions and 24 deletions

View File

@ -46,7 +46,7 @@ function Demo(args) {
const { combiner, items, equipping, equipped, players, combo } = demo; const { combiner, items, equipping, equipped, players, combo } = demo;
const vboxDemo = () => { const vboxDemo = () => {
function inventoryBtn(i, j) { function stashBtn(i, j) {
if (!i) return <button disabled class='empty' >&nbsp;</button>; if (!i) return <button disabled class='empty' >&nbsp;</button>;
const highlighted = combiner.indexOf(j) > -1; const highlighted = combiner.indexOf(j) > -1;
const classes = `${highlighted ? 'highlight' : ''}`; const classes = `${highlighted ? 'highlight' : ''}`;
@ -82,7 +82,7 @@ function Demo(args) {
); );
} }
function inventoryElement() { function stashElement() {
return ( return (
<div class="vbox"> <div class="vbox">
<div class='vbox-section'> <div class='vbox-section'>
@ -96,7 +96,7 @@ function Demo(args) {
<div>&nbsp;</div> <div>&nbsp;</div>
<div class='vbox-section'> <div class='vbox-section'>
<div class='vbox-items'> <div class='vbox-items'>
{items.map((i, j) => inventoryBtn(i, j))} {items.map((i, j) => stashBtn(i, j))}
</div> </div>
{combinerBtn()} {combinerBtn()}
</div> </div>
@ -106,7 +106,7 @@ function Demo(args) {
return ( return (
<div class="news vbox-demo"> <div class="news vbox-demo">
{inventoryElement()} {stashElement()}
</div> </div>
); );
}; };

View File

@ -5,7 +5,7 @@ const forEach = require('lodash/forEach');
const actions = require('../actions'); const actions = require('../actions');
const InventoryElement = require('./vbox.inventory'); const StashElement = require('./vbox.stash');
const StoreElement = require('./vbox.store'); const StoreElement = require('./vbox.store');
const CombinerElement = require('./vbox.combiner'); const CombinerElement = require('./vbox.combiner');
@ -202,12 +202,12 @@ class Vbox extends preact.Component {
); );
} }
function inventoryHdr() { function stashHdr() {
return ( return (
<div class='stash-hdr'> <div class='stash-hdr'>
<div class='vbox-padding'> <div class='vbox-padding'>
<h3 onTouchStart={e => e.target.scrollIntoView(true)} <h3 onTouchStart={e => e.target.scrollIntoView(true)}
onMouseOver={e => vboxHover(e, 'inventory')}> STASH onMouseOver={e => vboxHover(e, 'stash')}> STASH
</h3> </h3>
</div> </div>
</div> </div>
@ -242,7 +242,7 @@ class Vbox extends preact.Component {
return ( return (
<div class='vbox'> <div class='vbox'>
{vboxHdr()} {vboxHdr()}
{inventoryHdr()} {stashHdr()}
{refundBtn()} {refundBtn()}
<StoreElement <StoreElement
clearVboxSelected = {clearVboxSelected} clearVboxSelected = {clearVboxSelected}
@ -254,7 +254,7 @@ class Vbox extends preact.Component {
vboxHighlight = {vboxHighlight} vboxHighlight = {vboxHighlight}
vboxHover = {vboxHover} vboxHover = {vboxHover}
/> />
<InventoryElement <StashElement
combinerChange = {combinerChange} combinerChange = {combinerChange}
itemUnequip = {itemUnequip} itemUnequip = {itemUnequip}
vbox = {vbox} vbox = {vbox}

View File

@ -6,7 +6,7 @@ const shapes = require('./shapes');
const buttons = require('./buttons'); const buttons = require('./buttons');
const { removeTier } = require('../utils'); const { removeTier } = require('../utils');
function inventoryElement(props) { function stashElement(props) {
const { const {
combinerChange, combinerChange,
itemUnequip, itemUnequip,
@ -22,15 +22,15 @@ function inventoryElement(props) {
setVboxSelected, setVboxSelected,
} = props; } = props;
function inventoryClick(e) { function stashClick(e) {
e.stopPropagation(); e.stopPropagation();
if (itemUnequip.length) return sendItemUnequip(itemUnequip); if (itemUnequip.length) return sendItemUnequip(itemUnequip);
if (vboxSelecting) return vboxBuySelected(); if (vboxSelecting) return vboxBuySelected();
return true; return true;
} }
function inventoryBtn(v, i) { function stashBtn(v, i) {
const inventoryHighlight = vboxSelecting || itemUnequip.length; const stashHighlight = vboxSelecting || itemUnequip.length;
if (!v && v !== 0) { if (!v && v !== 0) {
const emptyInvClick = () => { const emptyInvClick = () => {
@ -40,8 +40,8 @@ function inventoryElement(props) {
return <button return <button
key={i} key={i}
onClick={emptyInvClick} onClick={emptyInvClick}
disabled={!inventoryHighlight} disabled={!stashHighlight}
class={inventoryHighlight ? 'receiving' : 'empty'} >&nbsp;</button>; class={stashHighlight ? 'receiving' : 'empty'} >&nbsp;</button>;
} }
const comboHighlight = vboxHighlight && vboxHighlight.includes(v) ? 'combo-border' : ''; const comboHighlight = vboxHighlight && vboxHighlight.includes(v) ? 'combo-border' : '';
@ -94,16 +94,16 @@ function inventoryElement(props) {
return ( return (
<div <div
class='stash' class='stash'
onMouseDown={inventoryClick} onMouseDown={stashClick}
onClick={e => e.stopPropagation()} onClick={e => e.stopPropagation()}
onDragOver={ev => ev.preventDefault()} onDragOver={ev => ev.preventDefault()}
onDrop={inventoryClick} onDrop={stashClick}
> >
<div class='vbox-padding'> <div class='vbox-padding'>
{range(0, 4).map(i => inventoryBtn(vbox.bound[i], i))} {range(0, 4).map(i => stashBtn(vbox.bound[i], i))}
</div> </div>
</div> </div>
); );
} }
module.exports = inventoryElement; module.exports = stashElement;

View File

@ -29,8 +29,8 @@ module.exports = {
description: <p><b>ITEMS</b> that are available to buy.<br /> description: <p><b>ITEMS</b> that are available to buy.<br />
The <b>VBOX</b> is refilled every round.<br />Click <b>REFILL</b> at the bottom to purchase a refill. </p>, The <b>VBOX</b> is refilled every round.<br />Click <b>REFILL</b> at the bottom to purchase a refill. </p>,
}, },
inventory: { stash: {
item: 'INVENTORY', item: 'STASH',
description: <p>Holds <b>ITEMS</b><br /><b>ITEMS</b> carry over each round.</p>, description: <p>Holds <b>ITEMS</b><br /><b>ITEMS</b> carry over each round.</p>,
}, },
bits: { bits: {
@ -60,7 +60,7 @@ module.exports = {
}, },
constructSkills: { constructSkills: {
item: 'SKILLS', item: 'SKILLS',
description: 'Skills are used by constructs in the game phase.\nBase skills can be bought from the VBOX.\nEquip skills from the inventory. Double-click to unequip.', description: 'Skills are used by constructs in the game phase.\nBase skills can be bought from the VBOX.\nEquip skills from the stash. Double-click to unequip.',
}, },
constructSpecs: { constructSpecs: {
item: 'SPECS', item: 'SPECS',

View File

@ -138,7 +138,7 @@ function tutorialStage(tutorial, ws, clearTutorial, instance) {
<h2>Tutorial</h2> <h2>Tutorial</h2>
<p> The first construct on your team is <b>{constructOne}</b>. </p> <p> The first construct on your team is <b>{constructOne}</b>. </p>
<p> Skill items can be equipped to your constructs to be used in the combat phase. </p> <p> Skill items can be equipped to your constructs to be used in the combat phase. </p>
<p> Click the newly combined skill item in the top right of the inventory. <br /> <p> Click the newly combined skill from the stash. <br />
Once selected click the construct <b>SKILL</b> slot to equip the skill. </p> Once selected click the construct <b>SKILL</b> slot to equip the skill. </p>
</div> </div>
); );
@ -161,7 +161,7 @@ function tutorialStage(tutorial, ws, clearTutorial, instance) {
<h2>Tutorial</h2> <h2>Tutorial</h2>
<p> Equipping specialisation items will increase the stats of your constructs.</p> <p> Equipping specialisation items will increase the stats of your constructs.</p>
<p> These can also be combined with colours for further specialisation. </p> <p> These can also be combined with colours for further specialisation. </p>
<p> Click the specialisation item in the top right of the inventory.<br /> <p> Click the specialisation item from the stash.<br />
Once selected click the construct <b>SPEC</b> slot to equip the specialisation. </p> Once selected click the construct <b>SPEC</b> slot to equip the specialisation. </p>
</div> </div>
); );