public static void SendTurn(Table t, Card turn) { Poker.Shared.Message message = new Shared.Message("", MessageType.TableSendTurn); message.Content = t.TableNo + ":"; message.Content += turn.Rank + ":" + turn.Suit; SendToTablePlayers(t, message); }
public static void SendRiver(Table t, Card river) { Poker.Shared.Message message = new Shared.Message("", MessageType.TableSendRiver); message.Content = t.TableNo + ":"; message.Content += river.Rank + ":" + river.Suit; SendToTablePlayers(t, message); }
public static void SendCasinoMessage(PokerUser user) { Poker.Shared.Message m = new Shared.Message("CasinoUpdate", MessageType.CasinoUpdate); m.Content = ClientView.CasinoView.Serialize(); if ((user != null) && (user.TcpClient != null) && (user.TcpClient.Connected)) { user.SendMessage(m); } }
public static void SendFlop(Table t, Tuple <Card, Card, Card> flop) { Poker.Shared.Message message = new Shared.Message("", MessageType.TableSendFlop); message.Content = t.TableNo + ":"; message.Content += flop.Item1.Rank + ":" + flop.Item1.Suit + ":"; message.Content += flop.Item2.Rank + ":" + flop.Item2.Suit + ":"; message.Content += flop.Item3.Rank + ":" + flop.Item3.Suit; SendToTablePlayers(t, message); }
public static void SendServerReadyMessage(PokerUser user) { Poker.Shared.Message m = new Shared.Message("ServerReady", MessageType.ServerReady); m.Content = "ServerReady"; if ((user != null) && (user.TcpClient != null) && (user.TcpClient.Connected)) { user.SendMessage(m); } }
public static void SendCasinoMessage() { Poker.Shared.Message m = new Shared.Message("CasinoUpdate", MessageType.CasinoUpdate); m.Content = ClientView.CasinoView.Serialize(); foreach (PokerUser puser in PokerUserFactory.GetListPokerUsers()) { puser.SendMessage(m); } }
public static void SendWinningHand(Table t, HandRankings hr) { Poker.Shared.Message message = new Shared.Message("", MessageType.AnnounceWinner); message.Content = t.TableNo + ":" + hr.UserName + ":"; for (int i = 0; i < 5; i++) { message.Content += hr.Cards[i].Rank + ":" + hr.Cards[i].Suit; } SendToTablePlayers(t, message); }
public static void SendPlayerBankBalanceMessage(PokerUser user) { Poker.Shared.Message m = new Shared.Message("PlayerBankBalance", MessageType.PlayerBankBalance); Tuple <decimal, decimal> temp = PlayerBankingService.Instance().GetBankBalance(user.UserName); string temp1 = temp.Item1.ToString() + ";" + temp.Item2.ToString(); m.Content = temp1; if ((user != null) && (user.TcpClient != null) && (user.TcpClient.Connected)) { user.SendMessage(m); } }
public void OnReceivePlayerAction(Shared.Message m) { //if (MySeatNo > 0) string[] arr = m.Content.Split(':'); string tableno = arr[0]; short seatno = Convert.ToInt16(arr[1]); string action = arr[2]; string potsize = arr[3]; // Need to change this to assign to the view model of the seat rather than the view of the seat. this.simulatePlayerAction = seatno; Dict_View_Seats[seatno].SimulatePlayerAction(action); this.Invoke((MethodInvoker) delegate { this.lPotValue.Text = "Pot = " + potsize.ToString(); }); Console.WriteLine("OnReceivePlayerAction " + m.Content); }
public void Add(Shared.Message message) { Messages.Add(message); }
public void OnReceiveRequestBet(Shared.Message m) { if (MySeatNo > 0) { // Need to change this to assign to the view model of the seat rather than the view of the seat. //Dict_View_Seats[MySeatNo].SimulateRequestBet(m.Content); vm_bc = new ViewModel_BetCollection(); vm_bc.AvailableMoney = _vm_table.get_VM_Seat(MySeatNo).ChipCounts; string[] arr = m.Content.Split(':'); string tableno = arr[0]; decimal potsize = Convert.ToDecimal(arr[1]); decimal postedbet = Convert.ToDecimal(arr[2]); decimal currentbet = Convert.ToDecimal(arr[3]); decimal maxraisebet = Convert.ToDecimal(arr[4]); decimal minbet = this._vm_table.getBigBlindAmount(); string gameStage = arr[5]; vm_bc.PostedBet = postedbet; vm_bc.CurrentBet = currentbet; vm_bc.PotValue = potsize; vm_bc.MinBetAllowed = Math.Max(minbet, currentbet - postedbet); vm_bc.UserName = this.UserName; decimal betmade = 0; ManualResetEvent evt1 = new ManualResetEvent(false); Task taskA = Task.Factory.StartNew(() => { this.Invoke((MethodInvoker) delegate { this.lPotValue.Text = "Pot = " + potsize.ToString(); //using (Dialogs.BetCollectorControl x1 = new Dialogs.BetCollectorControl(vm_bc)) //{ // x1.StartPosition = FormStartPosition.Manual; // x1.ShowInTaskbar = false; // x1.Location = this.PointToScreen(Point.Empty); // x1.MaximizeBox = false; // x1.MinimizeBox = false; // DialogResult result = x1.ShowDialog(this); // if (result == DialogResult.Cancel) // betmade = -1; // else // betmade = x1.getModel().BetChoosen; //} betctrl.Visible = true; betctrl.start(vm_bc, evt1); betctrl.BringToFront(); //this.Controls.Remove(betctrl); }); evt1.WaitOne(); //betmade = vm_bc.BetChoosen; betmade = betctrl.getModel().BetChoosen; this.Invoke((MethodInvoker) delegate { betctrl.Visible = false; }); this.ReceiveBetEvent.Invoke(this._vm_table.TableNo, betmade, gameStage); Console.WriteLine("OnReceiveRequestBet " + m.Content); }); //taskA.Wait(); } //Console.WriteLine("OnReceiveRequestBet " + m.Content); }