public int GetHolderId(RoomActor roomData) { //确定庄家位置 var grabSeats = roomData.GetGrabSeatDatas(); var seats = roomData.GetInGameSeatDatas(); int holderId = 0; int random = 0; if (grabSeats.Count == 0) { if (seats.Count == 0) { return(10000); } random = RandomUtils.GetRandom(0, seats.Count); holderId = seats[random].UserId; } else { random = RandomUtils.GetRandom(0, grabSeats.Count); holderId = grabSeats[random].UserId; } return(holderId); }
public int GetHolderId(RoomActor roomData) { //确定庄家位置 var grabSeats = roomData.GetGrabSeatDatas(); var seats = roomData.GetInGameSeatDatas(); int holderId = 0; int random = 0; if (grabSeats.Count == 0) { if (seats.Count == 0) { return(10000); } random = RandomUtils.GetRandom(0, seats.Count); holderId = seats[random].UserId; } else { var maxGrab = grabSeats.Select(m => m.Grab).Max(); var grabSeat = grabSeats.Where(m => m.Grab == maxGrab); if (grabSeat.Count() == 1) { holderId = grabSeat.First().UserId; } else { random = RandomUtils.GetRandom(0, grabSeat.Count()); holderId = grabSeat.ElementAt(random).UserId; } } return(holderId); }