diff --git a/client/src/actions.jsx b/client/src/actions.jsx index e426f70b..e99bba62 100644 --- a/client/src/actions.jsx +++ b/client/src/actions.jsx @@ -1,12 +1,11 @@ export const setAccount = value => ({ type: 'SET_ACCOUNT', value }); export const setAnimating = value => ({ type: 'SET_ANIMATING', value }); -export const setAnimCb = value => ({ type: 'SET_ANIM_CB', value }); export const setAnimFocus = value => ({ type: 'SET_ANIM_FOCUS', value }); -export const setAnimSkill = value => ({ type: 'SET_ANIM_SKILL', value }); +export const setAnimSkill = value => ({ type: 'SET_ANIM_SKILL', value }); export const setAnimSource = value => ({ type: 'SET_ANIM_SOURCE', value }); export const setAnimTarget = value => ({ type: 'SET_ANIM_TARGET', value }); -export const setAnimText = value => ({ type: 'SET_ANIM_TEXT', value }); +export const setResolution = value => ({ type: 'SET_RESOLUTION', value }); export const setDemo = value => ({ type: 'SET_DEMO', value }); diff --git a/client/src/animations.socket.jsx b/client/src/animations.socket.jsx index d42ded1b..b81e752b 100644 --- a/client/src/animations.socket.jsx +++ b/client/src/animations.socket.jsx @@ -51,10 +51,10 @@ function createSocket(store) { if (r.stages.includes('POST_SKILL') && text) { // timeout to prevent text classes from being added too soon if (timeout === TIMES.POST_SKILL_DURATION_MS) { - store.dispatch(actions.setAnimText(text)); + store.dispatch(actions.setResolution(text)); } else { setTimeout( - () => store.dispatch(actions.setAnimText(text)), + () => store.dispatch(actions.setResolution(text)), timeout - TIMES.POST_SKILL_DURATION_MS ); } @@ -64,7 +64,7 @@ function createSocket(store) { store.dispatch(actions.setAnimSkill(null)); store.dispatch(actions.setAnimSource(null)); store.dispatch(actions.setAnimTarget(null)); - store.dispatch(actions.setAnimText(null)); + store.dispatch(actions.setResolution(null)); store.dispatch(actions.setAnimFocus([])); if (r.stages.includes('END_SKILL') && animations.isCbAnim(anims.animSkill)) return true; return cb(); @@ -75,7 +75,7 @@ function createSocket(store) { store.dispatch(actions.setAnimSkill(null)); store.dispatch(actions.setAnimSource(null)); store.dispatch(actions.setAnimTarget(null)); - store.dispatch(actions.setAnimText(null)); + store.dispatch(actions.setResolution(null)); store.dispatch(actions.setAnimating(false)); store.dispatch(actions.setGameEffectInfo(null)); diff --git a/client/src/animations.utils.jsx b/client/src/animations.utils.jsx index 2290f560..25542967 100644 --- a/client/src/animations.utils.jsx +++ b/client/src/animations.utils.jsx @@ -7,7 +7,7 @@ function setAnimations(r, store, account) { store.dispatch(actions.setAnimFocus(focus)); if (type === 'Cast') { - store.dispatch(actions.setAnimText(null)); + store.dispatch(actions.setResolution(null)); const { construct, player, direction: [x, y] } = variant; const animY = y && player === account.id ? -1 : y; @@ -22,7 +22,7 @@ function setAnimations(r, store, account) { } if (type.includes('Hit')) { - store.dispatch(actions.setAnimText(null)); + store.dispatch(actions.setResolution(null)); const { construct, player, direction: [x, y] } = variant; const animY = y && player === account.id ? -1 : y; @@ -38,14 +38,14 @@ function setAnimations(r, store, account) { return setTimeout(() => store.dispatch(actions.setAnimTarget(null)), TIMES.TARGET_DURATION_MS); } - return store.dispatch(actions.setAnimText(r)); + return store.dispatch(actions.setResolution(r)); } function clearAnimations(store) { store.dispatch(actions.setAnimSkill(null)); store.dispatch(actions.setAnimSource(null)); store.dispatch(actions.setAnimTarget(null)); - store.dispatch(actions.setAnimText(null)); + store.dispatch(actions.setResolution(null)); store.dispatch(actions.setAnimating(false)); store.dispatch(actions.setGameEffectInfo(null)); store.dispatch(actions.setAnimFocus(null)); diff --git a/client/src/components/construct.jsx b/client/src/components/construct.jsx index 57b221ab..f4ecbd3e 100644 --- a/client/src/components/construct.jsx +++ b/client/src/components/construct.jsx @@ -13,8 +13,8 @@ const { ConstructAnimation } = require('./animations'); const addState = connect( function receiveState(state) { - const { animSource, animTarget, animText } = state; - return { animSource, animTarget, animText }; + const { animSource, animTarget, resolution } = state; + return { animSource, animTarget, resolution }; } ); @@ -62,9 +62,9 @@ class ConstructAvatar extends Component { } componentDidUpdate(prevProps) { - const { animSource, animTarget, animText, construct } = this.props; + const { animSource, animTarget, resolution, construct } = this.props; // a different text object and text construct - if (animText && animText !== prevProps.animText && animText.constructId === construct.id) { + if (resolution && resolution !== prevProps.resolution && resolution.constructId === construct.id) { return wiggle(construct.id, this.idle); } @@ -86,10 +86,10 @@ class ConstructAvatar extends Component { shouldComponentUpdate(newProps) { - const { animSource, animTarget, animText, construct, mouseOver } = newProps; + const { animSource, animTarget, resolution, construct, mouseOver } = newProps; if (animSource !== this.props.animSource) return true; if (animTarget !== this.props.animTarget) return true; - if (animText !== this.props.animText) return true; + if (resolution !== this.props.resolution) return true; if (construct !== this.props.construct) return true; if (mouseOver !== this.props.mouseOver) return true; return false; diff --git a/client/src/components/game.construct.anim.text.jsx b/client/src/components/game.construct.anim.text.jsx index 56f8f04d..07773ad7 100644 --- a/client/src/components/game.construct.anim.text.jsx +++ b/client/src/components/game.construct.anim.text.jsx @@ -7,17 +7,17 @@ const shapes = require('./shapes'); const { removeTier } = require('../utils'); const { TIMES } = require('./../constants'); -const addState = connect(({ animText, itemInfo }) => ({ animText, itemInfo })); +const addState = connect(({ resolution, itemInfo }) => ({ resolution, itemInfo })); class AnimText extends preact.Component { shouldComponentUpdate(newProps) { - if (newProps.animText !== this.props.animText) return true; + if (newProps.resolution !== this.props.resolution) return true; return false; } componentDidUpdate(prevProps) { - const { animText, construct } = this.props; - if (animText && animText !== prevProps.animText && animText.event[1].construct === construct.id) { + const { resolution, construct } = this.props; + if (resolution && resolution !== prevProps.resolution && resolution.event[1].construct === construct.id) { anime({ targets: '.combat-text', top: '40%', @@ -28,10 +28,10 @@ class AnimText extends preact.Component { } render() { - const { construct, animText, itemInfo } = this.props; - if (animText && animText.event[1].construct === construct.id) { + const { construct, resolution, itemInfo } = this.props; + if (resolution && resolution.event[1].construct === construct.id) { const itemSourceDescription = () => { - const itemSource = itemInfo.combos.filter(c => c.item === removeTier(animText.skill)); + const itemSource = itemInfo.combos.filter(c => c.item === removeTier(resolution.skill)); const itemSourceInfo = itemSource.length ? `${itemSource[0].components[0]} ${itemSource[0].components[1]} ${itemSource[0].components[2]}` : false; @@ -40,7 +40,7 @@ class AnimText extends preact.Component { }; const generateAnimText = () => { - const [type, event] = animText.event; + const [type, event] = resolution.event; if (type === 'Ko') return