From ddca205f0c6c080bf0a5ebf4fcaf3e4b5af37733 Mon Sep 17 00:00:00 2001 From: ntr Date: Fri, 18 Oct 2019 15:38:40 +1100 Subject: [PATCH] chat wheelu --- client/src/actions.jsx | 3 ++ client/src/components/chat.jsx | 26 ++++------ client/src/components/instance.ctrl.jsx | 7 ++- client/src/components/player.box.jsx | 5 +- client/src/events.jsx | 10 ++++ client/src/reducers.jsx | 3 ++ client/src/socket.jsx | 8 ++++ server/src/account.rs | 13 +++++ server/src/events.rs | 63 +++++++++++++++++++++++-- server/src/instance.rs | 3 ++ server/src/rpc.rs | 41 ++++++++++------ 11 files changed, 143 insertions(+), 39 deletions(-) diff --git a/client/src/actions.jsx b/client/src/actions.jsx index f43d8a6c..415c5d4f 100644 --- a/client/src/actions.jsx +++ b/client/src/actions.jsx @@ -12,6 +12,9 @@ export const setAnimText = value => ({ type: 'SET_ANIM_TEXT', value }); export const setDemo = value => ({ type: 'SET_DEMO', value }); export const setChatShow = value => ({ type: 'SET_CHAT_SHOW', value }); +export const setChatWheel = value => ({ type: 'SET_CHAT_WHEEL', value }); +export const setInstanceChat = value => ({ type: 'SET_INSTANCE_CHAT', value }); + export const setActiveItem = value => ({ type: 'SET_ACTIVE_VAR', value }); export const setActiveSkill = (constructId, skill) => ({ type: 'SET_ACTIVE_SKILL', value: constructId ? { constructId, skill } : null }); export const setCombiner = value => ({ type: 'SET_COMBINER', value: Array.from(value) }); diff --git a/client/src/components/chat.jsx b/client/src/components/chat.jsx index 05292096..f5f0a826 100644 --- a/client/src/components/chat.jsx +++ b/client/src/components/chat.jsx @@ -8,18 +8,20 @@ const addState = connect( const { ws, chatShow, + chatWheel, instance, } = state; - function sendChat(i) { - // return ws.sendChat(i); + function sendInstanceChat(instance, i) { + return ws.sendInstanceChat(instance, i); } return { instance, chatShow, + chatWheel, - sendChat, + sendInstanceChat, }; }, @@ -38,31 +40,21 @@ function Chat(args) { const { instance, chatShow, + chatWheel, - sendChat, + sendInstanceChat, setChatShow, } = args; - const chat = [ - 'gl', - 'hf', - 'gg', - 'thx', - 'nice', - 'hmm', - 'ok', - '...', - ]; - function onClick(i) { - sendChat(i); + sendInstanceChat(instance.id, i); setChatShow(false); return true; } return (
- {chat.map((c, i) => )} + {chatWheel.map((c, i) => )}
); } diff --git a/client/src/components/instance.ctrl.jsx b/client/src/components/instance.ctrl.jsx index 5d8b30ba..b025d239 100644 --- a/client/src/components/instance.ctrl.jsx +++ b/client/src/components/instance.ctrl.jsx @@ -13,6 +13,7 @@ const addState = connect( const { ws, instance, + instanceChat, account, chatShow, } = state; @@ -20,6 +21,7 @@ const addState = connect( return { chatShow, instance, + instanceChat, account, }; }, @@ -29,6 +31,7 @@ function Controls(args) { const { account, instance, + instanceChat, chatShow, } = args; @@ -65,14 +68,14 @@ function Controls(args) { const bottom = chatShow ? - : ; + : ; return (