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>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user