Esempio n. 1
0
        /// <summary>
        /// 掉线 状态通知
        /// </summary>
        /// <param name="userID"></param>
        public void NotifyDisBase(int userid, int _isreconnect)
        {
            BaseUser myu = GetBaseUserByID(userid);

            if (myu == null)
            {
                return;
            }
            if (_isreconnect == 0)
            {
                myu._isDisconnet = true;                        //断线的,不用给他推送了
            }
            sc_disconnect_n _exitForce = new sc_disconnect_n()
            {
                fn = "sc_disconnect_n", result = 1
            };

            _exitForce._msgid    = 1;
            _exitForce.gameid    = _gameid;
            _exitForce.pos       = myu._Pos;
            _exitForce.tableid   = _tableid;
            _exitForce.reconnect = _isreconnect;

            List <UserIDMSG> imList = new List <UserIDMSG>();//给剩下的人发送消息,说明有人离开房间了,,

            ForeashAllDoBase((i) =>
            {
                BaseUser tempUser = _pos2userbase[i];
                imList.Add(new UserIDMSG(tempUser._userid, JsonUtils.Serialize(_exitForce), _pos2userbase[i]._isRobot, tempUser._isDisconnet));
            });
            _bsDataServer.SendDataDelay(imList);
            _tableSendData.Add(imList);
        }
Esempio n. 2
0
        //public void SendTransferMsgBase(int userid, sc_askmoneytrading_n msg)
        //{
        //    List<UserIDMSG> imList = new List<UserIDMSG>();
        //    imList.Add(new UserIDMSG(userid, JsonUtils.Serialize(msg), false, false));
        //    _bsDataServer = BFSendDataServer.instance;
        //    _bsDataServer.SendDataDelay(imList);
        //}

        #region   断线相关
        /// <summary>
        /// 获取断线前的所有进入人的消息列表
        /// </summary>
        /// <param name="userid"></param>
        public void ClearBaseLimit()
        {
            ForeashAllDoBase((i) =>
            {
                BaseUser tempUser = _pos2userbase[i];
                tempUser._WaitClientLimitCount = 0;
            });
        }
Esempio n. 3
0
 protected void InitiAdd(int key, BaseUser _buser)
 {
     _pos2userbase.TryAdd(key, _buser);
     _pos2userbase[key]._Pos = key;
     if (_tablestatus == TableStatusEnum.Playing)
     {
         _pos2userbase[key]._isWatch = true;
     }
 }
Esempio n. 4
0
        /// <summary>
        /// 同位置,与IP警告
        /// </summary>
        public void NotifyWarning()
        {
            //check ip
            bool _havesameip = false;

            ForeashAllDoBase((i) =>
            {
                if (_pos2userbase[i]._isRobot)
                {
                    return;
                }
                if (!_pos2userbase[i]._IPandPort.Contains(":"))
                {
                    return;
                }
                ForeashAllDoBase((j) =>
                {
                    if (_pos2userbase[j]._isRobot)
                    {
                        return;
                    }
                    if (!_pos2userbase[j]._IPandPort.Contains(":"))
                    {
                        return;
                    }
                    if (_pos2userbase[j]._IPandPort.Split(':')[0] == _pos2userbase[i]._IPandPort.Split(':')[0])
                    {
                        _havesameip = true;
                    }
                });
            });
            if (_havesameip)
            {
                sc_warning_n _exitForce = new sc_warning_n()
                {
                    fn = "sc_warning_n", result = 1
                };
                _exitForce._msgid  = 1;
                _exitForce.gameid  = _gameid;
                _exitForce.type    = _havesameip ? 1 : 0;
                _exitForce.content = "有两人在同一IP";

                List <UserIDMSG> imList = new List <UserIDMSG>();//给剩下的人发送消息,说明有人离开房间了,,

                ForeashAllDoBase((i) =>
                {
                    BaseUser tempUser = _pos2userbase[i];
                    imList.Add(new UserIDMSG(tempUser._userid, JsonUtils.Serialize(_exitForce), _pos2userbase[i]._isRobot, tempUser._isDisconnet));
                });
                _bsDataServer.SendDataDelay(imList);
                _tableSendData.Add(imList);
            }
        }
Esempio n. 5
0
        /// <summary>
        ///  初始化进入的人,现在只有一个, 金币模式可能会有多个
        /// </summary>
        protected void EnterTable()
        {
            List <OtherUserInfoSD> oUserlist = new List <OtherUserInfoSD>();

            ForeashAllDoBase((i) =>
            {
                BaseUser _tempBUser                      = _pos2userbase[i];
                _tempBUser._tbwechatposData.pos          = i;
                _tempBUser._tbwechatposData._isDisconnet = _tempBUser._isDisconnet ? 1 : 0;
                _tempBUser._tbwechatposData._isReady     = _tempBUser._isReady ? 1 : 0;
                oUserlist.Add(_tempBUser._tbwechatposData);

                UserStatus us = BaseLobby.instanceBase.GetUserStatusbyUserID(_tempBUser._userid);
                if (us == null)
                {
                    ErrorRecord.Record("201611301736 basetable 必须找到的UserID: " + _tempBUser._userid);
                    return;
                }
                us.TableID = _tableid;
                us.Status  = UserStatusEnum.InTableWaiting;
                BaseLobby.instanceBase.AddorUpdateUserStatus(us);
            });
            //通知所有人,有人进入桌子了
            List <UserIDMSG> imList = new List <UserIDMSG>();

            ForeashAllDoBase((i) =>
            {
                BaseUser tempUser = _pos2userbase[i];
                tempUser._Pos     = i;

                sc_entertable_n _canReady = new sc_entertable_n()
                {
                    fn = "sc_entertable_n", result = 1, _msgid = 8
                };
                _canReady.pos        = tempUser._Pos;
                _canReady.tableid    = _tableid;
                _canReady.gameid     = _gameid;//客服端好做分发
                _canReady.gametype   = _gametype;
                _canReady.palyerlist = oUserlist;
                _canReady.MatchCode  = _tableMathCode + "";
                _canReady.maxCount   = _tableMaxCount;

                imList.Add(new UserIDMSG(tempUser._userid, JsonUtils.Serialize(_canReady), tempUser._isRobot, tempUser._isDisconnet));
            });

            _bsDataServer.SendDataDelay(imList);
            _tableEnterSendData.Add(imList);
        }
Esempio n. 6
0
        /// <summary>
        ///  发送聊天信息
        /// </summary>
        public void SendChatBase(int userid, string content, int _type)
        {
            int pos = 0;

            ForeashAllDoBase((i) =>
            {
                if (_pos2userbase[i]._userid == userid)
                {
                    pos = i;
                }
            });
            if (0 == pos)
            {
                ErrorRecord.Record("201611031040BaseTable  发送消息的User 找不到。 userid:" + userid);
                return;
            }
            List <UserIDMSG> imList = new List <UserIDMSG>();

            ForeashAllDoBase((i) =>
            {
                BaseUser tempUser = _pos2userbase[i];

                sc_chat_n _chat_n = new sc_chat_n()
                {
                    fn = "sc_chat_n", result = 1
                };
                _chat_n.pos     = pos;
                _chat_n.content = content;
                _chat_n.type    = _type;
                _chat_n.gameid  = _gameid;

                imList.Add(new UserIDMSG(tempUser._userid, JsonUtils.Serialize(_chat_n), tempUser._isRobot, tempUser._isDisconnet));
            });
            _bsDataServer.SendDataDelay(imList);
            // _tableSendData.Add(imList); //聊天信息不加入记录
        }