vbox phase done

This commit is contained in:
ntr 2019-09-09 19:39:43 +10:00
parent f1765af14e
commit 1b8e565455
2 changed files with 87 additions and 24 deletions

View File

@ -117,19 +117,39 @@ section {
} }
.demo { .demo {
margin-top: 5em; margin-top: 1em;
display: grid;
grid-template-areas:
"vinfo game"
"vcons game";
grid-template-columns: 1fr 1fr;
.colour-info { .colour-info {
display: grid; grid-area: vinfo;
grid-template-columns: 2fr 1fr; display: flex;
align-items: center;
div { div {
display: flex; display: flex;
} }
}
svg { svg {
flex: 1; flex: 1;
display: inline; height: 1em;
}
}
.game {
grid-area: game;
}
.construct-list {
grid-area: vcons;
svg {
height: 100%;
}
} }
} }

View File

@ -8,9 +8,15 @@ function Demo(args) {
const items = this.state.items || ['Red', 'Red', 'Attack']; const items = this.state.items || ['Red', 'Red', 'Attack'];
const combiner = this.state.combiner || []; const combiner = this.state.combiner || [];
const {
equipping,
equipped,
} = this.state;
console.log(combiner, this.state); console.log(combiner, this.state);
function inventoryBtn(i, j) { function inventoryBtn(i, j) {
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' : ''}`;
@ -47,53 +53,90 @@ function Demo(args) {
function inventoryElement() { function inventoryElement() {
return ( return (
<div class="vbox">
<div class='vbox-section'> <div class='vbox-section'>
<h2>VBOX PHASE</h2> <h2 class='colour-info'>
<div class='colour-info'> VBOX PHASE {shapes.Red()} {shapes.Green()} {shapes.Blue()}
</h2>
<p> <p>
combine the colour base items with an array of skills and specialisations to build powerful variants. combine the colour base items with an array of skills and specialisations to build powerful variants.
</p> </p>
<div>
{shapes.Red()} {shapes.Green()} {shapes.Blue()}
</div>
</div> </div>
<div>&nbsp;</div>
<div class='vbox-section'>
<div class='vbox-items'> <div class='vbox-items'>
{items.map((i, j) => inventoryBtn(i, j))} {items.map((i, j) => inventoryBtn(i, j))}
</div> </div>
{combinerBtn()} {combinerBtn()}
</div> </div>
</div>
); );
} }
// progress // progress
setTimeout(() => { setTimeout(() => {
if (equipped) {
return this.setState({ combiner: [], items: ['Red', 'Red', 'Attack'], equipped: false, equipping: false });
}
if (items.length === 1 && combiner[0] === 0) {
return this.setState({ combiner: [], items: [''], equipped: true, equipping: false });
}
if (items.length === 1) { if (items.length === 1) {
this.setState({ combiner: [], items: ['Red', 'Red', 'Attack'], phase: 'game' }); return this.setState({ combiner: [0], items: ['Strike'], equipping: true });
return true;
} }
if (combiner.length === 3) { if (combiner.length === 3) {
this.setState({ combiner: [], items: ['Strike'] }); return this.setState({ combiner: [], items: ['Strike'] });
return true;
} }
combiner.push(combiner.length); combiner.push(combiner.length);
this.setState({ combiner }); this.setState({ combiner });
return true; return true;
}, 2000); }, 1500);
const skills = ['Strike'];
const btnClass = equipping
? 'equipping empty gray'
: 'empty gray';
return ( return (
<div class="vbox demo"> <div class="news">
{inventoryElement()} {inventoryElement()}
<div class='construct-list'>
{[0, 1, 2].map(i => (
<div class="instance-construct" key={i}>
{molecule()}
<h2 class="name" ></h2>
<div class="skills">
{i === 0 && this.state.equipped
? <button>Strike</button>
: <button disabled={!equipping} class={btnClass}>SKILL</button>
}
<button disabled={!equipping} class={btnClass}>SKILL</button>
<button disabled={!equipping} class={btnClass}>SKILL</button>
</div>
<div class="specs">
</div>
<div class="stats">
</div>
</div>
))}
</div>
</div> </div>
); );
}; };
return ( return (
<div> <section class='demo'>
{vboxDemo()} {vboxDemo()}
<div class='construct-list'></div> <div class="game">
<h2>GAME PHASE</h2>
</div> </div>
</section>
); );
} }