This commit is contained in:
ntr 2019-05-15 00:45:43 +10:00
parent ac36a7166e
commit 04e406180a
8 changed files with 64 additions and 71 deletions

View File

@ -2,51 +2,67 @@
.game { .game {
display: grid; display: grid;
grid-template-columns: repeat(3, 1fr)); grid-template-rows: 1.5em 1.5em 1fr 1fr;
grid-template-columns: repeat(6, 1fr));
grid-template-areas: grid-template-areas:
"opponent opponent opponent" "ready"
"opponent opponent opponent" "timer"
"middle middle middle" "opponent"
"player player player"; "player";
"player player player";
"player player player";
} }
.team { .team {
grid-area: player;
display: grid; display: grid;
grid-template-columns: repeat(3, 1fr); grid-template-columns: repeat(3, 1fr);
text-align: center; grid-auto-columns: minmax(0, 1fr);
/* stops overflow */
min-height: 0;
min-width: 0;
}
.player {
grid-area: player;
} }
.opponent { .opponent {
grid-area: opponent; grid-area: opponent;
} }
.targeting-arrows {
grid-area: middle;
}
.opponent .combat-text { .opponent .combat-text {
left: 40%; left: 40%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
} }
.target-svg {
background: green;
flex: 1;
}
.target-svg path { .targeting-arrows path {
stroke: whitesmoke; stroke: whitesmoke;
stroke-width: 4px; stroke-width: 4px;
} }
.opponent .game-cryp {
.game-cryp { grid-template-rows: auto auto minmax(0, 1fr) auto;
display: grid;
grid-template-areas: grid-template-areas:
"stats" "stats"
"effects" "effects"
"avatar"; "avatar"
"skills";
}
.game-cryp {
display: grid;
justify-items: center;
grid-template-rows: minmax(0, 1fr) minmax(0, 2fr) auto minmax(0, 1fr);
grid-template-areas:
"skills"
"avatar"
"effects"
"stats";
transition-property: all; transition-property: all;
transition-duration: 0.5s; transition-duration: 0.5s;
@ -54,18 +70,14 @@
transition-timing-function: ease; transition-timing-function: ease;
} }
.player .game-cryp { .game-cryp .img {
grid-template-areas: grid-area: avatar;
"skills"
"avatar"
"effects"
"stats";
} }
.game-cryp .stats { .game-cryp .stats {
grid-area: stats; grid-area: stats;
display: flex; display: flex;
flex: row; flex-flow: row;
} }
.game-cryp .skills { .game-cryp .skills {
@ -76,7 +88,6 @@
.game-cryp .effects { .game-cryp .effects {
font-size: 1.5em; font-size: 1.5em;
grid-area: effects;
} }
.game-btn { .game-btn {

View File

@ -70,6 +70,7 @@
flex: 1 1 100%; flex: 1 1 100%;
width: 100%; width: 100%;
height: 0.25em; height: 0.25em;
max-height: 0.25em;
border: none; border: none;
margin: 1em 0; margin: 1em 0;

View File

@ -52,7 +52,7 @@ function GamePanel(props) {
} }
const header = ( const header = (
<div className="instance-hdr"> <div className="ready">
<button <button
className="game-btn instance-btn instance-ui-btn right" className="game-btn instance-btn instance-ui-btn right"
onClick={() => sendGameReady()}> onClick={() => sendGameReady()}>
@ -131,18 +131,18 @@ function GamePanel(props) {
className={`game-cryp ${ko} ${classes}`} className={`game-cryp ${ko} ${classes}`}
style={ activeSkill ? { cursor: 'pointer' } : {}} style={ activeSkill ? { cursor: 'pointer' } : {}}
onClick={() => selectSkillTarget(cryp.id)} > onClick={() => selectSkillTarget(cryp.id)} >
<div className="stats">
{stats}
</div>
<div className="effects">
{effects}
</div>
<figure <figure
className="img" className="img"
onClick={() => selectSkillTarget(cryp.id)} > onClick={() => selectSkillTarget(cryp.id)} >
{crypAvatar(cryp.name)} {crypAvatar(cryp.name)}
{combatTextEl} {combatTextEl}
</figure> </figure>
<div className="effects">
{effects}
</div>
<div className="stats">
{stats}
</div>
</div> </div>
); );
} }
@ -159,13 +159,10 @@ function GamePanel(props) {
const gameClasses = `game ${resolution ? 'resolving': ''}`; const gameClasses = `game ${resolution ? 'resolving': ''}`;
// {header}
// {timer}
return ( return (
<section className={gameClasses} onClick={() => setActiveCryp(null)} > <section className={gameClasses} onClick={() => setActiveCryp(null)} >
<TargetingArrows /> {header}
{timer}
{otherTeams.map(OpponentTeam)} {otherTeams.map(OpponentTeam)}
{PlayerTeam(playerTeam, setActiveSkill)} {PlayerTeam(playerTeam, setActiveSkill)}
</section> </section>

View File

@ -14,7 +14,6 @@ const addState = connect(
game, game,
resolution, resolution,
activeSkill, activeSkill,
activeCryp,
} = state; } = state;
function selectSkillTarget(targetCrypId) { function selectSkillTarget(targetCrypId) {
@ -32,28 +31,18 @@ const addState = connect(
return { return {
resolution, resolution,
activeSkill, activeSkill,
activeCryp,
selectSkillTarget, selectSkillTarget,
}; };
}, },
function receiveDispatch(dispatch) {
function setActiveCryp(cryp) {
dispatch(actions.setActiveCryp(cryp));
}
return { setActiveCryp };
}
); );
function GameCryp(props) { function GameCryp(props) {
const { const {
cryp, cryp,
resolution, resolution,
activeSkill, activeSkill,
setActiveCryp, setActiveCryp,
selectSkillTarget, // selectSkillTarget,
} = props; } = props;
const ko = cryp.green_life.value === 0 ? 'ko' : ''; const ko = cryp.green_life.value === 0 ? 'ko' : '';
@ -73,11 +62,6 @@ function GameCryp(props) {
}); });
function onClick(e) {
e.stopPropagation();
return setActiveCryp(cryp);
}
const combatText = getCombatText(cryp, resolution); const combatText = getCombatText(cryp, resolution);
const combatTextEl = combatText const combatTextEl = combatText
? <div className="combat-text">{combatText}</div> ? <div className="combat-text">{combatText}</div>
@ -90,13 +74,9 @@ function GameCryp(props) {
return ( return (
<div <div
style={ activeSkill ? { cursor: 'pointer' } : {}} style={ activeSkill ? { cursor: 'pointer' } : {}}
onClick={onClick}
className={`game-cryp ${ko} ${classes}`} > className={`game-cryp ${ko} ${classes}`} >
<div className="stats"> <div className="skills">
{stats} {skills}
</div>
<div className="effects">
{effects}
</div> </div>
<figure <figure
className="img" className="img"
@ -104,8 +84,11 @@ function GameCryp(props) {
{crypAvatar(cryp.name)} {crypAvatar(cryp.name)}
{combatTextEl} {combatTextEl}
</figure> </figure>
<div className="skills"> <div className="effects">
{skills} {effects}
</div>
<div className="stats">
{stats}
</div> </div>
</div> </div>
); );

View File

@ -62,7 +62,7 @@ function TargetSvg(args) {
: outgoing.map(getPath); : outgoing.map(getPath);
return ( return (
<svg viewBox="0 0 900 900" preserveAspectRatio="none" className="target-arrows"> <svg preserveAspectRatio="none" className="targeting-arrows">
{arrows} {arrows}
</svg> </svg>
); );

View File

@ -51,8 +51,8 @@ document.fonts.load('16pt "Jura"').then(() => {
store.dispatch(actions.setWs(ws)); store.dispatch(actions.setWs(ws));
ws.connect(); ws.connect();
// events.setGame(testGame); events.setGame(testGame);
// ws.clearGameStateTimeout(); ws.clearGameStateTimeout();
const Cryps = () => ( const Cryps = () => (
<main className="cryps" > <main className="cryps" >

View File

@ -312,7 +312,7 @@ function createSocket(events) {
sendAccountCryps(); sendAccountCryps();
} }
sendPing(); // sendPing();
return true; return true;
}); });

View File

@ -3,7 +3,7 @@
*/ */
html, body, main { html, body, main {
width: 100%; /*width: 100%;*/
margin: 0; margin: 0;
background-color: #000000; background-color: #000000;
@ -71,6 +71,7 @@ main {
nav { nav {
grid-area: nav; grid-area: nav;
margin-right: 1em;
} }
nav button { nav button {