/// <summary> /// 处理消息 /// </summary> /// <param name="clientcommand"></param> /// <returns></returns> public string DealDataEx(string _data, string _ipport, tb_User _user) { string senddata = ""; try { _strIPandPort = _ipport; cs_base _basedata = JsonUtils.Deserialize <cs_base>(_data); switch (_basedata.fn) { case "11": //重新登录=============================== //// ipmsgList = ReLogin(Convert.ToString(arro[1]), Convert.ToString(arro[2])); break; case "cs_ready_tc": cs_ready_tc _ready = JsonUtils.Deserialize <cs_ready_tc>(_data); senddata = TableReady(_user, _ready); break; case "cs_gamble_tc": cs_gamble_tc _gamble = JsonUtils.Deserialize <cs_gamble_tc>(_data); senddata = Gamble(_user, _gamble); break; case "cs_showcard_tc": // cs_showcard_tc _showcard = JsonUtils.Deserialize <cs_showcard_tc>(_data); senddata = ShowCard(_user, _showcard); break; case "cs_giveup_tc": // cs_giveup_tc _giveupobj = JsonUtils.Deserialize <cs_giveup_tc>(_data); senddata = GiveUp(_user, _giveupobj); break; case "cs_compare_tc": // cs_compare_tc _compare = JsonUtils.Deserialize <cs_compare_tc>(_data); senddata = Compare(_user, _compare); break; default: //默认不处理的 发送一个 d- 表示哈 ErrorRecord.Record(_basedata.fn + " undeal 201206091508TC "); break; } return(senddata); } catch (Exception ex) { ErrorRecord.Record(ex, " 201206091508BF "); return(""); } }
/// <summary> /// 弃牌 /// </summary> /// <returns></returns> public string GiveUp(tb_User _user, cs_giveup_tc _data) { sc_giveup_tc _senddata = new sc_giveup_tc() { result = 0, fn = "sc_giveup_tc", cc = 0 }; TCTable table = TCLobby.instance.GetTableByRoomIDandTableID(_data.levelid, _data.tableid); if (table == null) { return(JsonUtils.Serialize(_senddata)); } table.GiveUp(_user.UserID); _senddata.result = 1; return(JsonUtils.Serialize(_senddata)); }