public static void Compare(SeatInfo s, SeatInfo ds) { Assert.IsFalse(s.SeatAttributes.Except(ds.SeatAttributes).Any()); Assert.AreEqual(s.SeatAttributes.Length, ds.SeatAttributes.Length); Assert.AreEqual(s.NoSeat, ds.NoSeat); ComparePlayerInfo.Compare(s.Player, ds.Player); }
private bool SitOut(PlayerInfo p) { var oldSeat = p.NoSeat; if (oldSeat == -1) return true; p.State = PlayerStateEnum.Zombie; if (Table.SeatsContainsPlayer(p) && Table.SitOut(p)) { var seat = new SeatInfo() { Player = null, NoSeat = oldSeat, }; Observer.RaiseSeatUpdated(seat); return true; } return false; }
public void RaiseSeatUpdated(SeatInfo s) { SeatUpdated(m_Game, new SeatEventArgs(s)); }
public void SetSeat(SeatInfo seat) { m_Seats[seat.NoSeat] = seat; }
private void InstallPlayer(PlayerHud php, SeatInfo seat) { if (seat.IsEmpty) php.Visible = false; else { var player = seat.Player; php.PlayerName = player.Name; php.DoAction(GameActionEnum.DoNothing); var cards = player.HoleCards.ToArray(); php.SetMoney(player.MoneySafeAmnt); php.SetSleeping(); php.Main = (m_NoSeat == player.NoSeat); php.Alive = player.State == PlayerStateEnum.Playing; if (php.Alive) php.SetCards(new GameCard(cards[0]), new GameCard(cards[1])); php.Visible = true; php.SetDealerButtonVisible(seat.Attributes.Contains(SeatAttributeEnum.Dealer)); } }
public SeatEventArgs(SeatInfo s) { m_Seat = s; }
private void PepareCardsForSending(SeatInfo si) { if (si.Player.FaceDownCards == null) si.Player.FaceDownCards = new string[0]; if (si.Player.FaceUpCards == null) si.Player.FaceUpCards = new string[0]; //If we are not sending the info about the player who is receiving, don't show the cards if (si.NoSeat != Player.NoSeat) si.Player.FaceDownCards = si.Player.FaceDownCards.Select(x => "??").ToArray(); }
public IEnumerable<SeatInfo> AllSeats() { for (var i = 0; i < Game.Table.Params.MaxPlayers; ++i) { var si = new SeatInfo() { NoSeat = i }; var gameSeat = Game.Table.Seats[i]; if (!gameSeat.IsEmpty) { si.Player = gameSeat.Player.Clone(); PepareCardsForSending(si); si.SeatAttributes = gameSeat.SeatAttributes; } yield return si; } }
public bool SitOut(PlayerInfo p) { var oldSeat = p.NoSeat; if (oldSeat == -1) return true; var blindNeeded = Table.GetBlindNeeded(p); p.State = PlayerStateEnum.Zombie; if (State == GameStateEnum.Playing && Table.CurrentPlayer == p) PlayMoney(p, -1); else if (blindNeeded > 0) PlayMoney(p, blindNeeded); if (Table.SeatsContainsPlayer(p) && Table.SitOut(p)) { var seat = new SeatInfo() { Player = null, NoSeat = oldSeat, }; Observer.RaiseSeatUpdated(seat); m_CurrentModule?.OnSitOut(); return true; } return false; }
public void ChangeCurrentPlayerTo(SeatInfo seat) { var oldPlayerSeat = CurrentPlayerSeat; if (oldPlayerSeat != null) oldPlayerSeat.SeatAttributes = oldPlayerSeat.SeatAttributes.Except(new[] { SeatAttributeEnum.CurrentPlayer }).ToArray(); if (seat != null) seat.SeatAttributes = seat.SeatAttributes.Union(new[] { SeatAttributeEnum.CurrentPlayer }).ToArray(); }
public SeatInfo GetSeatOfPlayingPlayerJustBefore(SeatInfo seat) { var noSeat = seat?.NoSeat ?? -1; for (var i = 0; i < Params.MaxPlayers; ++i) { var id = (noSeat - 1 - i) % Params.MaxPlayers; if (id < 0) id = Params.MaxPlayers + id; var si = m_Seats[id]; if (!si.IsEmpty && si.Player.IsPlaying) return si; } return seat; }
/// <summary> /// Return the next playing player next to a seat number (All-In not included) /// </summary> public SeatInfo GetSeatOfPlayingPlayerNextTo(SeatInfo seat) { var noSeat = seat?.NoSeat ?? -1; for (var i = 0; i < Params.MaxPlayers; ++i) { var si = m_Seats[(noSeat + 1 + i) % Params.MaxPlayers]; if (!si.IsEmpty && si.Player.IsPlaying) return si; } return seat; }