game controls
This commit is contained in:
parent
d74ca61d57
commit
4b5aa62140
@ -4,10 +4,20 @@
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-rows: 1fr 0.5fr 1.5fr;
|
grid-template-rows: 1fr 0.5fr 1.5fr;
|
||||||
|
grid-template-columns: 1fr 0.15fr;
|
||||||
grid-template-areas:
|
grid-template-areas:
|
||||||
"opponent"
|
"opponent controls"
|
||||||
"target"
|
"target controls"
|
||||||
"player";
|
"player controls";
|
||||||
|
|
||||||
|
.controls {
|
||||||
|
margin: 1em 1em 0 0;
|
||||||
|
grid-area: controls;
|
||||||
|
|
||||||
|
button {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.game .team {
|
.game .team {
|
||||||
@ -413,7 +423,17 @@
|
|||||||
|
|
||||||
@media (max-width: 1000px) {
|
@media (max-width: 1000px) {
|
||||||
.game {
|
.game {
|
||||||
|
grid-template-areas:
|
||||||
|
"opponent"
|
||||||
|
"target "
|
||||||
|
"player ";
|
||||||
|
|
||||||
grid-template-rows: 1fr 0.2fr 1.5fr;
|
grid-template-rows: 1fr 0.2fr 1.5fr;
|
||||||
|
grid-template-columns: 1fr;
|
||||||
|
|
||||||
|
.controls {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.game .stats div {
|
.game .stats div {
|
||||||
@ -4,12 +4,11 @@
|
|||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: 2fr minmax(min-content, 1fr);
|
grid-template-columns: 2fr minmax(min-content, 1fr);
|
||||||
grid-template-rows: 1fr min-content min-content;
|
grid-template-rows: min-content 1fr;
|
||||||
|
|
||||||
grid-template-areas:
|
grid-template-areas:
|
||||||
"constructs constructs"
|
"vbox info"
|
||||||
"rule rule"
|
"constructs constructs";
|
||||||
"vbox info";
|
|
||||||
|
|
||||||
hr {
|
hr {
|
||||||
grid-area: rule;
|
grid-area: rule;
|
||||||
@ -38,22 +37,18 @@
|
|||||||
.scoreboard {
|
.scoreboard {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-flow: column;
|
flex-flow: column;
|
||||||
height: 100%;
|
align-items: center;
|
||||||
|
|
||||||
table {
|
table {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
button {
|
button {
|
||||||
margin: 2em 0 0 0;
|
|
||||||
flex: 1;
|
flex: 1;
|
||||||
font-size: 200%;
|
margin-bottom: 1em;
|
||||||
border-color: @green;
|
width: 75%;
|
||||||
}
|
font-size: 150%;
|
||||||
|
line-height: 3em;
|
||||||
.ready {
|
|
||||||
background: black;
|
|
||||||
color: forestgreen;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,12 +171,12 @@
|
|||||||
.instance-construct {
|
.instance-construct {
|
||||||
flex: 1;
|
flex: 1;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-rows: min-content 1fr min-content min-content min-content;
|
grid-template-rows: min-content min-content min-content 1fr min-content;
|
||||||
grid-template-areas:
|
grid-template-areas:
|
||||||
"name "
|
"name "
|
||||||
"avatar "
|
|
||||||
"skills "
|
"skills "
|
||||||
"specs "
|
"specs "
|
||||||
|
"avatar "
|
||||||
"stats ";
|
"stats ";
|
||||||
|
|
||||||
/*padding: 0.5em;*/
|
/*padding: 0.5em;*/
|
||||||
@ -404,24 +399,28 @@
|
|||||||
|
|
||||||
|
|
||||||
.faceoff {
|
.faceoff {
|
||||||
|
text-align: center;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-rows: min-content 1fr 1fr min-content ;
|
grid-template-rows: min-content 1fr 1.5fr min-content min-content;
|
||||||
grid-template-areas:
|
grid-template-areas:
|
||||||
"oppname"
|
"oppname"
|
||||||
"opponent"
|
"opponent"
|
||||||
"player"
|
"player"
|
||||||
"playername";
|
"playername"
|
||||||
|
"ready";
|
||||||
|
|
||||||
.ready {
|
|
||||||
background: black;
|
|
||||||
color: @green;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
h1 {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
button {
|
||||||
|
grid-area: ready;
|
||||||
|
justify-self: center;
|
||||||
|
margin-top: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
.opponent-name {
|
.opponent-name {
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
grid-area: oppname;
|
grid-area: oppname;
|
||||||
|
|||||||
@ -81,12 +81,11 @@ figure {
|
|||||||
grid-template-rows: min-content 1fr min-content;
|
grid-template-rows: min-content 1fr min-content;
|
||||||
grid-template-areas:
|
grid-template-areas:
|
||||||
"hd hd"
|
"hd hd"
|
||||||
"main main"
|
"nav main"
|
||||||
"main main";
|
"nav main";
|
||||||
}
|
}
|
||||||
|
|
||||||
nav {
|
nav {
|
||||||
display: none;
|
|
||||||
grid-area: nav;
|
grid-area: nav;
|
||||||
padding-left: 2em;
|
padding-left: 2em;
|
||||||
margin-right: 2em;
|
margin-right: 2em;
|
||||||
@ -595,16 +594,27 @@ main .top button {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.ready {
|
.ready {
|
||||||
background: forestgreen;
|
color: forestgreen;
|
||||||
color: black;
|
transition-property: color background;
|
||||||
|
|
||||||
transition-property: color, background;
|
|
||||||
transition-duration: 0.5s;
|
transition-duration: 0.5s;
|
||||||
transition-timing-function: ease;
|
transition-timing-function: ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ready:hover, .ready:active, .ready:focus {
|
button.ready {
|
||||||
|
width: 75%;
|
||||||
|
font-size: 150%;
|
||||||
|
line-height: 3em;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
color: forestgreen;
|
||||||
|
border-color: forestgreen;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:active, &:focus {
|
||||||
|
background: forestgreen;
|
||||||
color: black;
|
color: black;
|
||||||
|
border-color: forestgreen;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.timer-container {
|
.timer-container {
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
@import 'colours.less';
|
@import 'colours.less';
|
||||||
|
|
||||||
.vbox {
|
.vbox {
|
||||||
|
margin-bottom: 2em;
|
||||||
|
|
||||||
.vbox-hdr {
|
.vbox-hdr {
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
height: 2em;
|
height: 2em;
|
||||||
|
|||||||
@ -3,7 +3,7 @@ require('./assets/styles/styles.mobile.css');
|
|||||||
require('./assets/styles/instance.less');
|
require('./assets/styles/instance.less');
|
||||||
require('./assets/styles/vbox.less');
|
require('./assets/styles/vbox.less');
|
||||||
require('./assets/styles/instance.mobile.css');
|
require('./assets/styles/instance.mobile.css');
|
||||||
require('./assets/styles/game.css');
|
require('./assets/styles/game.less');
|
||||||
|
|
||||||
// kick it off
|
// kick it off
|
||||||
require('./src/app');
|
require('./src/app');
|
||||||
|
|||||||
33
client/src/components/controls.jsx
Normal file
33
client/src/components/controls.jsx
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
const preact = require('preact');
|
||||||
|
const { connect } = require('preact-redux');
|
||||||
|
|
||||||
|
const addState = connect(
|
||||||
|
function receiveState(state) {
|
||||||
|
const {
|
||||||
|
ws,
|
||||||
|
game
|
||||||
|
} = state;
|
||||||
|
|
||||||
|
function sendGameReady() {
|
||||||
|
document.activeElement.blur()
|
||||||
|
return ws.sendGameReady(game.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return { game, sendGameReady };
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
function Controls(args) {
|
||||||
|
const {
|
||||||
|
game,
|
||||||
|
sendGameReady
|
||||||
|
} = args;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div class="controls">
|
||||||
|
<button class="ready" onClick={() => sendGameReady()}>Ready</button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = addState(Controls);
|
||||||
@ -8,14 +8,19 @@ const { ConstructAvatar } = require('./construct');
|
|||||||
const addState = connect(
|
const addState = connect(
|
||||||
function receiveState(state) {
|
function receiveState(state) {
|
||||||
const {
|
const {
|
||||||
|
ws,
|
||||||
instance,
|
instance,
|
||||||
account,
|
account,
|
||||||
} = state;
|
} = state;
|
||||||
|
|
||||||
|
function sendInstanceReady() {
|
||||||
|
return ws.sendInstanceReady(instance.id);
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
instance,
|
instance,
|
||||||
account,
|
account,
|
||||||
|
sendInstanceReady,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -37,6 +42,7 @@ function Faceoff(props) {
|
|||||||
const {
|
const {
|
||||||
instance,
|
instance,
|
||||||
account,
|
account,
|
||||||
|
sendInstanceReady,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
if (!instance) return <div>...</div>;
|
if (!instance) return <div>...</div>;
|
||||||
@ -75,6 +81,7 @@ function Faceoff(props) {
|
|||||||
{OpponentTeam(otherTeam)}
|
{OpponentTeam(otherTeam)}
|
||||||
{PlayerTeam(playerTeam)}
|
{PlayerTeam(playerTeam)}
|
||||||
<h1 class={`player-name ${playerTeam.ready ? 'ready' : ''}`}>{playerTeam.name}</h1>
|
<h1 class={`player-name ${playerTeam.ready ? 'ready' : ''}`}>{playerTeam.name}</h1>
|
||||||
|
<button class="ready" onClick={() => sendInstanceReady()} >Ready</button>
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ const actions = require('../actions');
|
|||||||
|
|
||||||
const GameConstruct = require('./game.construct');
|
const GameConstruct = require('./game.construct');
|
||||||
const Targeting = require('./targeting.arrows');
|
const Targeting = require('./targeting.arrows');
|
||||||
|
const Controls = require('./controls');
|
||||||
|
|
||||||
const addState = connect(
|
const addState = connect(
|
||||||
function receiveState(state) {
|
function receiveState(state) {
|
||||||
@ -100,6 +101,7 @@ function Game(props) {
|
|||||||
{otherTeams.map(OpponentTeam)}
|
{otherTeams.map(OpponentTeam)}
|
||||||
<Targeting />
|
<Targeting />
|
||||||
{PlayerTeam(playerTeam, setActiveSkill)}
|
{PlayerTeam(playerTeam, setActiveSkill)}
|
||||||
|
<Controls />
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -63,7 +63,6 @@ function Instance(args) {
|
|||||||
<main class={instanceClasses} onClick={instanceClick} onMouseOver={() => setInfo(null)} >
|
<main class={instanceClasses} onClick={instanceClick} onMouseOver={() => setInfo(null)} >
|
||||||
<Vbox />
|
<Vbox />
|
||||||
<InfoContainer />
|
<InfoContainer />
|
||||||
<hr />
|
|
||||||
<InstanceConstructsContainer />
|
<InstanceConstructsContainer />
|
||||||
</main>
|
</main>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -47,12 +47,12 @@ function ScoreBoard(args) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div class="scoreboard">
|
<div class="scoreboard">
|
||||||
|
<button class="ready" onClick={() => sendInstanceReady()}>Ready</button>
|
||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
{players}
|
{players}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<button class="ready" onClick={() => sendInstanceReady}>Ready</button>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user