From 3ee32b3ef211b8a4ef4d5465ffa9608f5a015117 Mon Sep 17 00:00:00 2001 From: ntr Date: Tue, 12 Nov 2019 16:32:19 +1100 Subject: [PATCH] pvp leave queue implemented --- client/src/actions.jsx | 1 + client/src/components/play.jsx | 43 +++++++++++++++++++++++++++------- client/src/events.jsx | 6 +++++ client/src/reducers.jsx | 1 + client/src/socket.jsx | 19 ++++++++++++--- server/src/events.rs | 14 +++++++++++ server/src/rpc.rs | 7 +++++- 7 files changed, 79 insertions(+), 12 deletions(-) diff --git a/client/src/actions.jsx b/client/src/actions.jsx index 59959393..ebec075d 100644 --- a/client/src/actions.jsx +++ b/client/src/actions.jsx @@ -41,6 +41,7 @@ export const setReclaiming = value => ({ type: 'SET_RECLAIMING', value }); export const setShowLog = value => ({ type: 'SET_SHOW_LOG', value }); export const setShop = value => ({ type: 'SET_SHOP', value }); export const setSubscription = value => ({ type: 'SET_SUBSCRIPTION', value }); +export const setPvp = value => ({ type: 'SET_PVP', value }); export const setTeam = value => ({ type: 'SET_TEAM', value: Array.from(value) }); export const setTeamPage = value => ({ type: 'SET_TEAM_PAGE', value }); diff --git a/client/src/components/play.jsx b/client/src/components/play.jsx index 2059f774..2c97b77f 100644 --- a/client/src/components/play.jsx +++ b/client/src/components/play.jsx @@ -14,6 +14,7 @@ const addState = connect( account, instances, invite, + pvp, } = state; function sendInstanceState(id) { @@ -32,15 +33,21 @@ const addState = connect( ws.sendInstanceInvite(); } + function sendInstanceLeave() { + ws.sendInstanceLeave(); + } + return { account, instances, invite, + pvp, sendInstanceState, sendInstanceQueue, sendInstancePractice, sendInstanceInvite, + sendInstanceLeave, }; }, @@ -67,11 +74,13 @@ function Play(args) { account, instances, invite, + pvp, sendInstanceState, sendInstanceQueue, sendInstancePractice, sendInstanceInvite, + sendInstanceLeave, setNav, } = args; @@ -125,6 +134,31 @@ function Play(args) { ); }; + const pvpBtn = () => { + if (pvp) return ( +
+ +
Finding Opponent
+
+ ); + + return ( +
+ +
Matchmaking
+
+ ); + } + const subscription = account.subscribed ? -
Matchmaking
- + {pvpBtn()} {inviteBtn()}