Merge branch 'return-of-react' of ssh://cryps.gg:40022/~/cryps into return-of-react
This commit is contained in:
commit
c42cc73707
2
html-client/src/components/body.component.jsx
Executable file → Normal file
2
html-client/src/components/body.component.jsx
Executable file → Normal file
@ -39,7 +39,7 @@ function renderBody(props) {
|
|||||||
type="submit"
|
type="submit"
|
||||||
onClick={() => setGame(null)}
|
onClick={() => setGame(null)}
|
||||||
>
|
>
|
||||||
Return to Main Menu
|
Back to instance
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
0
html-client/src/components/cryp.list.jsx
Executable file → Normal file
0
html-client/src/components/cryp.list.jsx
Executable file → Normal file
@ -8,9 +8,9 @@ const addState = connect(
|
|||||||
function receiveState(state) {
|
function receiveState(state) {
|
||||||
const { ws, game, account, activeSkill, activeIncoming } = state;
|
const { ws, game, account, activeSkill, activeIncoming } = state;
|
||||||
|
|
||||||
function selectSkillTarget(targetTeamId) {
|
function selectSkillTarget(targetCrypId) {
|
||||||
if (activeSkill) {
|
if (activeSkill) {
|
||||||
return ws.sendGameSkill(game.id, activeSkill.crypId, targetTeamId, activeSkill.skill.skill);
|
return ws.sendGameSkill(game.id, activeSkill.crypId, targetCrypId, activeSkill.skill.skill);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
85
html-client/src/components/game.jsx
Executable file → Normal file
85
html-client/src/components/game.jsx
Executable file → Normal file
@ -69,7 +69,6 @@ function GamePanel(props) {
|
|||||||
<div className="columns" >
|
<div className="columns" >
|
||||||
<div className="column is-10">
|
<div className="column is-10">
|
||||||
<p className="title">{cryp.name}</p>
|
<p className="title">{cryp.name}</p>
|
||||||
<p className="subtitle">Level {cryp.lvl}</p>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="column">
|
<div className="column">
|
||||||
<figure className="image">
|
<figure className="image">
|
||||||
@ -78,11 +77,9 @@ function GamePanel(props) {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div className="has-text-centered">{cryp.hp.value} / {cryp.stam.value} HP </div>
|
<div className="has-text-centered">{cryp.hp.value} / {cryp.hp.max} HP </div>
|
||||||
<progress className="progress is-dark" value={cryp.hp.value} max={cryp.stam.value}></progress>
|
<progress className="progress is-dark" value={cryp.hp.value} max={cryp.hp.max}></progress>
|
||||||
|
|
||||||
<div className="has-text-centered">{cryp.xp} / {Math.pow(2, cryp.lvl + 1)} XP </div>
|
|
||||||
<progress className="progress is-dark" value={cryp.xp} max={Math.pow(2, cryp.lvl + 1)}></progress>
|
|
||||||
</div>
|
</div>
|
||||||
{effects}
|
{effects}
|
||||||
{skills}
|
{skills}
|
||||||
@ -106,28 +103,28 @@ function GamePanel(props) {
|
|||||||
));
|
));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div key={cryp.id} className="tile is-vertical">
|
<div className="tile"
|
||||||
<div className="tile is-child">
|
style={activeSkill ? { cursor: 'pointer' } : {}}
|
||||||
<div className="columns" >
|
onClick={() => selectSkillTarget(cryp.id)} >
|
||||||
<div className="column is-10">
|
<div key={cryp.id} className="tile is-vertical">
|
||||||
<p className="title">{cryp.name}</p>
|
<div className="tile is-child">
|
||||||
<p className="subtitle">Level {cryp.lvl}</p>
|
<div className="columns" >
|
||||||
</div>
|
<div className="column is-10">
|
||||||
<div className="column">
|
<p className="title">{cryp.name}</p>
|
||||||
<figure className="image">
|
</div>
|
||||||
<svg width="40" height="40" data-jdenticon-value={cryp.name} />
|
<div className="column">
|
||||||
</figure>
|
<figure className="image">
|
||||||
|
<svg width="40" height="40" data-jdenticon-value={cryp.name} />
|
||||||
|
</figure>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
<div className="has-text-centered">{cryp.hp.value} / {cryp.hp.value} HP </div>
|
||||||
|
<progress className="progress is-dark" value={cryp.hp.value} max={cryp.hp.max}></progress>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div className="has-text-centered">{cryp.hp.value} / {cryp.stam.value} HP </div>
|
{effects}
|
||||||
<progress className="progress is-dark" value={cryp.hp.value} max={cryp.stam.value}></progress>
|
|
||||||
|
|
||||||
<div className="has-text-centered">{cryp.xp} / {Math.pow(2, cryp.lvl + 1)} XP </div>
|
|
||||||
<progress className="progress is-dark" value={cryp.xp} max={Math.pow(2, cryp.lvl + 1)}></progress>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{effects}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -135,46 +132,30 @@ function GamePanel(props) {
|
|||||||
function OpponentTeam(team) {
|
function OpponentTeam(team) {
|
||||||
const cryps = team.cryps.map(OpponentCrypCard);
|
const cryps = team.cryps.map(OpponentCrypCard);
|
||||||
return (
|
return (
|
||||||
<div
|
<div>
|
||||||
className="tile"
|
|
||||||
style={activeSkill ? { cursor: 'pointer' } : {}}
|
|
||||||
onClick={() => selectSkillTarget(team.id)} >
|
|
||||||
{cryps}
|
{cryps}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// style={{ "min-height": "100%" }}
|
|
||||||
function phaseText(phase) {
|
|
||||||
switch (phase) {
|
|
||||||
case 'Skill':
|
|
||||||
return 'Choose abilities';
|
|
||||||
case 'Target':
|
|
||||||
return 'Block abilities';
|
|
||||||
case 'Finish':
|
|
||||||
return 'Game over';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const logs = game.log.reverse().map((l, i) => (<div key={i}>{l}</div>));
|
const logs = game.log.reverse().map((l, i) => (<div key={i}>{l}</div>));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section className="columns">
|
<section>
|
||||||
<div className="column is-2 title is-1">
|
<div className="row">
|
||||||
{phaseText(game.phase)}
|
<div className="three columns">
|
||||||
</div>
|
{playerTeam.id}
|
||||||
<div className="column is-4">
|
{PlayerTeam(playerTeam, setActiveSkill)}
|
||||||
{PlayerTeam(playerTeam, setActiveSkill)}
|
</div>
|
||||||
</div>
|
<div className="six columns" align="center">
|
||||||
<div className="column is-4">
|
Round X
|
||||||
<div>
|
</div>
|
||||||
|
<div className="three columns">
|
||||||
|
{otherTeams.id}
|
||||||
{otherTeams.map(OpponentTeam)}
|
{otherTeams.map(OpponentTeam)}
|
||||||
</div>
|
</div>
|
||||||
<div>
|
|
||||||
{incoming}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div className="column is-2">
|
<div className="row">
|
||||||
<div className="title is-4">{logs}</div>
|
<div className="title is-4">{logs}</div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
0
html-client/src/components/login.component.jsx
Executable file → Normal file
0
html-client/src/components/login.component.jsx
Executable file → Normal file
0
html-client/src/components/login.container.jsx
Executable file → Normal file
0
html-client/src/components/login.container.jsx
Executable file → Normal file
@ -16,7 +16,8 @@ function registerEvents(store) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setGame(game) {
|
function setGame(game) {
|
||||||
return console.log('EVENT ->', 'game', game);
|
store.dispatch(actions.setGame(game));
|
||||||
|
// return console.log('EVENT ->', 'game', game);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setAccount(account) {
|
function setAccount(account) {
|
||||||
|
|||||||
0
html-client/src/keyboard.jsx
Executable file → Normal file
0
html-client/src/keyboard.jsx
Executable file → Normal file
1
html-client/src/main.jsx
Executable file → Normal file
1
html-client/src/main.jsx
Executable file → Normal file
@ -17,6 +17,7 @@ const Body = require('./components/body.component');
|
|||||||
const store = createStore(
|
const store = createStore(
|
||||||
combineReducers({
|
combineReducers({
|
||||||
account: reducers.accountReducer,
|
account: reducers.accountReducer,
|
||||||
|
activeSkill: reducers.activeSkillReducer,
|
||||||
combiner: reducers.combinerReducer,
|
combiner: reducers.combinerReducer,
|
||||||
game: reducers.gameReducer,
|
game: reducers.gameReducer,
|
||||||
cryps: reducers.crypsReducer,
|
cryps: reducers.crypsReducer,
|
||||||
|
|||||||
@ -10,6 +10,16 @@ function accountReducer(state = defaultAccount, action) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const defaultActiveSkill = null;
|
||||||
|
function activeSkillReducer(state = defaultActiveSkill, action) {
|
||||||
|
switch (action.type) {
|
||||||
|
case actions.SET_ACTIVE_SKILL:
|
||||||
|
return action.value;
|
||||||
|
default:
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const defaultCryps = null;
|
const defaultCryps = null;
|
||||||
function crypsReducer(state = defaultCryps, action) {
|
function crypsReducer(state = defaultCryps, action) {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
@ -72,6 +82,7 @@ function wsReducer(state = defaultWs, action) {
|
|||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
accountReducer,
|
accountReducer,
|
||||||
|
activeSkillReducer,
|
||||||
combinerReducer,
|
combinerReducer,
|
||||||
crypsReducer,
|
crypsReducer,
|
||||||
gameReducer,
|
gameReducer,
|
||||||
|
|||||||
0
html-client/src/socket.jsx
Executable file → Normal file
0
html-client/src/socket.jsx
Executable file → Normal file
Loading…
x
Reference in New Issue
Block a user