From 563271314406226bdc826662a6e815ca99b59c12 Mon Sep 17 00:00:00 2001 From: ntr Date: Mon, 8 Apr 2019 14:04:06 +1000 Subject: [PATCH 1/3] info fixes --- client/src/components/info.component.jsx | 28 +++++++++++++++----- client/src/components/info.container.jsx | 24 ++++++++++++----- client/src/components/instance.component.jsx | 2 +- 3 files changed, 39 insertions(+), 15 deletions(-) diff --git a/client/src/components/info.component.jsx b/client/src/components/info.component.jsx index 08f70c78..265657a3 100644 --- a/client/src/components/info.component.jsx +++ b/client/src/components/info.component.jsx @@ -10,6 +10,7 @@ function Info(args) { info, sendUnequip, instance, + setInfo, } = args; function infoVar([type, value]) { @@ -87,10 +88,17 @@ function Info(args) { function infoCrypElement(cryp) { // onClick={() => setInfo('skill', { skill: s, cryp })} const skills = range(0, 4).map(i => { + const skill = cryp.skills[i]; + + function skillClick() { + if (!skill) return false; + return setInfo('skill', { skill: skill.skill, cryp }); + } + const s = cryp.skills[i] ? cryp.skills[i].skill : ( ); - return ; + return ; }); const stats = Object.values(STATS).map((s, j) => ( @@ -100,12 +108,18 @@ function Info(args) { )); - const specs = cryp.specs.map((s, i) => ( -
- {SPECS[s].svg(`stat-icon ${SPECS[s].colour}`)} -
{SPECS[s].caption}
-
- )); + const specs = cryp.specs.map((s, i) => { + function specClick() { + setInfo('spec', { spec: s, cryp }); + } + + return ( +
+ {SPECS[s].svg(`stat-icon ${SPECS[s].colour}`)} +
{SPECS[s].caption}
+
+ ); + }); return ( diff --git a/client/src/components/info.container.jsx b/client/src/components/info.container.jsx index 1b098e82..b4cd2779 100644 --- a/client/src/components/info.container.jsx +++ b/client/src/components/info.container.jsx @@ -1,7 +1,6 @@ const { connect } = require('preact-redux'); -// const actions = require('../actions'); - +const actions = require('../actions'); const Info = require('./info.component'); const addState = connect( @@ -23,13 +22,24 @@ const addState = connect( sendUnequip, instance, }; - } -/* - function receiveDispatch(dispatch) { + }, - return { }; + function receiveDispatch(dispatch) { + function setInfo(item, value) { + dispatch(actions.setInfo([item, value])); + } + + function setActiveVar(value) { + dispatch(actions.setActiveVar(value)); + } + + + return { + setInfo, + setActiveVar, + }; } -*/ + ); module.exports = addState(Info); diff --git a/client/src/components/instance.component.jsx b/client/src/components/instance.component.jsx index fbca776e..40e927c3 100644 --- a/client/src/components/instance.component.jsx +++ b/client/src/components/instance.component.jsx @@ -25,7 +25,7 @@ function Cryp(props) { function skillClick() { if (!skill) return false; - setInfo('skill', { skill, cryp }); + setInfo('skill', { skill: skill.skill, cryp }); return setActiveCryp(cryp); } From 4a6e2ca544cd5601536bff58ce1d926af493e038 Mon Sep 17 00:00:00 2001 From: ntr Date: Mon, 8 Apr 2019 14:08:52 +1000 Subject: [PATCH 2/3] max 3 skills --- client/src/components/game.component.jsx | 4 ++-- client/src/components/info.component.jsx | 2 +- client/src/components/instance.component.jsx | 2 +- server/src/vbox.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/client/src/components/game.component.jsx b/client/src/components/game.component.jsx index 0ebc6a82..d976fca5 100644 --- a/client/src/components/game.component.jsx +++ b/client/src/components/game.component.jsx @@ -137,7 +137,7 @@ function GamePanel(props) { function Cryp(cryp) { const ko = cryp.hp.value === 0 ? 'ko' : ''; - const skills = range(0, 4).map(i => Skill(cryp, i)); + const skills = range(0, 3).map(i => Skill(cryp, i)); const stats = [STATS.hp, STATS.redShield, STATS.blueShield].map((s, j) => (
@@ -226,7 +226,7 @@ function GamePanel(props) { const selectedSkills = playerTeam.cryps.map((c, i) => stackElement(c, i)); const mobileSkills = activeCryp - ? range(0, 4).map(i => Skill(activeCryp, i, true)) + ? range(0, 3).map(i => Skill(activeCryp, i, true)) : (
); return ( diff --git a/client/src/components/info.component.jsx b/client/src/components/info.component.jsx index 265657a3..d865b3cf 100644 --- a/client/src/components/info.component.jsx +++ b/client/src/components/info.component.jsx @@ -87,7 +87,7 @@ function Info(args) { function infoCrypElement(cryp) { // onClick={() => setInfo('skill', { skill: s, cryp })} - const skills = range(0, 4).map(i => { + const skills = range(0, 3).map(i => { const skill = cryp.skills[i]; function skillClick() { diff --git a/client/src/components/instance.component.jsx b/client/src/components/instance.component.jsx index 40e927c3..2081f55c 100644 --- a/client/src/components/instance.component.jsx +++ b/client/src/components/instance.component.jsx @@ -17,7 +17,7 @@ function Cryp(props) { setActiveCryp, } = props; - const skills = range(0, 4).map(i => { + const skills = range(0, 3).map(i => { const skill = cryp.skills[i]; const s = skill ? skill.skill diff --git a/server/src/vbox.rs b/server/src/vbox.rs index 21a9de06..1b40c4f5 100644 --- a/server/src/vbox.rs +++ b/server/src/vbox.rs @@ -582,7 +582,7 @@ pub fn vbox_apply(params: VboxApplyParams, tx: &mut Transaction, account: &Accou let skill = var.into_skill().ok_or(format_err!("var {:?} has no associated skill", var))?; let cryp = player.cryp_get(params.cryp_id)?; // done here because i teach them a tonne of skills for tests - let max_skills = 4; + let max_skills = 3; if cryp.skills.len() >= max_skills { return Err(format_err!("cryp at max skills ({:?})", max_skills)); } From f816e6abaffd30842100c37cb1b43885e335a93a Mon Sep 17 00:00:00 2001 From: ntr Date: Mon, 8 Apr 2019 14:10:37 +1000 Subject: [PATCH 3/3] 3s styles --- client/cryps.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/cryps.css b/client/cryps.css index 275d7883..1fe6e278 100644 --- a/client/cryps.css +++ b/client/cryps.css @@ -457,7 +457,7 @@ header { .cryp-box-top { display: flex; - flex: 1 1 80%; + flex: 1 1 75%; width: 100%; justify-content: center; align-items: stretch;