fix game btns
This commit is contained in:
parent
daa1b6214b
commit
aa5b76551f
@ -10,6 +10,7 @@ const addState = connect(
|
|||||||
chatShow,
|
chatShow,
|
||||||
chatWheel,
|
chatWheel,
|
||||||
instance,
|
instance,
|
||||||
|
game,
|
||||||
} = state;
|
} = state;
|
||||||
|
|
||||||
function sendInstanceChat(instance, i) {
|
function sendInstanceChat(instance, i) {
|
||||||
@ -18,6 +19,7 @@ const addState = connect(
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
instance,
|
instance,
|
||||||
|
game,
|
||||||
chatShow,
|
chatShow,
|
||||||
chatWheel,
|
chatWheel,
|
||||||
|
|
||||||
@ -39,6 +41,7 @@ const addState = connect(
|
|||||||
function Chat(args) {
|
function Chat(args) {
|
||||||
const {
|
const {
|
||||||
instance,
|
instance,
|
||||||
|
game,
|
||||||
chatShow,
|
chatShow,
|
||||||
chatWheel,
|
chatWheel,
|
||||||
|
|
||||||
@ -47,7 +50,7 @@ function Chat(args) {
|
|||||||
} = args;
|
} = args;
|
||||||
|
|
||||||
function onClick(i) {
|
function onClick(i) {
|
||||||
sendInstanceChat(instance.id, i);
|
sendInstanceChat(instance ? instance.id : game && game.id, i);
|
||||||
setChatShow(false);
|
setChatShow(false);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,8 @@ const addState = connect(
|
|||||||
const {
|
const {
|
||||||
ws,
|
ws,
|
||||||
game,
|
game,
|
||||||
|
account,
|
||||||
|
chatShow,
|
||||||
animating,
|
animating,
|
||||||
} = state;
|
} = state;
|
||||||
|
|
||||||
@ -30,6 +32,8 @@ const addState = connect(
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
game,
|
game,
|
||||||
|
account,
|
||||||
|
chatShow,
|
||||||
sendAbandon,
|
sendAbandon,
|
||||||
sendGameSkillClear,
|
sendGameSkillClear,
|
||||||
sendReady,
|
sendReady,
|
||||||
@ -60,6 +64,8 @@ function GameCtrlBtns(args) {
|
|||||||
const {
|
const {
|
||||||
game,
|
game,
|
||||||
animating,
|
animating,
|
||||||
|
account,
|
||||||
|
chatShow,
|
||||||
|
|
||||||
getInstanceState,
|
getInstanceState,
|
||||||
sendGameSkillClear,
|
sendGameSkillClear,
|
||||||
|
|||||||
@ -4,6 +4,7 @@ const { connect } = require('preact-redux');
|
|||||||
const actions = require('../actions');
|
const actions = require('../actions');
|
||||||
|
|
||||||
const PlayerBox = require('./player.box');
|
const PlayerBox = require('./player.box');
|
||||||
|
const Chat = require('./chat');
|
||||||
const GameCtrlButtons = require('./game.ctrl.btns');
|
const GameCtrlButtons = require('./game.ctrl.btns');
|
||||||
const GameCtrlTopButtons = require('./game.ctrl.btns.top');
|
const GameCtrlTopButtons = require('./game.ctrl.btns.top');
|
||||||
|
|
||||||
@ -13,12 +14,16 @@ const addState = connect(
|
|||||||
animating,
|
animating,
|
||||||
game,
|
game,
|
||||||
account,
|
account,
|
||||||
|
chatShow,
|
||||||
|
instanceChat,
|
||||||
} = state;
|
} = state;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
animating,
|
animating,
|
||||||
game,
|
game,
|
||||||
account,
|
account,
|
||||||
|
chatShow,
|
||||||
|
instanceChat,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@ -28,6 +33,8 @@ function Controls(args) {
|
|||||||
animating,
|
animating,
|
||||||
account,
|
account,
|
||||||
game,
|
game,
|
||||||
|
chatShow,
|
||||||
|
instanceChat,
|
||||||
} = args;
|
} = args;
|
||||||
|
|
||||||
if (!game) return false;
|
if (!game) return false;
|
||||||
@ -37,7 +44,7 @@ function Controls(args) {
|
|||||||
const zero = Date.parse(game.phase_start);
|
const zero = Date.parse(game.phase_start);
|
||||||
const now = animating ? zero : Date.now();
|
const now = animating ? zero : Date.now();
|
||||||
const end = Date.parse(game.phase_end);
|
const end = Date.parse(game.phase_end);
|
||||||
|
|
||||||
const timerPct = game.phase_end
|
const timerPct = game.phase_end
|
||||||
? ((now - zero) / (end - zero) * 100)
|
? ((now - zero) / (end - zero) * 100)
|
||||||
: 100;
|
: 100;
|
||||||
@ -61,13 +68,17 @@ function Controls(args) {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const bottom = chatShow
|
||||||
|
? <Chat />
|
||||||
|
: <PlayerBox player={player} isPlayer={true} chat={instanceChat && instanceChat[player.id]} />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<aside>
|
<aside>
|
||||||
{timer}
|
{timer}
|
||||||
<div class="controls instance-ctrl">
|
<div class="controls instance-ctrl">
|
||||||
<GameCtrlTopButtons />
|
<GameCtrlTopButtons />
|
||||||
<PlayerBox player={opponent}/>
|
<PlayerBox player={opponent} chat={instanceChat && instanceChat[opponent.id]}/>
|
||||||
<PlayerBox player={player} isPlayer={true} />
|
{bottom}
|
||||||
<GameCtrlButtons />
|
<GameCtrlButtons />
|
||||||
</div>
|
</div>
|
||||||
</aside>
|
</aside>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user