/// <summary> /// 非房主进入桌子 房间模式的 /// </summary> /// <param name="userid"></param> public bool EnterTableAdditive(tb_User tbUser) { //不限制客户端的个数 可能 有破坏的外挂=========== if (_numpertable >= _num_max) { return(false); } BullColorUser myu = new BullColorUser(); myu.Initi(tbUser.IP, _roomid, tbUser, false);// 当成客户端 的IP:Port用 AllocationtoTable(myu); return(true); }
/// <summary> /// 自动2000000 机器人创建一个桌子唯一桌子,系统奖池也是用的这个ID /// </summary> /// <returns></returns> public int CreateTableByRobot( ) { lock (objLock) { if (GMService.isStop) { return(0); } BullColorRoom roomData; roomCache.TryGet(RoomId + "", out roomData); if (roomData == null) { return(0); } int _tid = 0; //只有一个桌子 所有不用生产桌子 if (!unusedTableQue.TryDequeue(out _tid)) { ErrorRecord.Record("201704011350BFC unusedQue.Count <= 0 桌子不够了,,只是能等待排队..."); DicUser = new ConcurrentDictionary <int, BullColorUser>(); return(0); } tb_User tbuser = tb_UserEx.GetFromCachebyUserID(2000000); if (tbuser == null) { ErrorRecord.Record("没有特殊机器人了系 统不能开始牛牛时时彩"); return(0); } BullColorUser tempU = new BullColorUser(); tempU.Initi(tbuser.UserID + "", RoomId, tbuser, true); // 当成客户端 的IP:Port用 roomData.EnterRoomBase(tempU._tbUser.UserID, _currRoomInfo.gameid); //处理状态的,不然一直找不到用户 cs_enterroom _data = new cs_enterroom() { baserate = _currRoomInfo.Baserate, gametype = _currRoomInfo.gametype, gameid = 4, gamemodel = 2, levelid = RoomId, numpertable = 500, roomcard = 0, rankertype = 1, tableCount = 1 }; List <BullColorUser> _tempfirstUser = new List <BullColorUser>(); _tempfirstUser.Add(tempU); BullColorTable tab = new BullColorTable(_currRoomInfo.gameid, this, _tid, _tempfirstUser, _data); //添加到当前桌子列表,以便打牌过程好使用 if (!DicTable.TryAdd(_tid, tab)) { ErrorRecord.Record("add _tableid fial maybe have exist... 201208241601BF"); } return(_tid); } }
/// <summary> /// 用户登录房间时调用 /// </summary> /// <param name="roomID"></param> /// <param name="UserID"></param> /// <param name="ipport"></param> /// <returns></returns> public int EnterRoom(cs_enterroom _data, int UserID, string ipport) { lock (objLock) { if (GMService.isStop) { return(-99); } BullColorRoom roomData; if (!roomCache.TryGet(RoomId + "", out roomData)) { return(-99); } roomData.EnterRoomBase(UserID, _data.gameid); tb_User tbuser = tb_UserEx.GetFromCachebyUserID(UserID); if (tbuser == null) { ErrorRecord.Record("201208241558BF tbuser == null userID:" + UserID); return(0); } if (tbuser.UserMoney > _currRoomInfo._max || tbuser.UserMoney < _currRoomInfo._min) { return(-99); } UserStatus _us = BaseLobby.instanceBase.GetUserStatusbyUserID(UserID); if (_us != null) { if (_us.Status == UserStatusEnum.InTableDaiPai || _us.Status == UserStatusEnum.InTableDaiPaiDis || _us.Status == UserStatusEnum.InTableWaiting) { return(-1); } } BullColorUser tempU = new BullColorUser(); tempU.Initi(ipport, RoomId, tbuser, false);// 当成客户端 的IP:Port用 if (!DicUser.TryAdd(UserID, tempU)) { ErrorRecord.Record("201208241155BF 已经存在ROOM内了, 添加不成功 逻辑需要处理"); } BullColorTable _findtable = GetEmptyPosTable(); if (_findtable != null) { return(DicUser.Count); //直接进入 空桌子 } return(DicUser.Count); //金币模式 等5秒再一起分配 } }