working with combat text
This commit is contained in:
commit
066bfd0756
@ -129,6 +129,7 @@ img {
|
|||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
width: auto;
|
width: auto;
|
||||||
height: auto;
|
height: auto;
|
||||||
|
pointer-events: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -681,10 +682,22 @@ table td svg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.combat-text {
|
.combat-text {
|
||||||
position: fixed;
|
|
||||||
top: 50%;
|
|
||||||
fill: whitesmoke;
|
fill: whitesmoke;
|
||||||
|
font-size: 2em;
|
||||||
font-family: 'Jura';
|
font-family: 'Jura';
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.team-opponent .combat-text {
|
||||||
|
left: 40%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.img {
|
||||||
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.team-player {
|
.team-player {
|
||||||
|
|||||||
@ -10,19 +10,6 @@ const InstanceContainer = require('./instance.container');
|
|||||||
const addState = connect(
|
const addState = connect(
|
||||||
state => {
|
state => {
|
||||||
const { game, instance, ws, account } = state;
|
const { game, instance, ws, account } = state;
|
||||||
|
|
||||||
if (!game) {
|
|
||||||
ws.clearGameStateTimeout();
|
|
||||||
} else {
|
|
||||||
ws.startGameStateTimeout(game.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!instance) {
|
|
||||||
ws.clearInstanceStateTimeout();
|
|
||||||
} else {
|
|
||||||
ws.startInstanceStateTimeout(instance.id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return { game, instance, account };
|
return { game, instance, account };
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|||||||
@ -143,7 +143,6 @@ function GamePanel(props) {
|
|||||||
));
|
));
|
||||||
|
|
||||||
const combatText = getCombatText(cryp, resolution);
|
const combatText = getCombatText(cryp, resolution);
|
||||||
|
|
||||||
const combatTextEl = combatText
|
const combatTextEl = combatText
|
||||||
? <div className="combat-text">{combatText}</div>
|
? <div className="combat-text">{combatText}</div>
|
||||||
: null;
|
: null;
|
||||||
@ -156,7 +155,7 @@ function GamePanel(props) {
|
|||||||
onClick={() => selectSkillTarget(cryp.id)} >
|
onClick={() => selectSkillTarget(cryp.id)} >
|
||||||
<figure className="img">
|
<figure className="img">
|
||||||
<img src={`/molecules/${genAvatar(cryp.name)}.svg`} />
|
<img src={`/molecules/${genAvatar(cryp.name)}.svg`} />
|
||||||
<div className="combat-text">attack</div>
|
{combatTextEl}
|
||||||
<div>{cryp.name}</div>
|
<div>{cryp.name}</div>
|
||||||
</figure>
|
</figure>
|
||||||
<div className="stats">
|
<div className="stats">
|
||||||
|
|||||||
@ -78,6 +78,9 @@ function GameCryp(props) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const combatText = getCombatText(cryp, resolution);
|
const combatText = getCombatText(cryp, resolution);
|
||||||
|
const combatTextEl = combatText
|
||||||
|
? <div className="combat-text">{combatText}</div>
|
||||||
|
: null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
@ -89,6 +92,7 @@ function GameCryp(props) {
|
|||||||
className="img"
|
className="img"
|
||||||
onClick={() => selectSkillTarget(cryp.id)} >
|
onClick={() => selectSkillTarget(cryp.id)} >
|
||||||
<img src={`/molecules/${genAvatar(cryp.name)}.svg`} />
|
<img src={`/molecules/${genAvatar(cryp.name)}.svg`} />
|
||||||
|
{combatTextEl}
|
||||||
<div>{cryp.name}</div>
|
<div>{cryp.name}</div>
|
||||||
</figure>
|
</figure>
|
||||||
<div className="skills">
|
<div className="skills">
|
||||||
|
|||||||
@ -6,6 +6,15 @@ const { TIMES } = require('./constants');
|
|||||||
const { getCombatSequence } = require('./utils');
|
const { getCombatSequence } = require('./utils');
|
||||||
|
|
||||||
function registerEvents(store) {
|
function registerEvents(store) {
|
||||||
|
|
||||||
|
// timeout handlers
|
||||||
|
store.subscribe(() => {
|
||||||
|
const { game, instance, ws} = store.getState();
|
||||||
|
|
||||||
|
if (!game) ws.clearGameStateTimeout();
|
||||||
|
if (!instance) ws.clearInstanceStateTimeout();
|
||||||
|
});
|
||||||
|
|
||||||
function setCryps(cryps) {
|
function setCryps(cryps) {
|
||||||
console.log('EVENT ->', 'cryps', cryps);
|
console.log('EVENT ->', 'cryps', cryps);
|
||||||
}
|
}
|
||||||
@ -21,8 +30,7 @@ function registerEvents(store) {
|
|||||||
function setGame(game) {
|
function setGame(game) {
|
||||||
const { game: currentGame, ws } = store.getState();
|
const { game: currentGame, ws } = store.getState();
|
||||||
|
|
||||||
if (!game) ws.clearGameStateTimeout();
|
if (game) ws.startGameStateTimeout(game.id);
|
||||||
|
|
||||||
if (game && currentGame) {
|
if (game && currentGame) {
|
||||||
if (game.resolved.length !== currentGame.resolved.length) {
|
if (game.resolved.length !== currentGame.resolved.length) {
|
||||||
// stop fetching the game state til animations are done
|
// stop fetching the game state til animations are done
|
||||||
@ -99,10 +107,8 @@ function registerEvents(store) {
|
|||||||
const { account, ws } = store.getState();
|
const { account, ws } = store.getState();
|
||||||
const player = v.players.find(p => p.id === account.id);
|
const player = v.players.find(p => p.id === account.id);
|
||||||
if (player) store.dispatch(actions.setPlayer(player));
|
if (player) store.dispatch(actions.setPlayer(player));
|
||||||
|
if (v) ws.startInstanceStateTimeout(v.id);
|
||||||
|
|
||||||
if (!v) {
|
|
||||||
ws.clearInstanceStateTimeout();
|
|
||||||
}
|
|
||||||
return store.dispatch(actions.setInstance(v));
|
return store.dispatch(actions.setInstance(v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -218,8 +218,6 @@ function createSocket(events) {
|
|||||||
|
|
||||||
function instanceState(response) {
|
function instanceState(response) {
|
||||||
const [structName, i] = response;
|
const [structName, i] = response;
|
||||||
clearTimeout(instanceStateTimeout);
|
|
||||||
instanceStateTimeout = setTimeout(() => sendInstanceState(i.id), 1000);
|
|
||||||
events.setInstance(i);
|
events.setInstance(i);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -228,7 +226,6 @@ function createSocket(events) {
|
|||||||
clearTimeout(instanceStateTimeout);
|
clearTimeout(instanceStateTimeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function instanceScores(response) {
|
function instanceScores(response) {
|
||||||
const [structName, scores] = response;
|
const [structName, scores] = response;
|
||||||
events.setScores(scores);
|
events.setScores(scores);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user