/// <summary> /// 检查逃跑,并结束当局游戏,扣分两家平分 /// </summary> /// <param name="user"></param> /// <param name="table"></param> /// <param name="userPos"></param> private void CheckFlee(GameUser user, TableData table, PositionData userPos) { table.IsClosed = true; if (table.IsStarting) { int multipleMinNum = ConfigEnvSet.GetInt("Game.FleeMultipleNum", 10); PositionData pos = null; List <PositionData> posList = new List <PositionData>(); //计算炸弹数量 foreach (PositionData position in table.Positions) { if (position.UserId == user.UserId) { pos = position; } else { posList.Add(position); } var obj = _cardRole.ParseCardGroup(position.CardData.ToArray()); for (int i = 0; i < obj.Count; i++) { var item = obj.GetSame(i); if (item.Length == 4 || (item.Length == 2 && _cardRole.GetCardSize(item[0]) > (int)CardSize.C_2)) { table.DoDouble(); } } } table.IsFlee = true; if (table.MultipleNum < multipleMinNum) { table.SetDouble(multipleMinNum); } DoSettlement(table, false, pos, posList); var param = new Parameters(); param.Add("FleeUserId", user.UserId); var userList = ClientNotifier.GetUserList(table, user.UserId); SyncNotifyAction(ActionIDDefine.Cst_Action2013, userList, param, c => { DoComplatedSettlement(table); // TraceLog.WriteComplement("桌子:{0}玩家{1}逃跑通知", table.TableId, user.UserId); }); NotifyUserChange(user.UserId); } else { //还没有开始时,可以离开位置等待新玩家 user.Property.InitTablePos(); userPos.Init(); table.IsClosed = false; int periodAiStart = ConfigEnvSet.GetInt("Game.Table.AIIntoTime", 5000); table.ReStartTimer(periodAiStart); var userList = ClientNotifier.GetUserList(table, user.UserId); SyncNotifyAction(ActionIDDefine.Cst_Action2003, userList, null, null); } }
/// <summary> /// 桌子占位 /// </summary> /// <param name="table"></param> /// <param name="pos"></param> /// <param name="user"></param> /// <param name="roomId"></param> private static void SetTablePosition(int roomId, TableData table, PositionData pos, GameUser user) { pos.Init(user); user.Property.InitTablePos(roomId, table.TableId, pos.Id); }