Return of the cryp stats

This commit is contained in:
Mashy 2019-05-11 16:05:24 +10:00
parent b940e63a5c
commit cc04738902
4 changed files with 45 additions and 18 deletions

View File

@ -7,7 +7,7 @@
grid-template-columns: repeat(12, 1fr); grid-template-columns: repeat(12, 1fr);
grid-template-rows: repeat(11, 1fr); grid-template-rows: repeat(11, 1fr);
grid-template-areas: grid-template-areas:
"n v v v v v v v x x x x" ". v v v v v v v x x x x"
"n v v v v v v v x x x x" "n v v v v v v v x x x x"
"n v v v v v v v x x x x" "n v v v v v v v x x x x"
"n v v v v v v v x x x x" "n v v v v v v v x x x x"
@ -23,7 +23,7 @@
.instance-hdr { .instance-hdr {
grid-area: n; grid-area: n;
display: flex; display: flex;
flex-flow: row; flex-flow: column;
flex: 0 0 100%; flex: 0 0 100%;
} }
@ -180,15 +180,14 @@
.instance-cryp { .instance-cryp {
display: grid; display: grid;
grid-template-columns: repeat(5, 1fr); grid-template-columns: repeat(5, 1fr);
grid-template-rows: repeat(4, 1fr); grid-template-rows: repeat(5, 1fr);
grid-template-areas: grid-template-areas:
"sp sp sp sp sp"
"av av av sk sk" "av av av sk sk"
"av av av sk sk" "av av av sk sk"
"av av av sk sk" "av av av sk sk"
"sp sp sp sp sp"; "st st st st st";
max-width: 350px;
max-height: 350px;
margin-left: 1em; margin-left: 1em;
border: 1px solid whitesmoke; border: 1px solid whitesmoke;
transition-property: all; transition-property: all;
@ -201,12 +200,11 @@
grid-area: av; grid-area: av;
display: flex; display: flex;
flex: 1 1 auto; flex: 1 1 auto;
justify-content: center;
} }
.instance-cryp .avatar figure { .instance-cryp .avatar figure {
margin: 0; margin: 0;
height: 75%; height: 100%;
text-align: center; text-align: center;
box-sizing: border-box; box-sizing: border-box;
} }
@ -215,12 +213,23 @@
font-size: 90%; font-size: 90%;
} }
.instance-cryp .skills {
grid-area: sk;
display: flex;
flex-flow: column;
}
.instance-cryp .skills button {
height: 100%;
width: 100%;
}
.instance-cryp .specs { .instance-cryp .specs {
grid-area: sp; grid-area: sp;
display: flex; display: flex;
flex: 1; flex: 1;
justify-content: center; justify-content: center;
border-top: 1px solid whitesmoke; border-bottom: 1px solid whitesmoke;
} }
.instance-cryp .specs figure { .instance-cryp .specs figure {
@ -235,13 +244,22 @@
font-size: 75%; font-size: 75%;
} }
.instance-cryp .skills { .instance-cryp .stats {
grid-area: sk; grid-area: st;
display: flex; display: flex;
flex-flow: column; flex: 1;
justify-content: center;
border-top: 1px solid whitesmoke;
} }
.instance-cryp .skills button { .instance-cryp .stats figure {
height: 100%; flex: 1;
width: 100%; border: 0;
align-items: center;
padding: 0.5em 0 0 0;
text-align: center;
}
.instance-cryp .stats figcaption {
font-size: 75%;
} }

View File

@ -88,8 +88,8 @@ function InstanceComponent(args) {
<div>&nbsp;</div> <div>&nbsp;</div>
</div> </div>
{actionBtn} {actionBtn}
</div>
{timer} {timer}
</div>
<VboxContainer /> <VboxContainer />
<InstanceCrypsContainer /> <InstanceCrypsContainer />
<InfoContainer /> <InfoContainer />

View File

@ -3,7 +3,7 @@ const preact = require('preact');
const range = require('lodash/range'); const range = require('lodash/range');
const shapes = require('./shapes'); const shapes = require('./shapes');
const { SPECS, crypAvatar } = require('../utils'); const { SPECS, STATS, crypAvatar } = require('../utils');
const actions = require('../actions'); const actions = require('../actions');
const addState = connect( const addState = connect(
@ -119,6 +119,12 @@ function Cryp(props) {
); );
}); });
const stats = Object.values(STATS).map((s, j) => (
<figure key={j} alt={s.stat} className={s.stat}>
{s.svg(`stat-icon ${s.colour}`)}
<figcaption>{cryp[s.stat].value}</figcaption>
</figure>
));
// const cTotal = cryp.colours.red + cryp.colours.blue + cryp.colours.green; // const cTotal = cryp.colours.red + cryp.colours.blue + cryp.colours.green;
// const colours = mapValues(cryp.colours, c => { // const colours = mapValues(cryp.colours, c => {
// if (cTotal === 0) return 245; // if (cTotal === 0) return 245;
@ -147,6 +153,9 @@ function Cryp(props) {
<div className="specs"> <div className="specs">
{specs} {specs}
</div> </div>
<div className="stats">
{stats}
</div>
</div> </div>
); );
} }

View File

@ -65,13 +65,13 @@ function crypAvatar(name) {
const NULL_UUID = '00000000-0000-0000-0000-000000000000'; const NULL_UUID = '00000000-0000-0000-0000-000000000000';
const STATS = { const STATS = {
speed: { stat: 'speed', colour: 'white', svg: shapes.triangle },
redDamage: { stat: 'red_damage', colour: 'red', svg: shapes.circle }, redDamage: { stat: 'red_damage', colour: 'red', svg: shapes.circle },
greenDamage: { stat: 'green_damage', colour: 'green', svg: shapes.circle }, greenDamage: { stat: 'green_damage', colour: 'green', svg: shapes.circle },
blueDamage: { stat: 'blue_damage', colour: 'blue', svg: shapes.circle }, blueDamage: { stat: 'blue_damage', colour: 'blue', svg: shapes.circle },
redLife: { stat: 'red_life', colour: 'red', svg: shapes.square }, redLife: { stat: 'red_life', colour: 'red', svg: shapes.square },
greenLife: { stat: 'green_life', colour: 'green', svg: shapes.square }, greenLife: { stat: 'green_life', colour: 'green', svg: shapes.square },
blueLife: { stat: 'blue_life', colour: 'blue', svg: shapes.square }, blueLife: { stat: 'blue_life', colour: 'blue', svg: shapes.square },
speed: { stat: 'speed', colour: 'white', svg: shapes.triangle },
}; };
const SPECS = { const SPECS = {