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

View File

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

View File

@ -6,7 +6,7 @@ const shapes = require('./shapes');
const buttons = require('./buttons');
const { removeTier } = require('../utils');
function inventoryElement(props) {
function stashElement(props) {
const {
combinerChange,
itemUnequip,
@ -22,15 +22,15 @@ function inventoryElement(props) {
setVboxSelected,
} = props;
function inventoryClick(e) {
function stashClick(e) {
e.stopPropagation();
if (itemUnequip.length) return sendItemUnequip(itemUnequip);
if (vboxSelecting) return vboxBuySelected();
return true;
}
function inventoryBtn(v, i) {
const inventoryHighlight = vboxSelecting || itemUnequip.length;
function stashBtn(v, i) {
const stashHighlight = vboxSelecting || itemUnequip.length;
if (!v && v !== 0) {
const emptyInvClick = () => {
@ -40,8 +40,8 @@ function inventoryElement(props) {
return <button
key={i}
onClick={emptyInvClick}
disabled={!inventoryHighlight}
class={inventoryHighlight ? 'receiving' : 'empty'} >&nbsp;</button>;
disabled={!stashHighlight}
class={stashHighlight ? 'receiving' : 'empty'} >&nbsp;</button>;
}
const comboHighlight = vboxHighlight && vboxHighlight.includes(v) ? 'combo-border' : '';
@ -94,16 +94,16 @@ function inventoryElement(props) {
return (
<div
class='stash'
onMouseDown={inventoryClick}
onMouseDown={stashClick}
onClick={e => e.stopPropagation()}
onDragOver={ev => ev.preventDefault()}
onDrop={inventoryClick}
onDrop={stashClick}
>
<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>
);
}
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 />
The <b>VBOX</b> is refilled every round.<br />Click <b>REFILL</b> at the bottom to purchase a refill. </p>,
},
inventory: {
item: 'INVENTORY',
stash: {
item: 'STASH',
description: <p>Holds <b>ITEMS</b><br /><b>ITEMS</b> carry over each round.</p>,
},
bits: {
@ -60,7 +60,7 @@ module.exports = {
},
constructSkills: {
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: {
item: 'SPECS',

View File

@ -138,7 +138,7 @@ function tutorialStage(tutorial, ws, clearTutorial, instance) {
<h2>Tutorial</h2>
<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> 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>
</div>
);
@ -161,7 +161,7 @@ function tutorialStage(tutorial, ws, clearTutorial, instance) {
<h2>Tutorial</h2>
<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> 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>
</div>
);