skill info on hover in effect box
This commit is contained in:
parent
b0537d758b
commit
b896a7ee42
@ -3,10 +3,8 @@
|
|||||||
|
|
||||||
*PRODUCTION*
|
*PRODUCTION*
|
||||||
|
|
||||||
* border colours for skills e.g. strike red border, slay half red half green
|
|
||||||
* rename vbox to shop
|
* rename vbox to shop
|
||||||
* combat phase info system
|
* combat phase info system
|
||||||
* drag and drop buy / equip / unequip items
|
|
||||||
|
|
||||||
* mobile styles
|
* mobile styles
|
||||||
* mobile info page
|
* mobile info page
|
||||||
@ -71,6 +69,7 @@ $$$
|
|||||||
* Highlight (dota) colour
|
* Highlight (dota) colour
|
||||||
* fx colours + styles
|
* fx colours + styles
|
||||||
|
|
||||||
|
* ??? (PROBS NOT) drag and drop buy / equip / unequip items ???
|
||||||
* modules
|
* modules
|
||||||
* troll life -> dmg
|
* troll life -> dmg
|
||||||
* prince of peace
|
* prince of peace
|
||||||
|
|||||||
@ -204,6 +204,7 @@
|
|||||||
|
|
||||||
.resolving-skill {
|
.resolving-skill {
|
||||||
grid-area: target;
|
grid-area: target;
|
||||||
|
text-align: center;
|
||||||
align-self: center;
|
align-self: center;
|
||||||
height: auto;
|
height: auto;
|
||||||
svg {
|
svg {
|
||||||
@ -213,6 +214,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.skill-description {
|
||||||
|
padding-left: 1em;
|
||||||
|
padding-right: 1em;
|
||||||
|
text-align: center;
|
||||||
|
svg {
|
||||||
|
display: inline;
|
||||||
|
height: 1em;
|
||||||
|
margin-right: 0.1em
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* some stupid bug in chrome makes it fill the entire screen */
|
/* some stupid bug in chrome makes it fill the entire screen */
|
||||||
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
@media screen and (-webkit-min-device-pixel-ratio:0) {
|
||||||
#targeting {
|
#targeting {
|
||||||
|
|||||||
@ -18,6 +18,7 @@ export const setConstructEditId = value => ({ type: 'SET_CONSTRUCT_EDIT_ID', val
|
|||||||
export const setConstructs = value => ({ type: 'SET_CONSTRUCTS', value });
|
export const setConstructs = value => ({ type: 'SET_CONSTRUCTS', value });
|
||||||
export const setConstructRename = value => ({ type: 'SET_CONSTRUCT_RENAME', value });
|
export const setConstructRename = value => ({ type: 'SET_CONSTRUCT_RENAME', value });
|
||||||
export const setGame = value => ({ type: 'SET_GAME', value });
|
export const setGame = value => ({ type: 'SET_GAME', value });
|
||||||
|
export const setGameInfo = value => ({ type: 'SET_GAME_INFO', value });
|
||||||
export const setInfo = value => ({ type: 'SET_INFO', value });
|
export const setInfo = value => ({ type: 'SET_INFO', value });
|
||||||
export const setEmail = value => ({ type: 'SET_EMAIL', value });
|
export const setEmail = value => ({ type: 'SET_EMAIL', value });
|
||||||
export const setInvite = value => ({ type: 'SET_INVITE', value });
|
export const setInvite = value => ({ type: 'SET_INVITE', value });
|
||||||
|
|||||||
@ -2,10 +2,12 @@ const { connect } = require('preact-redux');
|
|||||||
const { Component } = require('preact');
|
const { Component } = require('preact');
|
||||||
const preact = require('preact');
|
const preact = require('preact');
|
||||||
const range = require('lodash/range');
|
const range = require('lodash/range');
|
||||||
|
const reactStringReplace = require('react-string-replace');
|
||||||
|
|
||||||
const { STATS } = require('../utils');
|
const { STATS } = require('../utils');
|
||||||
const { ConstructAvatar, ConstructText } = require('./construct');
|
const { ConstructAvatar, ConstructText } = require('./construct');
|
||||||
const shapes = require('./shapes');
|
const shapes = require('./shapes');
|
||||||
|
const { INFO } = require('./../constants');
|
||||||
|
|
||||||
const SkillBtn = require('./skill.btn');
|
const SkillBtn = require('./skill.btn');
|
||||||
|
|
||||||
@ -19,6 +21,9 @@ const addState = connect(
|
|||||||
animFocus,
|
animFocus,
|
||||||
animating,
|
animating,
|
||||||
animText,
|
animText,
|
||||||
|
|
||||||
|
gameInfo,
|
||||||
|
itemInfo,
|
||||||
} = state;
|
} = state;
|
||||||
|
|
||||||
function selectSkillTarget(targetConstructId) {
|
function selectSkillTarget(targetConstructId) {
|
||||||
@ -40,6 +45,9 @@ const addState = connect(
|
|||||||
animText,
|
animText,
|
||||||
activeSkill,
|
activeSkill,
|
||||||
selectSkillTarget,
|
selectSkillTarget,
|
||||||
|
|
||||||
|
gameInfo,
|
||||||
|
itemInfo,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -77,6 +85,9 @@ class GameConstruct extends Component {
|
|||||||
selectSkillTarget,
|
selectSkillTarget,
|
||||||
animFocus,
|
animFocus,
|
||||||
animText,
|
animText,
|
||||||
|
|
||||||
|
gameInfo,
|
||||||
|
itemInfo,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const ko = construct.green_life.value === 0 ? 'ko' : '';
|
const ko = construct.green_life.value === 0 ? 'ko' : '';
|
||||||
@ -96,9 +107,23 @@ class GameConstruct extends Component {
|
|||||||
let crypSkills = <div></div>;
|
let crypSkills = <div></div>;
|
||||||
if (player) crypSkills = (<div class="skills"> {skills} </div>);
|
if (player) crypSkills = (<div class="skills"> {skills} </div>);
|
||||||
|
|
||||||
const effects = construct.effects.length
|
|
||||||
? construct.effects.map(c => <div key={c.effect}>{c.effect} - {c.duration}T</div>)
|
const effectBox = () => {
|
||||||
: null;
|
if (gameInfo && gameInfo.constructId === construct.id) {
|
||||||
|
const fullInfo = itemInfo.items.find(k => k.item === gameInfo.skill) || INFO[gameInfo.skill];
|
||||||
|
const regEx = /(RedPower|BluePower|GreenPower|RedLife|BlueLife|GreenLife|SpeedStat)/;
|
||||||
|
const infoDescription = reactStringReplace(fullInfo.description, regEx, match => shapes[match]());
|
||||||
|
return (
|
||||||
|
<div class="skill-description">
|
||||||
|
<h2> {gameInfo.skill} </h2>
|
||||||
|
<div> {infoDescription} </div>
|
||||||
|
</div>);
|
||||||
|
}
|
||||||
|
const effects = construct.effects.length
|
||||||
|
? construct.effects.map(c => <div key={c.effect}>{c.effect} - {c.duration}T</div>)
|
||||||
|
: null;
|
||||||
|
return (<div class="effects"> {effects} </div>);
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@ -107,7 +132,7 @@ class GameConstruct extends Component {
|
|||||||
class={`game-construct ${ko} ${classes}`} >
|
class={`game-construct ${ko} ${classes}`} >
|
||||||
<div class="left">
|
<div class="left">
|
||||||
{crypSkills}
|
{crypSkills}
|
||||||
<div class="effects"> {effects} </div>
|
{effectBox()}
|
||||||
</div>
|
</div>
|
||||||
<div class="right">
|
<div class="right">
|
||||||
<div class="stats"> {stats} </div>
|
<div class="stats"> {stats} </div>
|
||||||
|
|||||||
@ -23,7 +23,11 @@ const addState = connect(
|
|||||||
dispatch(actions.setActiveSkill(constructId, skill));
|
dispatch(actions.setActiveSkill(constructId, skill));
|
||||||
}
|
}
|
||||||
|
|
||||||
return { setActiveSkill };
|
function setGameInfo(info) {
|
||||||
|
dispatch(actions.setGameInfo(info));
|
||||||
|
}
|
||||||
|
|
||||||
|
return { setActiveSkill, setGameInfo };
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -35,6 +39,7 @@ function Skill(props) {
|
|||||||
i,
|
i,
|
||||||
activeSkill,
|
activeSkill,
|
||||||
setActiveSkill,
|
setActiveSkill,
|
||||||
|
setGameInfo,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
if (!game) return false;
|
if (!game) return false;
|
||||||
@ -42,6 +47,10 @@ function Skill(props) {
|
|||||||
const s = construct.skills[i];
|
const s = construct.skills[i];
|
||||||
const ko = construct.green_life.value === 0 ? 'ko' : '';
|
const ko = construct.green_life.value === 0 ? 'ko' : '';
|
||||||
|
|
||||||
|
function hoverInfo(e, info) {
|
||||||
|
e.stopPropagation();
|
||||||
|
return setGameInfo(info);
|
||||||
|
}
|
||||||
if (!s || !game) {
|
if (!s || !game) {
|
||||||
return (
|
return (
|
||||||
<button
|
<button
|
||||||
@ -76,6 +85,8 @@ function Skill(props) {
|
|||||||
<button
|
<button
|
||||||
disabled={cdText || s.disabled || ko}
|
disabled={cdText || s.disabled || ko}
|
||||||
class={`${(targeting || highlight) ? 'active' : ''} ${border}`}
|
class={`${(targeting || highlight) ? 'active' : ''} ${border}`}
|
||||||
|
onMouseOver={e => hoverInfo(e, { skill: s.skill, constructId: construct.id })}
|
||||||
|
onMouseOut={e => hoverInfo(e, null)}
|
||||||
type="submit"
|
type="submit"
|
||||||
onClick={onClick}>
|
onClick={onClick}>
|
||||||
{s.skill} {cdText}
|
{s.skill} {cdText}
|
||||||
|
|||||||
@ -29,6 +29,7 @@ module.exports = {
|
|||||||
constructEditId: createReducer(null, 'SET_CONSTRUCT_EDIT_ID'),
|
constructEditId: createReducer(null, 'SET_CONSTRUCT_EDIT_ID'),
|
||||||
constructRename: createReducer(null, 'SET_CONSTRUCT_RENAME'),
|
constructRename: createReducer(null, 'SET_CONSTRUCT_RENAME'),
|
||||||
game: createReducer(null, 'SET_GAME'),
|
game: createReducer(null, 'SET_GAME'),
|
||||||
|
gameInfo: createReducer(null, 'SET_GAME_INFO'),
|
||||||
email: createReducer(null, 'SET_EMAIL'),
|
email: createReducer(null, 'SET_EMAIL'),
|
||||||
invite: createReducer(null, 'SET_INVITE'),
|
invite: createReducer(null, 'SET_INVITE'),
|
||||||
info: createReducer(null, 'SET_INFO'),
|
info: createReducer(null, 'SET_INFO'),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user