Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
0601006504
@ -1,4 +1,5 @@
|
|||||||
const preact = require('preact');
|
const preact = require('preact');
|
||||||
|
const { STATS, eventClasses, getCombatText, ConstructAvatar } = require('../utils');
|
||||||
// const { animationDivs } = require('../animations');
|
// const { animationDivs } = require('../animations');
|
||||||
const GameConstruct = require('./game.construct');
|
const GameConstruct = require('./game.construct');
|
||||||
|
|
||||||
|
|||||||
@ -3,7 +3,7 @@ const preact = require('preact');
|
|||||||
const range = require('lodash/range');
|
const range = require('lodash/range');
|
||||||
|
|
||||||
const actions = require('../actions');
|
const actions = require('../actions');
|
||||||
const { STATS, eventClasses, getCombatText, constructAvatar, constructHealth } = require('../utils');
|
const { STATS, eventClasses, getCombatText, ConstructAvatar, constructHealth } = require('../utils');
|
||||||
const { animationDivs } = require('../animations');
|
const { animationDivs } = require('../animations');
|
||||||
const shapes = require('./shapes');
|
const shapes = require('./shapes');
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ function GameConstruct(props) {
|
|||||||
<figure
|
<figure
|
||||||
className="img"
|
className="img"
|
||||||
onClick={() => selectSkillTarget(construct.id)} >
|
onClick={() => selectSkillTarget(construct.id)} >
|
||||||
{constructAvatar(construct.name, construct.id)}
|
<ConstructAvatar name={construct.name} id={construct.id} />
|
||||||
{combatTextEl}
|
{combatTextEl}
|
||||||
</figure>
|
</figure>
|
||||||
<div className="effects"> {effects} </div>
|
<div className="effects"> {effects} </div>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
const { connect } = require('preact-redux');
|
const { connect } = require('preact-redux');
|
||||||
const preact = require('preact');
|
const preact = require('preact');
|
||||||
|
|
||||||
const { stringSort, NULL_UUID, COLOURS, constructAvatar } = require('./../utils');
|
const { stringSort, NULL_UUID, COLOURS, ConstructAvatar } = require('./../utils');
|
||||||
const actions = require('./../actions');
|
const actions = require('./../actions');
|
||||||
const InstanceCreateForm = require('./instance.create.form');
|
const InstanceCreateForm = require('./instance.create.form');
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ function List(args) {
|
|||||||
<div
|
<div
|
||||||
key={construct.id}
|
key={construct.id}
|
||||||
className="menu-construct" >
|
className="menu-construct" >
|
||||||
{constructAvatar(construct.name, construct.id)}
|
<ConstructAvatar name={construct.name} id={construct.id} />
|
||||||
<h2>{construct.name}</h2>
|
<h2>{construct.name}</h2>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -14,13 +14,13 @@ function renderLogin({ submitLogin, submitRegister }) {
|
|||||||
className="login-input"
|
className="login-input"
|
||||||
type="email"
|
type="email"
|
||||||
placeholder="username"
|
placeholder="username"
|
||||||
onChange={e => (details.name = e.target.value)}
|
onInput={e => (details.name = e.target.value)}
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
className="login-input"
|
className="login-input"
|
||||||
type="password"
|
type="password"
|
||||||
placeholder="password"
|
placeholder="password"
|
||||||
onChange={e => (details.password = e.target.value)}
|
onInput={e => (details.password = e.target.value)}
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
className="login-btn"
|
className="login-btn"
|
||||||
|
|||||||
@ -4,7 +4,7 @@ const range = require('lodash/range');
|
|||||||
|
|
||||||
const actions = require('./../actions');
|
const actions = require('./../actions');
|
||||||
const { COLOURS } = require('./../utils');
|
const { COLOURS } = require('./../utils');
|
||||||
const { stringSort, constructAvatar } = require('./../utils');
|
const { stringSort, ConstructAvatar } = require('./../utils');
|
||||||
const SpawnButton = require('./spawn.button');
|
const SpawnButton = require('./spawn.button');
|
||||||
|
|
||||||
const idSort = stringSort('id');
|
const idSort = stringSort('id');
|
||||||
@ -86,7 +86,7 @@ function Team(args) {
|
|||||||
className="menu-construct"
|
className="menu-construct"
|
||||||
style={ { 'border-color': borderColour || 'whitesmoke' } }
|
style={ { 'border-color': borderColour || 'whitesmoke' } }
|
||||||
onClick={() => selectConstruct(construct.id)} >
|
onClick={() => selectConstruct(construct.id)} >
|
||||||
{constructAvatar(construct.name, construct.id)}
|
<ConstructAvatar name={construct.name} id={construct.id} />
|
||||||
<h2>{construct.name}</h2>
|
<h2>{construct.name}</h2>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
const preact = require('preact');
|
const preact = require('preact');
|
||||||
|
const { Component } = require('preact');
|
||||||
|
|
||||||
const get = require('lodash/get');
|
const get = require('lodash/get');
|
||||||
const anime = require('animejs').default;
|
const anime = require('animejs').default;
|
||||||
@ -78,28 +79,35 @@ function clearAnimation(id) {
|
|||||||
animations[id] = false;
|
animations[id] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function constructAvatar(name, id) {
|
class ConstructAvatar extends Component {
|
||||||
// useEffect(() => {
|
render() {
|
||||||
// animateConstruct(id);
|
|
||||||
// return () => clearAnimation(id);
|
|
||||||
// });
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<img
|
<img
|
||||||
id={id}
|
id={this.props.id}
|
||||||
src={`/molecules/${genAvatar(name)}.svg`}
|
src={`/molecules/${genAvatar(this.props.name)}.svg`}
|
||||||
height="500"
|
height="500"
|
||||||
onError={event => event.target.setAttribute('src', '/molecules/726.svg')}
|
onError={event => event.target.setAttribute('src', '/molecules/726.svg')}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
animateConstruct(this.props.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount() {
|
||||||
|
clearAnimation(this.props.id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function instanceConstruct(name, id) {
|
function instanceConstruct(name, id) {
|
||||||
// useEffect(() => {
|
// useEffect(() => {
|
||||||
// animateConstruct(id);
|
// animateConstruct(id);
|
||||||
// return () => clearAnimation(id);
|
// return () => clearAnimation(id);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
|
setTimeout(() => animateConstruct(id), 50);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="avatar"
|
className="avatar"
|
||||||
@ -109,23 +117,6 @@ function instanceConstruct(name, id) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function gameConstructImg(name, id, combatTextEl, selectSkillTarget) {
|
|
||||||
// useEffect(() => {
|
|
||||||
// animateConstruct(id);
|
|
||||||
// return () => clearAnimation(id);
|
|
||||||
// });
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className="avatar"
|
|
||||||
id={id}
|
|
||||||
onClick={() => selectSkillTarget(id)}
|
|
||||||
style={{ 'background-image': `url(/molecules/${genAvatar(name)}.svg)` }} >
|
|
||||||
{combatTextEl}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const NULL_UUID = '00000000-0000-0000-0000-000000000000';
|
const NULL_UUID = '00000000-0000-0000-0000-000000000000';
|
||||||
|
|
||||||
const STATS = {
|
const STATS = {
|
||||||
@ -491,9 +482,8 @@ module.exports = {
|
|||||||
convertItem,
|
convertItem,
|
||||||
numSort,
|
numSort,
|
||||||
genAvatar,
|
genAvatar,
|
||||||
constructAvatar,
|
ConstructAvatar,
|
||||||
instanceConstruct,
|
instanceConstruct,
|
||||||
gameConstructImg,
|
|
||||||
requestAvatar,
|
requestAvatar,
|
||||||
eventClasses,
|
eventClasses,
|
||||||
getCombatSequence,
|
getCombatSequence,
|
||||||
|
|||||||
@ -373,7 +373,7 @@ impl Construct {
|
|||||||
|
|
||||||
let i = match available.len() {
|
let i = match available.len() {
|
||||||
1 => 0,
|
1 => 0,
|
||||||
_ => rng.gen_range(0, available.len() - 1),
|
_ => rng.gen_range(0, available.len()),
|
||||||
};
|
};
|
||||||
|
|
||||||
return Some(available[i].skill);
|
return Some(available[i].skill);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user