diff --git a/client/cryps.css b/client/cryps.css index acefcd0a..3d2b7fde 100644 --- a/client/cryps.css +++ b/client/cryps.css @@ -153,7 +153,7 @@ header { } .header-username { - letter-spacing: 0.25em; + letter-spacing: 0.05em; font-size: 2em; display: inline; } @@ -485,10 +485,7 @@ header { } .logs { - padding-left: 2em; - display: flex; - flex-flow: row wrap; - flex: 0 0 20%; + flex: 0 0 100%; } .selected-skills { diff --git a/client/src/actions.jsx b/client/src/actions.jsx index d952ba54..40a16475 100644 --- a/client/src/actions.jsx +++ b/client/src/actions.jsx @@ -13,6 +13,9 @@ export const setInstance = value => ({ type: SET_INSTANCE, value }); export const SET_GAME = 'SET_GAME'; export const setGame = value => ({ type: SET_GAME, value }); +export const SET_SHOW_LOG = 'SET_SHOW_LOG'; +export const setShowLog = value => ({ type: SET_SHOW_LOG, value }); + export const SET_COMBINER = 'SET_COMBINER'; export const setCombiner = value => ({ type: SET_COMBINER, value: Array.from(value) }); diff --git a/client/src/components/cryp.list.component.jsx b/client/src/components/cryp.list.component.jsx index fb15834c..867912b8 100644 --- a/client/src/components/cryp.list.component.jsx +++ b/client/src/components/cryp.list.component.jsx @@ -1,9 +1,9 @@ const preact = require('preact'); -const { Component } = require('preact'); const range = require('lodash/range'); const { stringSort } = require('./../utils'); const molecule = require('./molecule'); +const SpawnButton = require('./spawn.button'); const idSort = stringSort('id'); @@ -13,40 +13,6 @@ const COLOURS = [ '#3498db', ]; -class SpawnButton extends Component { - toggle(e) { - this.setState({ enabled: e }); - } - - render({ spawn }, { enabled }) { - let spawnName = null; - return ( -
-
this.toggle(!this.enabled)} > -

+

- spawnName = e.target.value} - /> - -
-
- ); - } -} - function CrypList(args) { const { cryps, @@ -79,6 +45,7 @@ function CrypList(args) { const instanceJoin = ( @@ -113,7 +80,7 @@ function CrypList(args) { : 1; const spawnButtons = range(spawnButtonsNum) - .map(() => sendCrypSpawn(name)} />); + .map(i => sendCrypSpawn(name)} />); return (
diff --git a/client/src/components/game.component.jsx b/client/src/components/game.component.jsx index cb9bc886..c8b8175d 100644 --- a/client/src/components/game.component.jsx +++ b/client/src/components/game.component.jsx @@ -16,11 +16,43 @@ function GamePanel(props) { setActiveSkill, selectSkillTarget, account, + showLog, + toggleLog, quit, } = props; if (!game) return
...
; + const header = ( +
+ +
+
 
+
+ +
+ ); + + if (showLog) { + const logs = game.log.map((l, i) => (
{l}
)).reverse(); + return ( +
+ {header} +
+ {logs} +
+
+ ); + } + function findCryp(id) { const team = game.teams.find(t => t.cryps.find(c => c.id === id)); if (team) return team.cryps.find(c => c.id === id); @@ -166,20 +198,10 @@ function GamePanel(props) { const selectedSkills = playerTeam.cryps.map((c, i) => stackElement(c, i)); - const logs = game.log.map((l, i) => (
{l}
)).reverse(); return (
-
- -
-
 
-
-
+ {header} {PlayerTeam(playerTeam, setActiveSkill)}
{selectedSkills} @@ -187,9 +209,6 @@ function GamePanel(props) {
{otherTeams.map(OpponentTeam)}
-
- {logs} -
); } diff --git a/client/src/components/game.container.jsx b/client/src/components/game.container.jsx index 2691043c..6fc2f45e 100644 --- a/client/src/components/game.container.jsx +++ b/client/src/components/game.container.jsx @@ -11,7 +11,7 @@ const particlesJS = window.particlesJS; const addState = connect( function receiveState(state) { - const { ws, game, account, activeSkill, activeIncoming } = state; + const { ws, game, account, showLog, activeSkill, activeIncoming } = state; function selectSkillTarget(targetCrypId) { if (activeSkill) { @@ -32,7 +32,7 @@ const addState = connect( return false; } - return { game, account, activeSkill, activeIncoming, selectSkillTarget, selectIncomingTarget }; + return { game, showLog, account, activeSkill, activeIncoming, selectSkillTarget, selectIncomingTarget }; }, function receiveDispatch(dispatch) { @@ -49,7 +49,12 @@ const addState = connect( dispatch(actions.setGame(null)); } - return { setActiveSkill, setActiveIncoming, quit }; + function toggleLog(v) { + dispatch(actions.setShowLog(v)); + } + + + return { setActiveSkill, setActiveIncoming, quit, toggleLog }; } ); diff --git a/client/src/components/info.component.jsx b/client/src/components/info.component.jsx index 4eb9db82..532b8369 100644 --- a/client/src/components/info.component.jsx +++ b/client/src/components/info.component.jsx @@ -22,6 +22,7 @@ function Info(args) {
); } + if (info.type === 'cryp') { const stats = [ { stat: 'hp', disp: 'Hp', colour: '#1FF01F' }, diff --git a/client/src/main.jsx b/client/src/main.jsx index 73eb97ad..23c7f507 100644 --- a/client/src/main.jsx +++ b/client/src/main.jsx @@ -21,6 +21,7 @@ const store = createStore( combiner: reducers.combinerReducer, cryps: reducers.crypsReducer, game: reducers.gameReducer, + showLog: reducers.showLogReducer, info: reducers.infoReducer, instance: reducers.instanceReducer, instances: reducers.instancesReducer, diff --git a/client/src/reducers.jsx b/client/src/reducers.jsx index e54c41a1..12eebe8f 100644 --- a/client/src/reducers.jsx +++ b/client/src/reducers.jsx @@ -80,6 +80,16 @@ function gameReducer(state = defaultGame, action) { } } +const defaultShowLog = false; +function showLogReducer(state = defaultShowLog, action) { + switch (action.type) { + case actions.SET_SHOW_LOG: + return action.value; + default: + return state; + } +} + const defaultReclaiming = false; function reclaimingReducer(state = defaultReclaiming, action) { switch (action.type) { @@ -116,6 +126,7 @@ module.exports = { combinerReducer, crypsReducer, gameReducer, + showLogReducer, instanceReducer, instancesReducer, reclaimingReducer, diff --git a/client/src/socket.jsx b/client/src/socket.jsx index bd9583a0..b1499f7c 100644 --- a/client/src/socket.jsx +++ b/client/src/socket.jsx @@ -260,7 +260,7 @@ function createSocket(events) { // if (!account) events.loginPrompt(); if (process.env.NODE_ENV !== 'production') { - send({ method: 'account_login', params: { name: 'grepking', password: 'grepgrepgrep' } }); + send({ method: 'account_login', params: { name: 'ntr', password: 'grepgrepgrep' } }); } return true; diff --git a/client/src/utils.jsx b/client/src/utils.jsx index 2a4cf361..4ea633bf 100644 --- a/client/src/utils.jsx +++ b/client/src/utils.jsx @@ -61,7 +61,7 @@ const STATS = { redDamage: { stat: 'red_damage', colour: 'red', svg: shapes.pentagon }, blueShield: { stat: 'blue_shield', colour: 'blue', svg: shapes.squircle }, blueDamage: { stat: 'blue_damage', colour: 'blue', svg: shapes.circle }, - speed: { stat: 'speed', colour: 'yellow', svg: shapes.triangle }, + speed: { stat: 'speed', colour: '', svg: shapes.triangle }, }; module.exports = {