From cc5c02099f5450ba3a8e4163406b9623ae25a82d Mon Sep 17 00:00:00 2001 From: ntr Date: Mon, 1 Apr 2019 12:49:51 +1100 Subject: [PATCH] remove extra game --- html-client/src/components/game.container.js | 51 ------ html-client/src/components/game.jsx | 169 ------------------- 2 files changed, 220 deletions(-) delete mode 100644 html-client/src/components/game.container.js delete mode 100644 html-client/src/components/game.jsx diff --git a/html-client/src/components/game.container.js b/html-client/src/components/game.container.js deleted file mode 100644 index 64149b37..00000000 --- a/html-client/src/components/game.container.js +++ /dev/null @@ -1,51 +0,0 @@ -const { connect } = require('preact-redux'); - -const actions = require('../actions'); - -const Game = require('./game.component'); - -const addState = connect( - function receiveState(state) { - const { ws, game, account, activeSkill, activeIncoming } = state; - - function selectSkillTarget(targetCrypId) { - if (activeSkill) { - return ws.sendGameSkill(game.id, activeSkill.crypId, targetCrypId, activeSkill.skill); - } - return false; - } - - // intercept self casting skills - if (activeSkill && activeSkill.skill.self_targeting) { - ws.sendGameSkill(game.id, activeSkill.crypId, null, activeSkill.skill.skill); - } - - function selectIncomingTarget(crypId) { - if (activeIncoming) { - return ws.sendGameTarget(game.id, crypId, activeIncoming); - } - return false; - } - - return { game, account, activeSkill, activeIncoming, selectSkillTarget, selectIncomingTarget }; - }, - - function receiveDispatch(dispatch) { - function setActiveSkill(crypId, skill) { - dispatch(actions.setActiveSkill(crypId, skill)); - } - - function setActiveIncoming(skillId) { - dispatch(actions.setActiveIncoming(skillId)); - } - - function quit() { - dispatch(actions.setGame(null)); - } - - return { setActiveSkill, setActiveIncoming, quit }; - } - -); - -module.exports = addState(Game); diff --git a/html-client/src/components/game.jsx b/html-client/src/components/game.jsx deleted file mode 100644 index 83a05744..00000000 --- a/html-client/src/components/game.jsx +++ /dev/null @@ -1,169 +0,0 @@ -const preact = require('preact'); -const key = require('keymaster'); -const range = require('lodash/range'); -const molecule = require('./molecule'); -const saw = require('./saw.component'); - -const SKILL_HOT_KEYS = ['Q', 'W', 'E', 'R']; - -function GamePanel(props) { - const { - game, - activeSkill, - activeIncoming, - setActiveSkill, - selectSkillTarget, - selectIncomingTarget, - account, - } = props; - - if (!game) return
...
; - - const otherTeams = game.teams.filter(t => t.id !== account.id); - - const playerTeam = game.teams.find(t => t.id === account.id); - - function Cryp(cryp) { - const skills = range(0, 4).map((i) => { - const s = cryp.skills[i] - ? cryp.skills[i].skill - : ( ); - - return ; - }); - - const stats = [ - { stat: 'hp', colour: '#1FF01F' }, - { stat: 'red_shield', colour: '#a52a2a' }, - { stat: 'blue_shield', colour: '#3498db' }, - ].map((s, i) => ( -
- {saw(s.colour)} -
{cryp[s.stat].value} / {cryp[s.stat].max}
-
- )); - - return ( -
-
- {molecule} -
-
- {skills} -
-
- {stats} -
-
- ); - } - - function PlayerCrypCard(cryp) { - const skills = cryp.skills.map((skill, i) => { - const hotkey = SKILL_HOT_KEYS[i]; - key.unbind(hotkey); - key(hotkey, () => setActiveSkill(cryp.id, skill)); - - return ( - - ); - }); - - const effects = cryp.effects.map((effect, i) => ( -
{effect} for {effect.turns}T
- )); - - return ( -
selectIncomingTarget(cryp.id)} - className="tile is-vertical"> - {Cryp(cryp, setActiveSkill)} -
- ); - } - - function PlayerTeam(team) { - const cryps = team.cryps.map(c => PlayerCrypCard(c, setActiveSkill)); - - return ( -
- {cryps} -
- ); - } - - function OpponentCrypCard(cryp) { - const effects = cryp.effects.map((effect, i) => ( -
{effect.effect} for {effect.turns}T
- )); - - return ( -
selectSkillTarget(cryp.id)} > -
-
-
-
-

{cryp.name}

-
-
-
- -
-
- -
-
{cryp.hp.value} / {cryp.hp.value} HP
- - -
- {effects} -
-
- ); - } - - function OpponentTeam(team) { - const cryps = team.cryps.map(OpponentCrypCard); - return ( -
- {cryps} -
- ); - } - - const logs = game.log.reverse().map((l, i) => (
{l}
)); - - return ( -
-
-
- {playerTeam.id} - {PlayerTeam(playerTeam, setActiveSkill)} -
-
- Round X -
- -
- {otherTeams.id} - {otherTeams.map(OpponentTeam)} -
-
-
-
-
- ); -} - -module.exports = GamePanel;