);
diff --git a/client/src/components/instance.ctrl.jsx b/client/src/components/instance.ctrl.jsx
new file mode 100644
index 00000000..9d7c3329
--- /dev/null
+++ b/client/src/components/instance.ctrl.jsx
@@ -0,0 +1,33 @@
+const preact = require('preact');
+const { connect } = require('preact-redux');
+
+const addState = connect(
+ function receiveState(state) {
+ const {
+ ws,
+ instance
+ } = state;
+
+ function sendInstanceReady() {
+ document.activeElement.blur()
+ return ws.sendInstanceReady(instance.id);
+ }
+
+ return { instance, sendInstanceReady };
+ },
+);
+
+function Controls(args) {
+ const {
+ instance,
+ sendInstanceReady
+ } = args;
+
+ return (
+
+ );
+}
+
+module.exports = addState(Controls);
diff --git a/client/src/components/inventory.jsx b/client/src/components/inventory.jsx
index e17d23d6..4f074240 100644
--- a/client/src/components/inventory.jsx
+++ b/client/src/components/inventory.jsx
@@ -62,13 +62,17 @@ function Inventory(args) {
return (
-
¤ {account.balance}
-
- {shop.owned.map(useMtx)}
+
+
¤ {account.balance}
+
+ {shop.owned.map(useMtx)}
+
-
Shop
-
- {shop.available.map(availableMtx)}
+
+
Shop
+
+ {shop.available.map(availableMtx)}
+
);
diff --git a/client/src/components/main.jsx b/client/src/components/main.jsx
index 1bfd2c16..0e01cd59 100644
--- a/client/src/components/main.jsx
+++ b/client/src/components/main.jsx
@@ -27,8 +27,6 @@ function Main(props) {
return
;
}
- if (nav === 'play') return
;
-
if (game) {
return
;
}
@@ -37,6 +35,7 @@ function Main(props) {
return
;
}
+ if (nav === 'play') return
;
if (nav === 'team') return
;
return (
diff --git a/client/src/components/mnml.jsx b/client/src/components/mnml.jsx
index 1ed39d70..30ae1d10 100644
--- a/client/src/components/mnml.jsx
+++ b/client/src/components/mnml.jsx
@@ -4,6 +4,7 @@ const { connect } = require('preact-redux');
// const Header = require('./header');
const Main = require('./main');
const Nav = require('./nav');
+const Controls = require('./controls');
const Footer = require('./footer');
const addState = connect(
@@ -14,6 +15,7 @@ const Mnml = ({ showNav }) =>
+
;
diff --git a/client/src/components/join.jsx b/client/src/components/play.ctrl.jsx
similarity index 53%
rename from client/src/components/join.jsx
rename to client/src/components/play.ctrl.jsx
index c77ebc39..9efd672a 100644
--- a/client/src/components/join.jsx
+++ b/client/src/components/play.ctrl.jsx
@@ -27,23 +27,20 @@ function JoinButtons(args) {
} = args;
return (
-
-
Join Game
-
-
-
-
-
+
);
}
diff --git a/client/src/components/play.jsx b/client/src/components/play.jsx
index 13fa2adb..43d8ebe9 100644
--- a/client/src/components/play.jsx
+++ b/client/src/components/play.jsx
@@ -4,7 +4,6 @@ const preact = require('preact');
const { stringSort } = require('./../utils');
const { ConstructAvatar } = require('./construct');
const actions = require('./../actions');
-const Join = require('./join');
const Inventory = require('./inventory');
const idSort = stringSort('id');
@@ -113,7 +112,6 @@ function Play(args) {
{constructPanels}
-
);
}
diff --git a/client/src/components/scoreboard.jsx b/client/src/components/scoreboard.jsx
index 010b8f47..ee2e9e1d 100644
--- a/client/src/components/scoreboard.jsx
+++ b/client/src/components/scoreboard.jsx
@@ -8,18 +8,13 @@ const addState = connect(
instance
} = state;
- function sendInstanceReady() {
- return ws.sendInstanceReady(instance.id);
- }
-
- return { instance, sendInstanceReady };
+ return { instance };
},
);
function ScoreBoard(args) {
const {
instance,
- sendInstanceReady
} = args;
const players = instance.players.map((p, i) => {
@@ -46,14 +41,11 @@ function ScoreBoard(args) {
});
return (
-
-
-
-
+
);
}
diff --git a/client/src/components/vertical.thresholds.js b/client/src/components/vertical.thresholds.js
new file mode 100644
index 00000000..ab079170
--- /dev/null
+++ b/client/src/components/vertical.thresholds.js
@@ -0,0 +1,172 @@
+const preact = require('preact');
+const range = require('lodash/range');
+
+const { INFO } = require('./../constants');
+const { convertItem } = require('../utils');
+const shapes = require('./shapes');
+
+const ScoreBoard = require('./scoreboard');
+
+function InfoComponent(args) {
+ const {
+ itemInfo,
+ combiner,
+ player,
+ instance,
+ } = args;
+
+ args.info = 'PowerRG';
+ const { info } = args;
+
+ function Info() {
+ if (!info) return false;
+ const fullInfo = itemInfo.items.find(i => i.item === info) || INFO[info];
+ if (!fullInfo) return false;
+ const isSkill = fullInfo.skill;
+ const isSpec = fullInfo.spec;
+
+ if (isSkill) {
+ return (
+
+
{fullInfo.item}
+
{fullInfo.description}
+
+ );
+ }
+
+ if (isSpec) {
+ let red = 0;
+ let blue = 0;
+ let green = 0;
+ player.constructs.forEach(construct => {
+ red += construct.colours.red;
+ blue += construct.colours.blue;
+ green += construct.colours.green;
+ });
+ const teamColours = { red, blue, green };
+
+ const colourReqs = fullInfo.values.bonuses || [];
+
+ const thresholds = colourReqs.map((bonus, i) => {
+ const colours = ['red', 'green', 'blue'];
+ const colourGoals = colours.map(c => {
+ const colourReq = bonus.req[c];
+ if (colourReqs === 0) return false;
+
+ const start = i === 0
+ ? 0
+ : colourReqs[i - 1].req[c];
+
+ const dots = range(start, colourReq).map(j => {
+ const unmet = teamColours[c] < j + 1;
+
+ const reqClass = unmet
+ ? 'unmet'
+ : '';
+
+ return (
+
+ {shapes.square([c])}
+
+ );
+ });
+
+ return (
+
+ {dots}
+
+ );
+ });
+
+ const reqsMet = colours.every(c => teamColours[c] >= bonus.req[c]);
+
+ const reqClass = reqsMet
+ ? ''
+ : 'unmet';
+
+ return (
+
+
+ {colourGoals}
+
+
+ + {bonus.bonus}
+
+
+
+ );
+ });
+
+ return (
+
+
{info}
+
{fullInfo.description}
+
+ {thresholds}
+
+
+ );
+ }
+
+ return (
+
+
{fullInfo.item}
+
{fullInfo.description}
+
+ );
+ }
+
+ function Combos() {
+ if (!player) return false;
+
+ // show recipe for what's in combiner
+ if (combiner.some(u => u !== null)) {
+ const filteredCombos = itemInfo.combos
+ .filter(combo => combiner.every(u => u === null
+ || combo.components.includes(player.vbox.bound[u])));
+ if (filteredCombos.length > 6) return false;
+ return (
+
+
+ {filteredCombos.map((c, i) =>
+
+ | {convertItem(c.item)} |
+ {c.components.map((u, j) => {convertItem(u)} | )}
+
+ )}
+
+
+ );
+ }
+
+ if (!info) return false;
+ const vboxCombos = itemInfo.combos.filter(c => c.components.includes(info));
+ if (vboxCombos.length > 6) return false;
+ return (
+
+
+ {vboxCombos.map((c, i) =>
+
+ | {convertItem(c.item)} |
+ {c.components.map((u, j) => {convertItem(u)} | )}
+
+ )}
+
+
+ );
+ }
+
+ const scoreboard = instance.phase === 'Lobby' || info
+ ? null
+ :
;
+
+ return (
+
+ {scoreboard}
+
+
+
+ );
+}
+
+module.exports = InfoComponent;
diff --git a/client/src/socket.jsx b/client/src/socket.jsx
index 78ebd771..58a04f86 100644
--- a/client/src/socket.jsx
+++ b/client/src/socket.jsx
@@ -177,7 +177,7 @@ function createSocket(events) {
let pongTimeout;
function onPong() {
events.setPing(Date.now() - ping);
- pongTimeout = setTimeout(sendPing, 1000);
+ // pongTimeout = setTimeout(sendPing, 1000);
}
// -------------