Merge branch 'return-of-react' of ssh://cryps.gg:40022/~/cryps into return-of-react

This commit is contained in:
Mashy 2019-03-29 12:40:07 +10:00
commit e9817f75e0
9 changed files with 168 additions and 28 deletions

View File

@ -6,7 +6,9 @@ body {
font-family: 'Jura'; font-family: 'Jura';
color: whitesmoke; color: whitesmoke;
font-size: 16pt; font-size: 16pt;
padding: 1em; padding: 1em 2em;
overflow: hidden;
user-select: none;
} }
button, input { button, input {
@ -29,7 +31,7 @@ button:hover {
MENU MENU
*/ */
.header { .header {
margin-bottom: 2em; margin-bottom: 1.5em;
} }
.home-cryp { .home-cryp {
@ -61,16 +63,15 @@ button:hover {
text-align: right; text-align: right;
} }
.ping-svg { .header-status svg {
background-color: black; margin-left: 1em;
height: 1em; height: 1em;
margin-right: 1em; background-color: black;
} }
.ping-path { .ping-path {
stroke: #f5f5f5;
fill: none; fill: none;
stroke-width: 4; stroke-width: 4px;
stroke-dasharray: 121, 242; stroke-dasharray: 121, 242;
animation: pulse 2s infinite linear; animation: pulse 2s infinite linear;
} }
@ -142,12 +143,24 @@ button:hover {
padding: 0; padding: 0;
} }
.vbox-hdr {
display: flex;
align-items: flex-end;
}
.vbox-hdr div {
flex-grow: 1;
}
.vbox-hdr h3 {
margin: 0;
}
.vbox-btn { .vbox-btn {
margin: 0; margin: 0;
padding: 0.5em; padding: 0.5em;
background-color: whitesmoke; background-color: whitesmoke;
color: black; color: black;
user-select: none;
} }
.vbox-btn:hover { .vbox-btn:hover {
@ -174,4 +187,57 @@ button:hover {
.spacer { .spacer {
min-width: 100%; min-width: 100%;
} }
/* CRYP BOX */
.cryp-box {
display: flex;
flex-wrap: wrap;
/*
this controls the size of the box
as it fills the whole container
*/
padding: 0 2em 0 0;
margin: 0 0 2em 0;
}
.cryp-box figure {
margin: 0;
flex-grow: 1;
border: 1px solid whitesmoke;
}
.cryp-box .skills {
width: 50%;
}
.cryp-skill-btn {
font-size: 125%;
border-width: 1px;
width: 100%;
height: 25%;
padding: 0;
margin: 0;
border-left-width: 0px;
border-bottom-width: 0px;
}
.cryp-skill-btn:last-child {
border-bottom-width: 1px;
}
.cryp-box .stats {
display: flex;
width: 100%;
text-align: center;
}
.cryp-box .stats figure {
border-top-width: 0;
flex: 1 1 0;
}
.cryp-box .stats svg {
height: 1em;
stroke-width: 2px;
}

View File

@ -4,7 +4,7 @@
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"start": "parcel index.html --port 40080", "start": "parcel index.html --port 40080 --no-hmr --no-source-maps",
"build": "rm -rf dist && parcel build index.html", "build": "rm -rf dist && parcel build index.html",
"lint": "eslint --fix --ext .jsx src/", "lint": "eslint --fix --ext .jsx src/",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"

View File

@ -1,7 +1,49 @@
const preact = require('preact'); const preact = require('preact');
// const key = require('keymaster'); // const key = require('keymaster');
const range = require('lodash/range');
const VboxContainer = require('./vbox.container'); const VboxContainer = require('./vbox.container');
const molecule = require('./molecule');
const saw = require('./saw.component');
function Cryp(cryp) {
const skills = range(0, 4).map((i) => {
const s = cryp.skills[i]
? cryp.skills[i].skill
: (<span>&nbsp;</span>);
return <button key={i} className="cryp-skill-btn" >{s}</button>;
});
const stats = [
{ stat: 'hp', colour: '#1FF01F' },
{ stat: 'green_damage', colour: '#1FF01F' },
{ stat: 'red_shield', colour: '#a52a2a' },
{ stat: 'red_damage', colour: '#a52a2a' },
{ stat: 'blue_shield', colour: '#3498db' },
{ stat: 'blue_damage', colour: '#3498db' },
{ stat: 'speed', colour: '#FFD123' },
].map((s, i) => (
<figure key={i} >
{saw(s.colour)}
<figcaption>{cryp[s.stat].value}</figcaption>
</figure>
));
return (
<div className="cryp-box">
<figure className="img">
{molecule}
</figure>
<div className="skills">
{skills}
</div>
<div className="stats">
{stats}
</div>
</div>
);
}
function InstanceComponent(args) { function InstanceComponent(args) {
const { const {
@ -13,6 +55,8 @@ function InstanceComponent(args) {
if (!instance) return <div>...</div>; if (!instance) return <div>...</div>;
const cryps = instance.cryps.map(Cryp);
return ( return (
<section> <section>
<div className="row"> <div className="row">
@ -24,7 +68,7 @@ function InstanceComponent(args) {
</button> </button>
</div> </div>
<div className="six columns"> <div className="six columns">
<h4>next game against: mmmmmashy</h4> <div>&nbsp;</div>
</div> </div>
<div className="three columns"> <div className="three columns">
<button <button
@ -37,7 +81,7 @@ function InstanceComponent(args) {
<div className="row"> <div className="row">
<VboxContainer /> <VboxContainer />
<div className="three columns"> <div className="three columns">
{JSON.stringify(instance.cryps)} {cryps}
</div> </div>
</div> </div>
</section> </section>

View File

@ -0,0 +1,22 @@
const preact = require('preact');
// const key = require('keymaster');
function Vbox(args) {
const {
instance,
combiner,
sendVboxAccept,
sendVboxDiscard,
sendVboxReclaim,
sendVboxCombine,
} = args;
const { cryps } = instance;
return (
<div className="three columns">
</div>
);
}
module.exports = Vbox;

View File

@ -1,14 +1,13 @@
// eslint-disable-next-line // eslint-disable-next-line
const preact = require('preact'); const preact = require('preact');
const saw = require('./saw.component');
function renderLogin({ account, submitLogin, submitRegister }) { function renderLogin({ account, submitLogin, submitRegister }) {
if (account) return ( if (account) return (
<div className="header-status"> <div className="header-status">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" className="ping-svg">
<path d="M0,50l50,-50v100l50,-50" className="ping-path"/>
<path d="M0,50l50,-50v100l50,-50" className="ping-path"/>
</svg>
<h3 className="header-username">{account.name}</h3> <h3 className="header-username">{account.name}</h3>
{saw('whitesmoke')}
</div> </div>
); );

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,10 @@
const preact = require('preact');
module.exports = function saw(colour) {
return (
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" style={{ stroke: colour }}>
<path d="M0,50l50,-50v100l50,-50" className="ping-path"/>
<path d="M0,50l50,-50v100l50,-50" className="ping-path"/>
</svg>
);
}

View File

@ -71,7 +71,10 @@ function Vbox(args) {
return ( return (
<div className="three columns"> <div className="three columns">
<h3>vBox - {vbox.bits}b</h3> <div className="vbox-hdr">
<div>VBOX</div>
<h3>{vbox.bits}b</h3>
</div>
<button <button
className="instance-btn instance-ui-btn vbox-btn" className="instance-btn instance-ui-btn vbox-btn"
onClick={() => sendVboxDiscard()}> onClick={() => sendVboxDiscard()}>
@ -93,7 +96,7 @@ function Vbox(args) {
{boundRows} {boundRows}
</tbody> </tbody>
</table> </table>
<span>iCombinator</span> <span>I-COMBINATOR</span>
<button <button
className="instance-btn instance-ui-btn vbox-btn" className="instance-btn instance-ui-btn vbox-btn"
onClick={() => sendVboxCombine()}> onClick={() => sendVboxCombine()}>

View File

@ -26,21 +26,13 @@ consolidate buffs debuffs and disables
make strike *really* hit first / resolve at same time? make strike *really* hit first / resolve at same time?
## SOON ## SOON
* Descriptions
* Stats - How they work
* Items - What they give
* Skills - What they do
* Specs - Bonuses
* Balance Buff / Debuff durations
* Balance Spec / Skill multipliers
* vbox drops chances * vbox drops chances
* 50% spec, 25% colour etc * 50% spec, 25% colour etc
* confirm cryp without skill ready * confirm cryp without skill ready
* draw big warning !
* iconography * iconography
* aoe skills
* combo skills * combo skills
* skills * skills