/// <summary> /// 进入房间 返回现在等待用户数 /// </summary> /// <returns></returns> private string TableReady(tb_User _user, cs_ready_tc _data) { sc_ready_tc _senddata = new sc_ready_tc() { result = 0, fn = "sc_ready_tc", cc = 0 }; TCTable table = TCLobby.instance.GetTableByRoomIDandTableID(_data.levelid, _data.tableid); if (table == null) { return(JsonUtils.Serialize(_senddata)); } table.GetReady(_user.UserID); _senddata.result = 1; return(JsonUtils.Serialize(_senddata)); }
/// <summary> /// 摹仿客户端 消息处理 不加锁 /// </summary> /// <param name="UserID"></param> /// <param name="strMSG"></param> private static void RobotDealMSG(int UserID, string strMSG) { if (!DicIDtoUser.ContainsKey(UserID)) { //同在BUG容易出现机器先清空了,没有收到结算的方法 需要延时处理 -------------================================== 什么器结算退出后需要休息一定的时间 // ErrorRecord.Record(" 201206062215TC "); return; } sc_base _csdata = JsonUtils.Deserialize <sc_base>(strMSG); if (_csdata == null) { ErrorRecord.Record(" 201206062216TC "); return; } if (_csdata.fn == "") { ErrorRecord.Record(" 201206071117TC 没找到 _csdata.fn"); return; } switch (_csdata.fn) { case "sc_entertable_n": //自动 准备 sc_entertable_n _entertable = JsonUtils.Deserialize <sc_entertable_n>(strMSG); Thread.Sleep(100); TCUser myuentertable; DicIDtoUser.TryGetValue(UserID, out myuentertable); TCTable myt001 = TCLobby.instance.GetTableByRoomIDandTableID(myuentertable._roomid, myuentertable._tableID); if (myt001 != null) { myt001.GetReady(myuentertable._userid); // } break; case "sc_ready_tc_n": break; case "sc_entertable_tc_n": //默认就是准备状态不处理的其他 break; case "sc_tablestart_tc_n": break; case "sc_token_tc_n": //判断是不是自己的token AI只弃牌,如果有两个以前的机器人一直下注会卡,,, sc_token_tc_n _tabletoken = JsonUtils.Deserialize <sc_token_tc_n>(strMSG); Thread.Sleep(100); TCUser _myUserGiveUp; DicIDtoUser.TryGetValue(UserID, out _myUserGiveUp); if (_myUserGiveUp._Pos == _tabletoken.pos) { TCTable _myt_token = TCLobby.instance.GetTableByRoomIDandTableID(_myUserGiveUp._roomid, _myUserGiveUp._tableID); //if (_myt_token != null) _myt_token.GiveUp(_myUserGiveUp._userid); //弃牌 if (_myt_token != null) { _myt_token.Gamble(_myUserGiveUp._userid, 0); } } break; case "sc_showcard_tc_n": break; case "sc_gamble_tc_n": break; case "sc_compare_tc_n": break; case "sc_giveup_tc_n": break; case "sc_end_tc_n": break; case "sc_exittable_n": ////sc_exittable_n _exittable = JsonUtils.Deserialize<sc_exittable_n>(strMSG); ////Thread.Sleep(10); ////TCUser myu_exit; ////DicIDtoUser.TryGetValue(UserID, out myu_exit); ////if (_exittable. != myu_exit._Pos) ////{ //自己的退出消息不再处理 //// TCTable mytexit = TCLobby.GetTableByRoomIDandTableID(myu_exit._roomid, _exittable.tableid); //// if (mytexit != null) mytexit.ExitTable(myu_exit._userid); // ////} break; case "020": //此桌结束了,正常结束 break; default: ErrorRecord.Record("201206190957 strSID:" + _csdata.fn); break; } }