/// <summary> /// 分配到 桌子上的空位, /// </summary> public void AllocationtoTable(BullColorUser _adduser) { _adduser._tableID = _tableid; _numpertable += 1; int key = -1; for (int i = 1; i <= _num_max; i++) { if (_DicPos2User.ContainsKey(i)) { continue; } key = i; break; } _adduser._WaitSecond = _TurnWaitTime; //20 _DicPos2User.TryAdd(key, _adduser); if (key == -1) { ErrorRecord.Record("201611172219 fetal error!!!"); return; } base.InitiAdd(key, _adduser as BaseUser); base.EnterTableAdditive(key); _strStatus = "BullColorTable...1.1 for auto ready..."; }
/// <summary> /// 处理的所有人的摊牌与结算了, /// </summary> private void DoExecuteDealShowDown(int userid) { lock (objLock) { List <ShowDownSDBFC> _tempshowdownlist = _judge.GetShowDownList(); //不同游戏处理算法 不同 List <CommonPosValSD> _pos2Gold1 = _judge.GetCurrentPosGold(); List <UserIDMSG> imList = new List <UserIDMSG>(); ForeashAllDo((i) => { BullColorUser tempUser = _DicPos2User[i]; //if (!tempUser._isBanker) return;//只给庄发通知消息 sc_showdown_bfc_n _showdown_n = new sc_showdown_bfc_n() { fn = "sc_showdown_bf_n", result = 1, _msgid = _TurnWaitTime }; ////_showdown_n.sdlist = _tempshowdownlist; ////_showdown_n._pos2Gold = _pos2Gold1; imList.Add(new UserIDMSG(tempUser._userid, JsonUtils.Serialize(_showdown_n), tempUser._isRobot, tempUser._isDisconnet)); }); BFColorSendDataServer.instance.SendDataDelay(imList); _tableSendData.Add(imList); //_bankerCanGetBonusPot 或_isContinueBigGamble 为true 本局先返是否 收取奖池且下庄 BankerGetBonusPot(); 否则直接 End(); _DicPos2User[_bankpos].SetTimeOutAction(1, "sc_showdown_bfc_n", 2); } }
/// <summary> /// 处理的所有人的下注倍数 /// </summary> private void DoExecuteDealGamble() { lock (objLock) { List <UserIDMSG> imList = new List <UserIDMSG>(); List <CommonPosValSD> _dicpos2rate = new List <CommonPosValSD>(); ForeashAllDo((i) => { _dicpos2rate.Add(new CommonPosValSD() { pos = i, val = _DicPos2User[i]._gambleTotal }); }); List <int> _dicelist = new List <int>(); ForeashAllDo((i) => { BullColorUser tempUser = _DicPos2User[i]; ////sc_gambleover_bfc_n _gamble_n = new sc_gambleover_bfc_n() { fn = "sc_gambleover_bfc_n", result = 1, _msgid = 60 }; ////_gamble_n.pos2rate = _dicpos2rate; ////_gamble_n.firstfapaipos = 1; ////_gamble_n.dicelist = _dicelist; ////_gamble_n._shoupai = tempUser._shouPaiArr; ////imList.Add(new UserIDMSG(tempUser._userid, JsonUtils.Serialize(_gamble_n), tempUser._isRobot, tempUser._isDisconnet)); }); BFColorSendDataServer.instance.SendDataDelay(imList); _tableSendData.Add(imList); } }
private void NotifyGambleOne(int _pos, int _targetpos, int _gamble, int lx = 10000, int ly = 10000) { lock (objLock) { List <UserIDMSG> imList = new List <UserIDMSG>(); int _tempallrate = _DicPos2User[_pos]._gambleTotal; if (_tempallrate == 0) { _tempallrate = _DicPos2User[_pos]._gambleTotal; } List <CommonPosValListSD> _pos2OtherPosRate_order = new List <CommonPosValListSD>(); ForeashAllDo((i) => { BullColorUser tempUser = _DicPos2User[i]; sc_gambleone_bfc_n _gambleone_n = new sc_gambleone_bfc_n() { fn = "sc_gambleone_bfc_n", result = 1, _msgid = _TurnWaitTime }; _gambleone_n.pos = _pos; _gambleone_n.targetpos = _targetpos; _gambleone_n.rate = _gamble; _gambleone_n.allrate = _tempallrate; _gambleone_n._curGold = _DicPos2User[_pos]._CurrentGold - _tempallrate; _gambleone_n._pos2Gamble_order = _pos2OtherPosRate_order; _gambleone_n.lx = lx; _gambleone_n.ly = ly; imList.Add(new UserIDMSG(tempUser._userid, JsonUtils.Serialize(_gambleone_n), tempUser._isRobot, tempUser._isDisconnet)); }); BFColorSendDataServer.instance.SendDataDelay(imList); _tableSendData.Add(imList); } }
/// <summary> /// 获取断线前的所有进入人的消息列表 /// </summary> /// <param name="userid"></param> public string GetEnterDisList(int userid) { BullColorUser _userbf = GetUserByID(userid); if (_userbf == null) { return(""); } return(base.GetEnterDisListBase(_userbf._Pos)); }
/// <summary> /// 不同游戏类型结算方法不一样 /// </summary> /// <returns></returns> public List <ShowDownSDBFC> GetShowDownList() { Dictionary <int, ShowDownSDBFC> _tempdicpos2SD = new Dictionary <int, ShowDownSDBFC>(); int _bankerPos = _myTable._bankpos; _myTable.ForeashAllDo((i) => { _tempdicpos2SD.Add(i, new ShowDownSDBFC() { bulltype = (int)_myTable._DicPos2User[i]._bulltype, gamble = _myTable._DicPos2User[i]._gambleTotal, money = 0, pos = i, _cardlist = _myTable._DicPos2User[i]._shouPaiArr }); }); BullColorUser _tempBankerUser = _myTable._DicPos2User[_bankerPos]; _myTable.ForeashAllDo((i) => { if (_myTable._DicPos2User[i]._isBanker) { return; } bool _tempBankerWin = BullFight.ComparePoker(_tempBankerUser._shouPaiArr, _tempBankerUser._bulltype, _myTable._DicPos2User[i]._shouPaiArr, _myTable._DicPos2User[i]._bulltype); if (_tempBankerWin) { int _tempvar = _myTable._baseMoney * _myTable._DicPos2User[i]._gambleTotal * BullFight._dicbullfightRate[_tempBankerUser._bulltype]; _tempdicpos2SD[_bankerPos].money += _tempvar; _tempdicpos2SD[i].money -= _tempvar; } else { int _tempvar = _myTable._baseMoney * _myTable._DicPos2User[i]._gambleTotal * BullFight._dicbullfightRate[_myTable._DicPos2User[i]._bulltype]; _tempdicpos2SD[_bankerPos].money -= _tempvar; _tempdicpos2SD[i].money += _tempvar; } }); //算完后,统一数据持久化 foreach (int key in _tempdicpos2SD.Keys) { if (_tempdicpos2SD[key].money > 0)//扣出5%费用 只要是赢了的人 { _tempdicpos2SD[key].money = (int)(_tempdicpos2SD[key].money * 0.95f); } _myTable._DicPos2User[key]._CurrentGold += _tempdicpos2SD[key].money; } return(_tempdicpos2SD.Values.ToList <ShowDownSDBFC>()); }
/// <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> /// 用户登录房间时调用 /// </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秒再一起分配 } }
/// <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="userID"></param> public void ApplyExitTable(int userid) { lock (objLock) { BullColorUser myu = GetUserByID(userid); if (myu == null) { return; } if (myu.CheckisWatch()) { return; //爆分的人不能申请 } //======================数据统计 //处理超时的动作 由_isAgreeExit状态自行处理 } }
/// <summary> /// 重置此桌信息 /// </summary> public void Reset(bool _no_again) { lock (objLock) { _strStatus = "Reset... "; ForeashAllDo((i) => { BullColorUser _tempuser = _DicPos2User[i]; _tempuser._isBanker = false; _tempuser._shouPaiArr = new List <int>(); _tempuser._bulltype = PokerBullFightType.Bull_No; _tempuser._gambleTotal = 0; _tempuser._SysDealTimeOutCount = 0; _tempuser._gambletime = DateTime.Now.AddYears(100); // _tempuser._WaitClientLimitCount = 0; }); base.ResetBase(_no_again); //不在的用户处理掉 ForeashAllDo((i) => { if (!_pos2userbase.ContainsKey(i)) { BullColorUser _tempu; _DicPos2User.TryRemove(i, out _tempu); } }); if (_numpertable < base._num_min) { _tablestatus = TableStatusEnum.WaitforReady; //人数不够了,,停止下局的自动准备 } if (_no_again) { _DicPos2User = null; _judge = null; BullColorRoom myr = BullColorLobby.instance.GetRoomByRoomID(_roomid); if (myr != null) { myr.ResetTableByTableID(_tableid); } _tableid = 0; } } }
/// <summary> /// 断线重连 暂时不用 /// </summary> public void NotifyReConnect(int userid) { UserStatus _us = BaseLobby.instanceBase.GetUserStatusbyUserID(userid); if (_us == null) { return; } _us.Status = UserStatusEnum.InTableDaiPai; BullColorUser myu = GetUserByID(userid); if (myu == null) { return; } myu._isDisconnet = false; //通知其他人有人上线了 base.NotifyDisBase(userid, 1); }
/// <summary> /// 下注 1次 庄比牛牛特有 /// </summary> public void GambleOne(int userid, int _targetpos, int _gamble, int lx = 10000, int ly = 10000) { BullColorUser myu = GetUserByID(userid); if (myu == null) { return; } if (_DicPos2User[myu._Pos]._isBanker) { return; //庄不能下注 } if (myu.CheckisWatch()) { return; } _DicPos2User[myu._Pos]._gambleTotal += _gamble; //设置累计下注数 _DicPos2User[myu._Pos]._CurrentGold -= _gamble; _DicPos2User[_bankpos]._CurrentGold += _gamble; //奖池 tb_UserEx.UpdateData(_DicPos2User[myu._Pos]._tbUser); }
//=========================================================================================================================== /// <summary> /// 循环当前桌的每一个人 Write by jsw 201208011539 /// </summary> public override void DealEveryUser() { //return;//测试专用 没和限制功能 lock (objLock) { if (_DicPos2User == null) { return; } ForeashAllDo((i) => { BullColorUser _bfuser = null; if (!_DicPos2User.TryGetValue(i, out _bfuser)) { ErrorRecord.Record(" 201611051939BF this is not enough _numpertable" + _numpertable); return; } if (_bfuser._waitUserAction == "0") { return; } switch (_bfuser._waitUserAction) { case "sc_entertable_n": //自动 准备 break; case "sc_ready_bfc_n": Start(); // 一分钟后自己开始 break; case "sc_tablestart_bfc_n": //自动 不抢庄,已处理过的人不用再次处理,机器一定会提前处理的 break; case "sc_gambleover_bfc_n": DoExecuteDealShowDown(_bfuser._userid); //默认都是最大类型 break; case "sc_setbulltype_bfc_n": //TimeOutDoExecuteDealShowDown(_bfuser._userid); break; case "sc_showdown_bfc_n": DoExecuteAllEnd(true); break; case "sc_applyexittable_n": //暂时不处理超时功能 break; case "sc_bankergetbonuspot_bf_n": ////GetReady(_bfuser._userid); break; case "sc_exittable_n_delay": base.ExitTableall(new List <int>(), true); break; default: //没得状态 不处理 ErrorRecord.Record(" 201206171026BF _UserDic[i]._userAction:" + _DicPos2User[i]._waitUserAction); break; } _bfuser.RecordTimeoutCount(); }); base.DealAliveTime(); } }
/// <summary> /// 摹仿客户端 消息处理 不加锁 /// </summary> /// <param name="UserID"></param> /// <param name="strMSG"></param> private static void RobotDealMSG(int UserID, string strMSG) { UserStatus _us = BaseLobby.instanceBase.GetUserStatusbyUserID(UserID); if (_us == null) { ErrorRecord.Record(" 201611301728BF " + UserID); return; } if (_us.Status == UserStatusEnum.InLobby) { return; //一局结算了,收到的消息需要处理,也处理不了,Table已释放 } BullColorUser myu = BullColorLobby.instance.GetUserByRoomIDandTableIDandUserID(_us.RoomID, _us.TableID, UserID); if (myu == null) { ErrorRecord.Record(" 201611301729BF " + UserID + ",_us.Status:" + _us.Status + " strMSG:" + strMSG); return; } sc_base _csdata = JsonUtils.Deserialize <sc_base>(strMSG); if (_csdata == null) { ErrorRecord.Record(" 201206062216BF " + UserID); return; } int _waittime3000 = 4000; switch (_csdata.fn) { case "sc_entertable_n": //自动 准备 //Thread.Sleep(900); sc_entertable_n _entertable = JsonUtils.Deserialize <sc_entertable_n>(strMSG); BullColorTable myt001 = BullColorLobby.instance.GetTableByRoomIDandTableID(myu._roomid, myu._tableID); if (myt001 != null && myu._Pos == _entertable.pos) { //// myt001.GetReady(myu._userid); // 自己的进房间通知才准备 } break; case "sc_ready_bf_n": // break; case "sc_tablestart_bf_n": int _waittimeStart = ToolsEx.GetRandomSys(600, 3000); Thread.Sleep(_waittimeStart); sc_tablestart_bfc_n _tablestart = JsonUtils.Deserialize <sc_tablestart_bfc_n>(strMSG); BullColorTable myt = BullColorLobby.instance.GetTableByRoomIDandTableID(myu._roomid, myu._tableID); //根据需求判断 是否抢庄 if (myt != null && !_tablestart.closefun && _tablestart._canGetBanker) { } break; case "sc_gambleone_bfc_n": break; case "sc_setbulltype_bfc_n": //无AI处理 直接等待摊牌 break; case "sc_showone_bfc_n": break; case "sc_showdown_bfc_n": //Thread.Sleep(410); break; case "sc_end_bfc_n": break; case "sc_applyexittable_n": //AI 都同意所有游戏解散 Thread.Sleep(550); sc_applyexittable_n _applyExit = JsonUtils.Deserialize <sc_applyexittable_n>(strMSG); BullColorTable _applyexitTable = BullColorLobby.instance.GetTableByRoomIDandTableID(myu._roomid, myu._tableID); if (_applyexitTable != null) { lock (_applyexitTable) { _applyexitTable.DealExitTable(myu._userid, true); } } break; case "sc_dealexittable_n": break; case "sc_one_exittable_n": break; case "sc_exittable_n": //AI 在有人退出的情况下,全都退出 ////sc_exittable _exittable = JsonUtils.Deserialize<sc_exittable>(strMSG); ////Thread.Sleep(10); ////BullFightUser myu_exit; ////DicIDtoUser.TryGetValue(UserID, out myu_exit); ////if (_exittable.pos != myu_exit._Pos) ////{ //自己的退出消息不再处理 但是只能处理一次 //// ////BullColorTable mytexit = BullColorLobby.GetTableByRoomIDandTableID(myu_exit._roomid, _exittable.tableid); //// ////if (mytexit != null) mytexit.ExitTable(myu_exit._userid); // ////} break; case "sc_chat_n": break; case "sc_disconnect_n": break; case "sc_warning_n": break; case "020": //此桌结束了,正常结束 break; default: ErrorRecord.Record("201206190957BF AI 未处理,strSID:" + _csdata.fn); break; } }
/// <summary> /// 用户申请解散游戏 游戏已开始需要处理结算面板 /// </summary> /// <param name="userID"></param> public void DealExitTable(int userid, bool _isagree) { lock (objLock) { BullColorUser myu = GetUserByID(userid); if (myu == null) { return; } if (!_applyExitTable) { return; //状态都不对 } if (myu._isAgreeExit != 2) { return; //表示已处理了状态不能重复处理 同CheckFirstDeal } myu._isAgreeExit = _isagree ? 1 : 0; //如果同意则重置定时器时间拒绝则关闭定时器 if (_isagree) { ReStartTimer(120000); } else { StopTimer(); } List <UserIDMSG> imList = new List <UserIDMSG>(); ForeashAllDo((i) => { BullColorUser tempUser = _DicPos2User[i]; sc_dealexittable_n _gamble_n = new sc_dealexittable_n() { fn = "sc_dealexittable_n", result = 1, _msgid = _TurnWaitTime }; _gamble_n.pos = myu._Pos; _gamble_n.agree = _isagree ? 1 : 0; imList.Add(new UserIDMSG(tempUser._userid, JsonUtils.Serialize(_gamble_n), tempUser._isRobot, tempUser._isDisconnet)); }); BFColorSendDataServer.instance.SendDataDelay(imList); _tableSendData.Add(imList); bool _allreply = true; ForeashAllDo((i) => { if (_DicPos2User[i]._isWatch) { return; //输了的人没有资格回复 } if (_DicPos2User[i]._isAgreeExit == 2) { _allreply = false; //至少有一个人未回复 } }); if (!_allreply) { return; //等所有人回复 同HaveSomeBodyUnDeal } DoExecuteExitTable(true); } }
/// <summary> /// 如果是强制结束此桌,此桌不会记录与结处 /// </summary> /// <param name="_forceOver"></param> private void DoExecuteAllEnd(bool _forceOver) { lock (objLock) { ForeashAllDo((i) => { int _bfRate = BullFight._dicbullfightRate[_DicPos2User[i]._bulltype]; //出现一次牛牛或五花牛加指定数据的钻石 疯狂牛牛只有五花牛加钻石 if (_bfRate >= 3) { int _addDiamond = (_bfRate / 3) * Math.Max(1, (int)(_judge.BaseAllMoney / 10000)); _DicPos2User[i]._tbUser.diamond += _addDiamond; } //更新数据 tb_UserEx.UpdateData(_DicPos2User[i]._tbUser); }); List <CommonPosValSD> _watchlist = new List <CommonPosValSD>(); //写入此桌的金钱交易记录 if (!_forceOver) { ForeashAllDo((i) => { _pos2CardList.Add(i, _DicPos2User[i]._shouPaiArr);//记录手牌 _pos2Money.Add(i, _DicPos2User[i]._CurrentGold); _pos2Win.Add(i, _judge.CheckGameOverWin(_DicPos2User[i]._CurrentGold)); int _bfRate = BullFight._dicbullfightRate[_DicPos2User[i]._bulltype]; _pos2BullRate.Add(i, _bfRate); //更新数据 tb_UserEx.UpdateData(_DicPos2User[i]._tbUser); }); ForeashAllDo((i) => { //低于一定分数就当观众了 if (_judge.MinLimitMoney((int)_DicPos2User[i]._tbUser.UserMoney)) { _DicPos2User[i]._isWatch = true; } else { _DicPos2User[i]._isWatch = false; //金币模式中上局没开始成功的 } _watchlist.Add(new CommonPosValSD() { pos = i, val = _DicPos2User[i]._isWatch ? 1 : 0 }); _pos2Watch.Add(i, _DicPos2User[i]._isWatch ? 1 : 0); }); } else { _gameover = _forceOver; } CheckResetTable(); // n-1家认输了。 _tablRecord.ActionList = ""; //写入此桌的录相 记录 _tablRecord.EndTime = DateTime.Now; _tablRecord.gameid = _gameid; _tablRecord._isover = true; LogWriteToDB(_tablRecord); _gameover = true; tb_TableMoneyLogEx.SetRateDataByTableNum(_guid, _gameover, _numpertable); List <CommonPosValSD> _pos2Gold1 = _judge.GetCurrentPosGold(); //向X家返回结果 通知 结束 List <UserIDMSG> imList = new List <UserIDMSG>(); ForeashAllDo((i) => { BullColorUser tempUser = _DicPos2User[i]; sc_end_bfc_n _end_n = new sc_end_bfc_n() { fn = "sc_end_bfc_n", result = 1, _msgid = _TurnWaitTime }; // 显示结束面板就行 _end_n.gamemodel = _judge._gameCoin2Room1; _end_n._OverTable = _gameover ? 1 : 0; _end_n.createpos = _masterPos; _end_n._pos2Watch = _watchlist; _end_n._pos2Gold = _pos2Gold1; _end_n._pos2Rate1 = tb_TableMoneyLogEx._pos2Rate1; _end_n._pos2Rate2 = tb_TableMoneyLogEx._pos2Rate2; _end_n._pos2Rate3 = tb_TableMoneyLogEx._pos2Rate3; _end_n._pos2Rate4 = tb_TableMoneyLogEx._pos2Rate4; _end_n.closefun = false;// 能收取奖池的时候 客户端不自动走准备方法,等下一个命令 if (_judge._gameCoin2Room1 == 2 && tempUser._isRobot) { return; //结束不发给机器人 } imList.Add(new UserIDMSG(tempUser._userid, JsonUtils.Serialize(_end_n), tempUser._isRobot, tempUser._isDisconnet)); }); BFColorSendDataServer.instance.SendDataDelay(imList); _tableSendData.Add(imList); ForeashAllDo((i) => { _DicPos2User[i].SetTimeOutAction(1, "sc_end_bfc_n", 5 * 60); }); //下把的自动开始功能 ReStart(); Reset(_gameover); //准备下局, 重置此桌信息 } }
/// <summary> /// 至少两人到位了进行 开局 ,开局就会扣掉配置钱=============================================== /// </summary> private void Start( ) { lock (objLock) { if (_numpertable < _num_min) { return; } base.StartBase(60 * 4); _pos2UserID = new Dictionary <int, int>(); _pos2IPPort = new Dictionary <int, string>(); _pos2Money = new Dictionary <int, decimal>(); _pos2Win = new Dictionary <int, bool>(); _pos2CardList = new Dictionary <int, List <int> >(); _pos2BullRate = new Dictionary <int, int>(); _pos2Watch = new Dictionary <int, int>(); Queue <int> _tcardLeft = new Queue <int>(); Dictionary <int, List <int> > _pokerList = new Dictionary <int, List <int> >(); _pokerList[0] = BullFight.GetPokerbyBullFightType(PokerBullFightType.Bull_Bull); Dictionary <int, int> _pos2RobotAI = new Dictionary <int, int>(); ForeashAllDo((i) => { _pos2RobotAI.Add(i, _DicPos2User[i]._tbUser.winpercent); }); // _judge.ChangePokerByRobotAI(_pos2RobotAI, _pokerList); List <int> _temppoker0 = new List <int>() { 0, 0, 0, 0, 0 }; List <UserIDMSG> imList = new List <UserIDMSG>(); List <CommonPosValSD> _uplist = new List <CommonPosValSD>(); ForeashAllDo((i) => { _uplist.Add(new CommonPosValSD() { pos = i, val = _DicPos2User[i]._userid }); }); _DicPos2User[0]._isBanker = true; //同时把每位玩家的数据确认修改了 //发送消息到所有玩家 ForeashAllDo((i) => { BullColorUser tempUser = _DicPos2User[i]; tempUser._isPlaying = true; tempUser._shouPaiArr = _pokerList[i]; _DicPos2User[i] = tempUser;//必须要赋值回去 要求有3个返馈才处理 _tablRecord.MatchCode = _tableMathCode; _tablRecord._guid = _guid; _tablRecord.StartTime = DateTime.Now; _pos2UserID.Add(i, tempUser._userid); _pos2IPPort.Add(i, tempUser._IPandPort); //发送通知消息 sc_tablestart_bfc_n _start = new sc_tablestart_bfc_n() { result = 1, fn = "sc_tablestart_bfc_n", _msgid = _TurnWaitTime }; _start.tableid = _tableid; _start.pos = i; _start._canGetBanker = false; _start._pos2userid = _uplist;//所有玩家及对应 的位置信息 _start._curTableCount = _judge._curTableOverCount; _start._curBankerCount = 1; _start.ShowCardList = _temppoker0; _start.closefun = false;//需要报价抢庄,不关闭自动显示功能 imList.Add(new UserIDMSG(tempUser._userid, JsonUtils.Serialize(_start), tempUser._isRobot, tempUser._isDisconnet)); }); BFColorSendDataServer.instance.SendDataDelay(imList); _tableSendData.Add(imList); _DicPos2User[_bankpos].SetTimeOutAction(1, "sc_gambleover_bfc_n", 4 * 60);//1分钟等待时间 _strStatus = "Start...3 "; } }