combat text init
This commit is contained in:
@@ -96,26 +96,16 @@ class ConstructAvatar extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const addStateText = connect(
|
||||
function receiveState(state) {
|
||||
const { animText } = state;
|
||||
return { animText };
|
||||
}
|
||||
);
|
||||
|
||||
function constructText(props) {
|
||||
const { construct, animText } = props;
|
||||
function ConstructText(props) {
|
||||
const { construct } = props;
|
||||
if (!construct) return false;
|
||||
|
||||
const text = animText && animText.constructId === construct.id
|
||||
? animText.text
|
||||
: construct.name;
|
||||
const text = construct.name;
|
||||
|
||||
return <h3 class={'name'}><span>{text}</span></h3>;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
ConstructAvatar: addState(ConstructAvatar),
|
||||
ConstructText: addStateText(constructText),
|
||||
ConstructText,
|
||||
};
|
||||
|
||||
@@ -12,6 +12,23 @@ const actions = require('../actions');
|
||||
|
||||
const SkillBtn = require('./skill.btn');
|
||||
|
||||
const addStateText = connect(
|
||||
function receiveState(state) {
|
||||
const { animText } = state;
|
||||
return { animText };
|
||||
}
|
||||
);
|
||||
|
||||
function combatText(props) {
|
||||
const { construct, animText } = props;
|
||||
const text = animText && animText.constructId === construct.id
|
||||
? <h1 class="combat-text"><span>{animText.text}</span></h1>
|
||||
: null;
|
||||
return text;
|
||||
}
|
||||
|
||||
const ConstructAnimationText = addStateText(combatText);
|
||||
|
||||
const addState = connect(
|
||||
function receiveState(state) {
|
||||
const {
|
||||
@@ -179,6 +196,7 @@ class GameConstruct extends Component {
|
||||
<div class="stats"> {stats} </div>
|
||||
<ConstructAvatar construct={construct} />
|
||||
<ConstructText construct={construct} />
|
||||
<ConstructAnimationText construct={construct} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -85,7 +85,7 @@ function registerEvents(store) {
|
||||
const newRes = game.resolved.slice(currentGame.resolved.length);
|
||||
return eachSeries(newRes, (r, cb) => {
|
||||
if (!r.event) return cb();
|
||||
const timeout = animations.getTime(r.stages);
|
||||
let timeout = animations.getTime(r.stages);
|
||||
const anims = animations.getObjects(r, game, account);
|
||||
const text = animations.getText(r);
|
||||
store.dispatch(actions.setAnimFocus(animations.getFocusTargets(r, game)));
|
||||
@@ -107,8 +107,9 @@ function registerEvents(store) {
|
||||
} else {
|
||||
setTimeout(
|
||||
() => store.dispatch(actions.setAnimText(text)),
|
||||
timeout - TIMES.POST_SKILL_DURATION_MS
|
||||
timeout - TIMES.POST_SKILL_DURATION_MS - 500
|
||||
);
|
||||
timeout -= 500;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user