Ejemplo n.º 1
0
        //BindingSource _bindingSource = new BindingSource();
        public View_Seat(ViewModel_Seat seat)
        {
            this._vm_seat        = seat;
            this.labelChipsCount = new Label();
            this.btnDealer       = new Button();


            this.DoubleBuffered = true;


            InitializeComponent();
        }
Ejemplo n.º 2
0
 public void OnReceiveHoleCards(Tuple <A_Card, A_Card> holecards)
 {
     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].Assign_HoleCards(holecards);
         ViewModel_Seat vm_seat = _vm_table.get_VM_Seat(MySeatNo);
         vm_seat.HoleCard_1 = View_Deck.Instance.GetCard(holecards.Item1);
         vm_seat.HoleCard_2 = View_Deck.Instance.GetCard(holecards.Item2);
         Dict_View_Seats[MySeatNo].repaint();
         this.Invoke((MethodInvoker) delegate
         {
             Dict_View_Seats[MySeatNo].Invalidate();
             Dict_View_Seats[MySeatNo].Update();
             this.Invalidate(true);
             this.Update();
         });
         Console.WriteLine("OnReceiveHoleCards for  " + this.UserName + holecards.ToString());
     }
     Console.WriteLine("OnReceiveHoleCards " + holecards.ToString());
 }
Ejemplo n.º 3
0
 public void OnReceiveGameStart(short dealerposition)
 {
     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].Assign_HoleCards(null);
         ViewModel_Seat vm_seat = _vm_table.get_VM_Seat(MySeatNo);
         if (vm_seat.HoleCard_1 != null)
         {
             vm_seat.HoleCard_1.Dispose();
         }
         if (vm_seat.HoleCard_2 != null)
         {
             vm_seat.HoleCard_2.Dispose();
         }
         vm_seat.HoleCard_1 = View_Deck.Instance.GetBackCard();
         vm_seat.HoleCard_2 = View_Deck.Instance.GetBackCard();
         Dict_View_Seats[MySeatNo].repaint();
     }
     Console.WriteLine("OnReceiveGameStart ");
 }
Ejemplo n.º 4
0
        //private void resizehere(object sender, EventArgs e)
        //{
        //    Control ctrl = (Control)sender;
        //    int xChange = 1, yChange = 1;

        //}
        private void RenderControls()
        {
            CreateLayoutPanels();
            int x, y;

            int y1 = this.Height;
            int x1 = this.Width;

            int seatwidth  = x1 / 13;
            int seatheight = y1 / 6;

            x = seatwidth;
            y = seatheight;


            if (_vm_table != null)
            {
                int delta_width = seatwidth / 4;
                int delta_shift = seatwidth / 2;

                this.VCard_flop1      = new View_Card(_vm_table.Flop1);
                this.VCard_flop1.Size = new Size(this.Width / 13, this.Height / 6);
                this.tableLayoutPanel2.Controls.Add(VCard_flop1, 0, 0);


                this.VCard_flop2      = new View_Card(_vm_table.Flop2);
                this.VCard_flop2.Size = new Size(this.Width / 13, this.Height / 6);
                this.tableLayoutPanel2.Controls.Add(VCard_flop2, 1, 0);

                this.VCard_flop3      = new View_Card(_vm_table.Flop3);
                this.VCard_flop3.Size = new Size(this.Width / 13, this.Height / 6);
                this.tableLayoutPanel2.Controls.Add(VCard_flop3, 2, 0);

                this.VCard_turn      = new View_Card(_vm_table.Turn);
                this.VCard_turn.Size = new Size(this.Width / 13, this.Height / 6);
                this.tableLayoutPanel2.Controls.Add(VCard_turn, 3, 0);

                this.VCard_river      = new View_Card(_vm_table.River);
                this.VCard_river.Size = new Size(this.Width / 13, this.Height / 6);
                this.tableLayoutPanel2.Controls.Add(VCard_river, 4, 0);

                int yy = y1 / 2 - seatheight / 2 + seatheight + seatheight / 6;
                lflop1           = new Label();
                lflop1.Text      = "flop";
                lflop1.Width     = seatwidth;
                lflop1.TextAlign = ContentAlignment.MiddleCenter;
                this.tableLayoutPanel2.Controls.Add(lflop1, 0, 1);

                lflop2           = new Label();
                lflop2.Text      = "flop";
                lflop2.Width     = seatwidth;
                lflop2.TextAlign = ContentAlignment.MiddleCenter;
                this.tableLayoutPanel2.Controls.Add(lflop2, 1, 1);

                lflop3           = new Label();
                lflop3.Text      = "flop";
                lflop3.Width     = seatwidth;
                lflop3.TextAlign = ContentAlignment.MiddleCenter;
                this.tableLayoutPanel2.Controls.Add(lflop3, 2, 1);

                lturn           = new Label();
                lturn.Text      = "turn";
                lturn.Width     = seatwidth;
                lturn.TextAlign = ContentAlignment.MiddleCenter;
                this.tableLayoutPanel2.Controls.Add(lturn, 3, 1);

                lriver           = new Label();
                lriver.Text      = "river";
                lriver.Width     = seatwidth;
                lriver.TextAlign = ContentAlignment.MiddleCenter;
                this.tableLayoutPanel2.Controls.Add(lriver, 4, 1);

                lPotValue           = new Label();
                lPotValue.TextAlign = ContentAlignment.MiddleCenter;
                lPotValue.Font      = new Font("Arial", 8, FontStyle.Bold);
                lPotValue.Text      = "Pot Size = 0";
                //lPotValue.Location = new Point(seatloc_3_x, y1 / 2 - seatheight / 2 - 24);
                this.Controls.Add(lPotValue);

                lAnnounceWinner           = new Label();
                lAnnounceWinner.TextAlign = ContentAlignment.MiddleCenter;
                lAnnounceWinner.Font      = new Font("Arial", 16, FontStyle.Bold);
                lAnnounceWinner.Text      = "The winner is ";
                lAnnounceWinner.Location  = new Point(this.Width / 3, this.Height / 2);
                lAnnounceWinner.Visible   = false;
                this.Controls.Add(lAnnounceWinner);

                Label l1, l2, l3;
                l1 = new Label();
                l2 = new Label();
                l3 = new Label();

                l1.Text = _vm_table.GameName;
                l2.Text = _vm_table.GameValue;

                l1.Width     = this.Width;
                l1.TextAlign = ContentAlignment.MiddleCenter;
                l1.Font      = new Font("Arial", 24, FontStyle.Bold);
                l1.Location  = new Point(0, 0);
                l1.Size      = new Size(this.Width, seatheight);

                l3.Text      = _vm_table.TableNo;
                l3.Width     = this.Width;
                l3.TextAlign = ContentAlignment.MiddleCenter;
                l3.Font      = new Font("Arial", 24, FontStyle.Bold);
                l3.Location  = new Point(0, y1 - seatheight);
                l3.Size      = new Size(this.Width, seatheight);

                this.Controls.Add(l1);
                // this.Controls.Add(l2);
                this.Controls.Add(l3);
            }
            Button btnDealer = new Button();

            btnDealer.BackColor = Color.Blue;

            short     seatno = 2;
            View_Seat seat1  = null;

            ViewModel_Seat vm_seat = _vm_table.get_VM_Seat(seatno);
            int            count   = 10;

            while (count > 6)
            {
                x       = x + seatwidth * 2;
                vm_seat = _vm_table.get_VM_Seat(seatno);
                seat1   = new View_Seat(vm_seat);
                Dict_View_Seats[seatno] = seat1;
                seat1.JoinedTableEvent += Seat_JoinedTableEvent;
                seat1.ReceiveBetEvent  += Seat_ReceiveBetEvent;
                seat1.Size = new Size(seatwidth, seatheight);
                this.tableLayoutPanel1.Controls.Add(seat1, seatno - 1, 1);
                if (vm_seat.IsDealer)
                {
                    btnDealer.Visible = true;
                    this.tableLayoutPanel1.Controls.Add(btnDealer, seatno - 1, 2);
                }
                count--;
                seatno++;
            }
            x      = seatwidth;
            y      = y1 - seatheight * 2;
            seatno = 10;
            int col = 1;

            while (count > 2)
            {
                x       = x + seatwidth * 2;
                vm_seat = _vm_table.get_VM_Seat(seatno);
                seat1   = new View_Seat(vm_seat);
                Dict_View_Seats[seatno] = seat1;
                seat1.JoinedTableEvent += Seat_JoinedTableEvent;
                seat1.ReceiveBetEvent  += Seat_ReceiveBetEvent;
                seat1.Size = new Size(seatwidth, seatheight);
                this.tableLayoutPanel1.Controls.Add(seat1, col++, 3);
                if (vm_seat.IsDealer)
                {
                    btnDealer.Visible = true;
                    this.tableLayoutPanel1.Controls.Add(btnDealer, col - 1, 4);
                }
                count--;
                seatno--;
            }
            x      = 0;
            y      = y1 / 2 - seatheight / 2;
            seatno = 1;
            this.SuspendLayout();
            while (count > 1)
            {
                x       = x + x1 / 12;
                vm_seat = _vm_table.get_VM_Seat(seatno);
                seat1   = new View_Seat(vm_seat);
                Dict_View_Seats[seatno] = seat1;
                seat1.JoinedTableEvent += Seat_JoinedTableEvent;
                seat1.ReceiveBetEvent  += Seat_ReceiveBetEvent;
                seat1.Size = new Size(seatwidth, seatheight);
                this.tableLayoutPanel1.Controls.Add(seat1, 0, 2);
                if (vm_seat.IsDealer)
                {
                    btnDealer.Visible = true;
                    this.tableLayoutPanel1.Controls.Add(btnDealer, 0, 3);
                }
                count--;
            }
            seatno = 6;
            while (count > 0)
            {
                //x = x + x1 / 12;
                y       = seat1.Location.Y;
                vm_seat = _vm_table.get_VM_Seat(seatno);
                seat1   = new View_Seat(vm_seat);
                Dict_View_Seats[seatno] = seat1;
                seat1.JoinedTableEvent += Seat_JoinedTableEvent;
                seat1.ReceiveBetEvent  += Seat_ReceiveBetEvent;
                seat1.Size = new Size(seatwidth, seatheight);
                this.tableLayoutPanel1.Controls.Add(seat1, 5, 2);
                if (vm_seat.IsDealer)
                {
                    btnDealer.Visible = true;
                    this.tableLayoutPanel1.Controls.Add(btnDealer, 5, 3);
                }
                count--;
                seatno++;
            }

            betctrl = new Dialogs.BetCollectorControl();

            this.Controls.Add(betctrl);
            betctrl.Location = new Point(0, 0);
            betctrl.Visible  = false;

            this.ResumeLayout();
        }