public void LoadHand(PokerHand pokerHand) { ToDo.Clear(); UnDo.Clear(); Pots.Clear(); PotsStreetByStreet.Clear(); Seats = pokerHand.Seats; Players = Seats.Where(o => o != null).ToArray(); TableSize = pokerHand.TableSize; ButtonSeatNumber = pokerHand.ButtonSeat; foreach (var player in Players) player.Table = this; ToDo.AddRange(pokerHand.PokerCommands); }
public TableHud(Table table) { #region Init Windows Methods.UiInvoke(() => { Table = table; WindowTimer = new WindowTimer(Table); WindowTimer.Opacity = 0; WindowTimer.Show(); for (int i = 0; i < 10; i++) { WindowsBigBlind[i] = new WindowBigBlind(Table, i); WindowsBigBlind[i].Opacity = 0; WindowsBigBlind[i].Show(); } }); #endregion _thread = new Thread(() => { try { while (true) { #region Calculate Timer / BigBlinds string title = Table.Title, className = Table.ClassName; long tournamentNumber; decimal sb, bb, ante; string timerValue = null; bool timerVisibility = false; decimal[] bbValue = new decimal[10]; bool[] bbVisibility = new bool[10]; bool[] bbIsHero = new bool[10]; string[] bbTooltip = new string[10]; var success = GetInfo(title, out sb, out bb, out ante, out tournamentNumber); if (success) { var tournament = App.HandHistoryManager.GetTournament(tournamentNumber); if (tournament != null) { TableSize = tournament.GetLastHandTableSize(); GetContentTimer(title, className, tournament, sb, bb, out timerValue, out timerVisibility); GetContentBigBlind(tournament, sb, bb, ante, out bbValue, out bbVisibility, out bbIsHero, out bbTooltip); } } #endregion #region Update Timer / BigBlinds Methods.UiInvoke(() => { try // to eliminate that stupid UpdateView null reference problem.. { // Update View WindowTimer.UpdateView(timerValue, PokerType != null ? PokerType.Name : "Unknown"); for (int i = 0; i < 10; i++) { WindowsBigBlind[i].UpdateView(i, bbValue[i], bbTooltip[i], bbIsHero[i]); } // Ensure visibility WindowTimer.EnsureVisibility(timerVisibility); for (int i = 0; i < 10; i++) { WindowsBigBlind[i].EnsureVisibility(bbVisibility[i] && ((!bbIsHero[i] && Config.HudBigBlindShowForOpponents) || (bbIsHero[i] && Config.HudBigBlindShowForHero))); } } catch { } }); #endregion Thread.Sleep(500); } } #if (DEBUG) catch (ThreadInterruptedException) { } #else catch (Exception e) { if (!(e is ThreadInterruptedException)) { Methods.DisplayException(e, App.WindowMain, WindowStartupLocation.CenterOwner); } } #endif finally { #region Dispose Windows Methods.UiInvoke(() => { WindowTimer.Close(); for (int i = 0; i < 10; i++) { WindowsBigBlind[i].Close(); } }); #endregion } }); _thread.Start(); }
public TableHud(Table table) { #region Init Windows Methods.UiInvoke(() => { Table = table; WindowTimer = new WindowTimer(Table); WindowTimer.Opacity = 0; WindowTimer.Show(); for (int i = 0; i < 10; i++) { WindowsBigBlind[i] = new WindowBigBlind(Table, i); WindowsBigBlind[i].Opacity = 0; WindowsBigBlind[i].Show(); } }); #endregion _thread = new Thread(() => { try { while (true) { #region Calculate Timer / BigBlinds string title = Table.Title, className = Table.ClassName; long tournamentNumber; decimal sb, bb, ante; string timerValue = null; bool timerVisibility = false; decimal[] bbValue = new decimal[10]; bool[] bbVisibility = new bool[10]; bool[] bbIsHero = new bool[10]; string[] bbTooltip = new string[10]; var success = GetInfo(title, out sb, out bb, out ante, out tournamentNumber); if (success) { var tournament = App.HandHistoryManager.GetTournament(tournamentNumber); if (tournament != null) { TableSize = tournament.GetLastHandTableSize(); GetContentTimer(title, className, tournament, sb, bb, out timerValue, out timerVisibility); GetContentBigBlind(tournament, sb, bb, ante, out bbValue, out bbVisibility, out bbIsHero, out bbTooltip); } } #endregion #region Update Timer / BigBlinds Methods.UiInvoke(() => { try // to eliminate that stupid UpdateView null reference problem.. { // Update View WindowTimer.UpdateView(timerValue, PokerType != null ? PokerType.Name : "Unknown"); for (int i = 0; i < 10; i++) { WindowsBigBlind[i].UpdateView(i, bbValue[i], bbTooltip[i], bbIsHero[i]); } // Ensure visibility WindowTimer.EnsureVisibility(timerVisibility); for (int i = 0; i < 10; i++) { WindowsBigBlind[i].EnsureVisibility(bbVisibility[i] && ((!bbIsHero[i] && Config.HudBigBlindShowForOpponents) || (bbIsHero[i] && Config.HudBigBlindShowForHero))); } } catch { } }); #endregion Thread.Sleep(500); } } #if (DEBUG) catch (ThreadInterruptedException) { } #else catch (Exception e) { if (!(e is ThreadInterruptedException)) { Methods.DisplayException(e, App.WindowMain, WindowStartupLocation.CenterOwner); } } #endif finally { #region Dispose Windows Methods.UiInvoke(() => { WindowTimer.Close(); for (int i = 0; i < 10; i++) { WindowsBigBlind[i].Close(); } }); #endregion } }); _thread.Start(); }
private int MapToPreferredSeat(PokerEnums.TableSize tableSize, int heroSeat, int seat) { var neededOffset = Config.PreferredSeat[(int)tableSize] + (int)tableSize - heroSeat; return((seat + neededOffset) % (int)tableSize); }