Пример #1
0
 //-------------------------------------------------------------------------
 // 桌子内聊天广播
 public void desktopChat(ChatMsgRecv msg_rev)
 {
     //ChatInfo chat_info
     //if (SceneActorObj != null)
     //{
     //    SceneActorObj.setChatInfo(chat_info);
     //}
 }
Пример #2
0
        //---------------------------------------------------------------------
        public Task c2sSendDesktopChat(ChatMsgRecv msg_recv)
        {
            if (!string.IsNullOrEmpty(DesktopEtGuid))
            {
                var grain         = Entity.getUserData <GrainCellPlayer>();
                var grain_desktop = grain.GF.GetGrain <ICellDesktop>(new Guid(DesktopEtGuid));
                grain_desktop.s2sDesktopChat(msg_recv);
            }

            return(TaskDone.Done);
        }
Пример #3
0
        //-------------------------------------------------------------------------
        void _s2cChatMsg(ChatMsgRecv msg_recv)
        {
            PlayerChatNotify playerchat_notify;

            playerchat_notify.id   = PlayerChatNotifyId.RecvChatMsg;
            playerchat_notify.data = EbTool.protobufSerialize <ChatMsgRecv>(msg_recv);

            MethodData method_data = new MethodData();

            method_data.method_id = MethodType.s2cPlayerChatNotify;
            method_data.param1    = EbTool.protobufSerialize <PlayerChatNotify>(playerchat_notify);
            var grain        = Entity.getUserData <GrainCellPlayer>();
            var grain_player = grain.GF.GetGrain <ICellPlayer>(new Guid(Entity.Guid));

            grain_player.s2sNotify(method_data);
        }
Пример #4
0
        //---------------------------------------------------------------------
        // 桌子内聊天广播
        public Task s2sDesktopChat(ChatMsgRecv msg)
        {
            DesktopNotify desktop_notify;

            desktop_notify.id   = DesktopNotifyId.PlayerChat;
            desktop_notify.data = EbTool.protobufSerialize <ChatMsgRecv>(msg);

            StreamData sd = new StreamData();

            sd.event_id = StreamEventId.DesktopStreamEvent;
            sd.param1   = desktop_notify;
            var grain_desktop = Entity.getUserData <GrainCellDesktop>();

            grain_desktop.AsyncStream.OnNextAsync(sd);

            return(TaskDone.Done);
        }
Пример #5
0
        //-------------------------------------------------------------------------
        // 添加好友聊天消息记录
        public void addFriendMsgRecord(ChatMsgRecv msg)
        {
            string friend_etguid = "";

            ChatMsgRecord record = new ChatMsgRecord();

            if (msg.et_player_guid_send == Entity.Guid)
            {
                record.is_me  = true;
                friend_etguid = msg.et_player_guid_recv;
            }
            else
            {
                record.is_me  = false;
                friend_etguid = msg.et_player_guid_send;
            }
            record.content = msg.content;
            record.dt      = msg.dt;

            List <ChatMsgRecord> list_record = null;

            MapMsgRecord.TryGetValue(friend_etguid, out list_record);
            if (list_record == null)
            {
                list_record = new List <ChatMsgRecord>();
                MapMsgRecord[friend_etguid] = list_record;
            }

            list_record.Add(record);
            if (list_record.Count > 1000)
            {
                list_record.RemoveAt(0);
            }

            //UiMbChatMsg chat_msg = UiMgr.Instance.getCurrentUi<UiMbChatMsg>();
            //if (chat_msg != null)
            //{
            //    chat_msg.setCurrentChatMsg(record, msg.et_player_guid_send);
            //}
        }
Пример #6
0
 //---------------------------------------------------------------------
 // 好友聊天
 async Task ICellPlayerProxy.s2sRecvChatFromFriend(ChatMsgRecv msg_recv)
 {
 }
Пример #7
0
        //---------------------------------------------------------------------
        // 桌子内聊天广播
        Task ICellDesktop.s2sDesktopChat(ChatMsgRecv msg)
        {
            var co_desktop = EtDesktop.getComponent <CellDesktop <DefDesktop> >();

            return(co_desktop.s2sDesktopChat(msg));
        }
Пример #8
0
 //-------------------------------------------------------------------------
 // 玩家桌内聊天通知
 public void onRecvChatFromDesktop(ChatMsgRecv msg_recv)
 {
 }
Пример #9
0
        //-------------------------------------------------------------------------
        public Task <MethodData> c2sPlayerChatRequest(MethodData method_data)
        {
            MethodData result = new MethodData();

            result.method_id = MethodType.None;

            var playerchat_request = EbTool.protobufDeserialize <PlayerChatRequest>(method_data.param1);

            switch (playerchat_request.id)
            {
            case PlayerChatRequestId.SendChatMsg:
            {
                var msg = EbTool.protobufDeserialize <ChatMsgSend>(playerchat_request.data);

                switch (msg.chat_type)
                {
                case ChatType.Desktop:            // 牌桌中聊天广播
                {
                    ChatMsgRecv msg_recv = new ChatMsgRecv();
                    msg_recv.chat_type           = msg.chat_type;
                    msg_recv.is_emotion          = msg.is_emotion;
                    msg_recv.content             = msg.content;
                    msg_recv.et_player_guid_recv = msg.et_player_guid_recv;
                    msg_recv.et_player_guid_send = Entity.Guid;
                    msg_recv.dt = DateTime.Now;

                    CoPlayer.CoPlayerDesktop.c2sSendDesktopChat(msg_recv);
                }
                break;

                case ChatType.Friend:            // 好友聊天
                {
                    // 返回给自己
                    ChatMsgRecv msg_recv = new ChatMsgRecv();
                    msg_recv.chat_type           = msg.chat_type;
                    msg_recv.is_emotion          = msg.is_emotion;
                    msg_recv.content             = msg.content;
                    msg_recv.et_player_guid_recv = msg.et_player_guid_recv;
                    msg_recv.et_player_guid_send = Entity.Guid;
                    msg_recv.dt = DateTime.Now;

                    // 发送给好友
                    var grain             = Entity.getUserData <GrainCellPlayer>();
                    var grain_playerproxy = grain.GF.GetGrain <ICellPlayerProxy>(new Guid(msg.et_player_guid_recv));
                    grain_playerproxy.s2sRecvChatFromFriend(msg_recv);

                    _s2cChatMsg(msg_recv);
                }
                break;

                default:
                    break;
                }
            }
            break;

            default:
                break;
            }

            return(Task.FromResult(result));
        }
Пример #10
0
        //---------------------------------------------------------------------
        // 桌内聊天
        public Task s2sRecvChatFromDesktop(ChatMsgRecv msg_recv)
        {
            _s2cChatMsg(msg_recv);

            return(TaskDone.Done);
        }
Пример #11
0
        //---------------------------------------------------------------------
        // 好友聊天
        public Task s2sProxyRecvChatFromFriend(ChatMsgRecv msg_recv)
        {
            _s2cChatMsg(msg_recv);

            return(TaskDone.Done);
        }
Пример #12
0
 //---------------------------------------------------------------------
 // 好友聊天
 async Task ICellPlayerProxy.s2sRecvChatFromFriend(ChatMsgRecv msg_recv)
 {
 }