Ejemplo n.º 1
0
 /// <summary>
 /// 发送聊天内容
 /// </summary>
 private void SendMsg()
 {
     if (View.sendInput.text.Length == 0)
     {
         PopMsg.Instance.ShowMsg("请输入聊天内容");
     }
     else
     {
         GameMgrProxy gameMgrProxy =
             ApplicationFacade.Instance.RetrieveProxy(Proxys.GAMEMGR_PROXY) as GameMgrProxy;
         BattleProxy battleProxy =
             ApplicationFacade.Instance.RetrieveProxy(Proxys.BATTLE_PROXY) as BattleProxy;
         if (gameMgrProxy.systemTime - battleProxy.perSendChatTime < GlobalData.SendChatInvoke)
         {
             PopMsg.Instance.ShowMsg("请不要频繁发送");
             return;
         }
         SendChatC2S sendChatC2S = new SendChatC2S();
         sendChatC2S.content = View.sendInput.text;
         NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_TEXT_CHAT.GetHashCode(), 0, sendChatC2S);
         View.sendInput.text         = "";
         battleProxy.perSendChatTime = gameMgrProxy.systemTime;
         UIManager.Instance.HideUI(UIViewID.CHAT_VIEW);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 模拟客户端发送聊天
        /// </summary>
        /// <param name="chat"></param>
        private void SendChatHandler(SendChatC2S chat)
        {
            var pushChat = new PushSendChatS2C();

            pushChat.senderUserId = playerInfoProxy.UserInfo.UserID;
            pushChat.content      = chat.content;
            NetMgr.Instance.OnClientReceiveBuff(MsgNoS2C.PUSH_CHAT.GetHashCode(), 0, pushChat);
        }
Ejemplo n.º 3
0
        public void SendChatMessage(ChatType type, string chatContent, long playerId, ChatConsumptionType chatConsumptionType)
        {
            SendChatC2S message = new SendChatC2S();

            message.chatType            = type;
            message.chatContent         = chatContent;
            message.chatConsumptionType = chatConsumptionType;

            if (playerId != 0)
            {
                message.playerId = playerId;
            }

            byte[] stream = ProtobufUtils.Serialize(message);
            NetworkManager.SendRequest(ServerType.SocialServer, MsgCode.SendChatMessage, stream);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 发送表情
        /// </summary>
        /// <param name="index"></param>
        private void SendFace(int index)
        {
            GameMgrProxy gameMgrProxy =
                ApplicationFacade.Instance.RetrieveProxy(Proxys.GAMEMGR_PROXY) as GameMgrProxy;
            BattleProxy battleProxy =
                ApplicationFacade.Instance.RetrieveProxy(Proxys.BATTLE_PROXY) as BattleProxy;

            if (gameMgrProxy.systemTime - battleProxy.perSendChatTime < GlobalData.SendChatInvoke)
            {
                PopMsg.Instance.ShowMsg("请不要频繁发送");
                return;
            }
            SendChatC2S sendChatC2S = new SendChatC2S();

            sendChatC2S.content = GlobalData.FACE_PREFIX + index;
            NetMgr.Instance.SendBuff(SocketType.BATTLE, MsgNoC2S.C2S_ROOM_TEXT_CHAT.GetHashCode(), 0, sendChatC2S);
            battleProxy.perSendChatTime = gameMgrProxy.systemTime;
            UIManager.Instance.HideUI(UIViewID.CHAT_VIEW);
        }