public User DealerQueue() { if (Dealer == null) { Dealer = PlayUsers.First(); return(PlayUsers.First()); } else { if (PlayUsers.IndexOf(Dealer) == 0) { Dealer = PlayUsers[PlayUsers.Count - 1]; return(PlayUsers[PlayUsers.Count - 1]); } else { int index = PlayUsers.IndexOf(Dealer) - 1; Dealer = PlayUsers[index]; return(PlayUsers[index]); } } }
public void Blinds() { if (PlayUsers.Count == 2) { if (PlayUsers[0] == Dealer) { Dealer.CoinsTable -= 50; Rates.Add(new Rate { EmailUser = Dealer.Email, Coins = 50 }); Dealer.Stake = 50; PlayUsers[1].CoinsTable -= 100; Rates.Add(new Rate { EmailUser = PlayUsers[1].Email, Coins = 100 }); PlayUsers[1].Stake = 100; } else { Dealer.CoinsTable -= 50; Rates.Add(new Rate { EmailUser = Dealer.Email, Coins = 50 }); Dealer.Stake = 50; PlayUsers[0].CoinsTable -= 100; Rates.Add(new Rate { EmailUser = PlayUsers[0].Email, Coins = 100 }); PlayUsers[0].Stake = 100; } } else { int indexDealer = PlayUsers.IndexOf(Dealer); User user1; User user2; if (indexDealer + 1 == PlayUsers.Count) { user1 = PlayUsers[0]; user2 = PlayUsers[1]; } else if (indexDealer + 1 == PlayUsers.Count - 1) { user1 = PlayUsers.Last(); user2 = PlayUsers.First(); } else { user1 = PlayUsers[indexDealer + 1]; user2 = PlayUsers[indexDealer + 2]; } user1.CoinsTable -= 50; Rates.Add(new Rate { EmailUser = user1.Email, Coins = 50 }); user2.CoinsTable -= 100; Rates.Add(new Rate { EmailUser = user2.Email, Coins = 100 }); } foreach (var stake in Rates) { Bank.AddCoins(stake.Coins); } }