vbox hints

This commit is contained in:
ntr 2019-05-05 16:18:34 +10:00
parent 648311cdcf
commit b53faf9610
3 changed files with 38 additions and 22 deletions

View File

@ -166,6 +166,11 @@ img {
stroke: #6AD1BF; stroke: #6AD1BF;
} }
.gray {
color: #333;
stroke: #333;
}
/* /*
LOGIN LOGIN
*/ */
@ -464,9 +469,9 @@ button[disabled] {
.vbox-btn { .vbox-btn {
flex: 1 0 100%; flex: 1 0 100%;
margin: 0; margin: 0;
padding: 0 0.5em;
background-color: whitesmoke; background-color: whitesmoke;
color: black; color: black;
border-width: 0;
} }
.vbox-btn:hover { .vbox-btn:hover {
@ -710,7 +715,7 @@ table td svg {
border-top-width: 1px; border-top-width: 1px;
} }
.instance-cryp:first-child { .instance-cryp button:first-child {
border-top-width: 0; border-top-width: 0;
} }

View File

@ -107,19 +107,19 @@ function Cryp(props) {
); );
}); });
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;
return Math.floor(c / cTotal * 255); // return Math.floor(c / cTotal * 255);
}); // });
const alpha = cTotal === 0 ? 1 : 0.75; // const alpha = cTotal === 0 ? 1 : 0.75;
const thickness = total => { // const thickness = total => {
if (total < 3) return 1; // if (total < 3) return 1;
if (total < 6) return 2; // if (total < 6) return 2;
if (total < 9) return 3; // if (total < 9) return 3;
return 4; // return 4;
}; // };
const border = { border: `${thickness(cTotal)}px solid rgba(${colours.red}, ${colours.green}, ${colours.blue}, ${alpha})` }; // const border = { border: `${thickness(cTotal)}px solid rgba(${colours.red}, ${colours.green}, ${colours.blue}, ${alpha})` };
return ( return (
<div <div
@ -127,7 +127,6 @@ function Cryp(props) {
className="instance-cryp" className="instance-cryp"
onDragOver={onDragOver} onDragOver={onDragOver}
onDrop={onDrop} onDrop={onDrop}
style={border}
> >
<div className="instance-cryp-top"> <div className="instance-cryp-top">
<figure className="img" onClick={onClick}> <figure className="img" onClick={onClick}>
@ -148,6 +147,7 @@ function Cryp(props) {
function InstanceCryps(props) { function InstanceCryps(props) {
const { const {
player, player,
instance,
activeCryp, activeCryp,
activeVar, activeVar,
@ -159,9 +159,10 @@ function InstanceCryps(props) {
} = props; } = props;
if (!player) return false; if (!player) return false;
if (instance.phase === 'Lobby') return false;
const infoSelected = activeVar !== null || activeCryp; const infoSelected = activeVar !== null || activeCryp;
const crypListClass = `cryp-list ${infoSelected ? '' : 'hidden'}`; const crypListClass = `cryp-list`;
const cryps = player.cryps.map((c, i) => Cryp({ const cryps = player.cryps.map((c, i) => Cryp({
cryp: c, sendVboxApply, setInfo, activeVar, setActiveCryp, cryp: c, sendVboxApply, setInfo, activeVar, setActiveCryp,

View File

@ -22,7 +22,7 @@ function Vbox(args) {
activeVar, activeVar,
activeCryp, activeCryp,
player, player,
// instance, instance,
combiner, combiner,
reclaiming, reclaiming,
sendVboxAccept, sendVboxAccept,
@ -36,6 +36,7 @@ function Vbox(args) {
} = args; } = args;
if (!player) return false; if (!player) return false;
if (instance.phase === 'Lobby') return false;
const { vbox } = player; const { vbox } = player;
// //
@ -130,7 +131,10 @@ function Vbox(args) {
function boundClick(e, i) { function boundClick(e, i) {
if (reclaiming && vbox.bound[i]) sendVboxReclaim(i); if (reclaiming && vbox.bound[i]) sendVboxReclaim(i);
else if (vbox.bound[i]) { else if (vbox.bound[i]) {
const insert = combiner.findIndex(j => j === null); const insert = ['Red', 'Green', 'Blue'].includes(vbox.bound[i])
? combiner.findIndex(j => j === null)
: 2;
if (insert === -1) return setCombiner([i, null, null]); if (insert === -1) return setCombiner([i, null, null]);
combiner[insert] = i; combiner[insert] = i;
boundTimer = null; boundTimer = null;
@ -193,9 +197,15 @@ function Vbox(args) {
<table className="vbox-table"> <table className="vbox-table">
<tbody> <tbody>
<tr> <tr>
<td onClick={() => combinerRmv(0)}>{convertVar(vbox.bound[combiner[0]])}</td> <td onClick={() => combinerRmv(0)}>
<td onClick={() => combinerRmv(1)}>{convertVar(vbox.bound[combiner[1]])}</td> {combiner[0] !== null ? convertVar(vbox.bound[combiner[0]]) : shapes.vboxColour('gray')}
<td onClick={() => combinerRmv(2)}>{convertVar(vbox.bound[combiner[2]])}</td> </td>
<td onClick={() => combinerRmv(1)}>
{combiner[1] !== null ? convertVar(vbox.bound[combiner[1]]) : shapes.vboxColour('gray')}
</td>
<td onClick={() => combinerRmv(2)}>
{convertVar(vbox.bound[combiner[2]])}
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>