should comp update animations
This commit is contained in:
parent
3b55c98dde
commit
d97cb9dccc
@ -39,7 +39,6 @@ const Stun = require('./anims/stun');
|
|||||||
const Triage = require('./anims/triage');
|
const Triage = require('./anims/triage');
|
||||||
const TriageTick = require('./anims/triage.tick');
|
const TriageTick = require('./anims/triage.tick');
|
||||||
|
|
||||||
const actions = require('../actions');
|
|
||||||
const { removeTier } = require('../utils');
|
const { removeTier } = require('../utils');
|
||||||
|
|
||||||
|
|
||||||
@ -47,10 +46,16 @@ const addState = connect(
|
|||||||
function receiveState(state) {
|
function receiveState(state) {
|
||||||
const { animTarget } = state;
|
const { animTarget } = state;
|
||||||
return { animTarget };
|
return { animTarget };
|
||||||
},
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
class ConstructAnimation extends Component {
|
class ConstructAnimation extends Component {
|
||||||
|
shouldComponentUpdate(nextProps) {
|
||||||
|
if (nextProps.animTarget !== this.props.animTarget) return true;
|
||||||
|
if (nextProps.construct !== this.props.construct) return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
render(props) {
|
render(props) {
|
||||||
const {
|
const {
|
||||||
animTarget,
|
animTarget,
|
||||||
@ -70,7 +75,7 @@ class ConstructAnimation extends Component {
|
|||||||
|
|
||||||
|
|
||||||
// find target animation
|
// find target animation
|
||||||
const chooseAnim = (animSkill) => {
|
const chooseAnim = () => {
|
||||||
switch (animSkill) {
|
switch (animSkill) {
|
||||||
// Attack base
|
// Attack base
|
||||||
case 'Attack': return <Attack direction={direction}/>;
|
case 'Attack': return <Attack direction={direction}/>;
|
||||||
@ -124,7 +129,7 @@ class ConstructAnimation extends Component {
|
|||||||
case 'Reflect': return <Refl player={player} />;
|
case 'Reflect': return <Refl player={player} />;
|
||||||
|
|
||||||
default: return false;
|
default: return false;
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const anim = chooseAnim(animSkill);
|
const anim = chooseAnim(animSkill);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user