예제 #1
0
        /// <summary>Affiche le jeu du joueur</summary>
        private void AfficheJeu()
        {
            for (int i = 0; i < 14; i++)
            {
                if (m_oJoueur.Main[i].Chiffre != 0)
                {
                    switch (m_oJoueur.Numero)
                    {
                    case (0):
                        m_pbMain[i].Image = m_oJoueur.Main[i].donneIcon();
                        break;

                    case (1):
                        if (Options.GetOptions().MontreJeu)
                        {
                            m_pbMain[i].Image = RessourceManager.rotationIcon(m_oJoueur.Main[i].donneIcon(), -90);
                        }
                        else
                        {
                            m_pbMain[i].Image = Tuile.donneFond270();
                        }
                        break;

                    case (2):
                        if (Options.GetOptions().MontreJeu)
                        {
                            m_pbMain[i].Image = m_oJoueur.Main[i].donneIcon();
                        }
                        else
                        {
                            m_pbMain[i].Image = Tuile.donneFond();
                        }
                        break;

                    case (3):
                        if (Options.GetOptions().MontreJeu)
                        {
                            m_pbMain[i].Image = RessourceManager.rotationIcon(m_oJoueur.Main[i].donneIcon(), 90);
                        }
                        else
                        {
                            m_pbMain[i].Image = Tuile.donneFond90();
                        }
                        break;
                    }
                }
                else
                {
                    m_pbMain[i].Image = null;
                }
            }
        }
예제 #2
0
        public frmPrinc()
        {
            InitializeComponent();
            try {
                m_oMahjong = new Mahjong(this, this.timer1);
                Defausse.getDefausse().Vue = this;

                this.BackColor            = System.Drawing.Color.FromArgb(20, 140, 20);
                this.lblDiscard.BackColor = System.Drawing.Color.FromArgb(20, 140, 20);
                this.lblJoueur1.BackColor = System.Drawing.Color.FromArgb(20, 140, 20);
                this.lblJoueur2.BackColor = System.Drawing.Color.FromArgb(20, 140, 20);
                this.lblJoueur3.BackColor = System.Drawing.Color.FromArgb(20, 140, 20);
                this.lblJoueur4.BackColor = System.Drawing.Color.FromArgb(20, 140, 20);
                this.lblReste.BackColor   = System.Drawing.Color.FromArgb(20, 140, 20);

                AffichageDesNomsJoueurs();


                for (int i = 0; i < 14; i++)
                {
                    System.Windows.Forms.PictureBox pbJoueur1;
                    System.Windows.Forms.PictureBox pbJoueur2;
                    System.Windows.Forms.PictureBox pbJoueur3;
                    System.Windows.Forms.PictureBox pbJoueur4;

                    pbJoueur1       = new System.Windows.Forms.PictureBox();
                    pbJoueur1.Image = Tuile.donneFond();
                    m_oMahjong.RepresentationJoueur[0].PictureBoxMain[i] = pbJoueur1;
                    pbJoueur2       = new System.Windows.Forms.PictureBox();
                    pbJoueur2.Image = Tuile.donneFond270();
                    m_oMahjong.RepresentationJoueur[1].PictureBoxMain[i] = pbJoueur2;
                    pbJoueur3       = new System.Windows.Forms.PictureBox();
                    pbJoueur3.Image = Tuile.donneFond();
                    m_oMahjong.RepresentationJoueur[2].PictureBoxMain[i] = pbJoueur3;
                    pbJoueur4       = new System.Windows.Forms.PictureBox();
                    pbJoueur4.Image = Tuile.donneFond90();
                    m_oMahjong.RepresentationJoueur[3].PictureBoxMain[i] = pbJoueur4;

                    m_oMahjong.RepresentationJoueur[0].PictureBoxMain[i].SetBounds(Constantes.X + (i * 40), Constantes.Y, 40, 50);
                    m_oMahjong.RepresentationJoueur[1].PictureBoxMain[i].SetBounds(Constantes.X + 700, Constantes.Y - 550 + (i * 40), 50, 40);
                    m_oMahjong.RepresentationJoueur[2].PictureBoxMain[i].SetBounds(Constantes.X + (i * 40), Constantes.Y - 610, 40, 50);
                    m_oMahjong.RepresentationJoueur[3].PictureBoxMain[i].SetBounds(Constantes.X - 150, Constantes.Y - 550 + (i * 40), 50, 40);

                    m_oMahjong.RepresentationJoueur[0].PictureBoxMain[i].MouseClick += new System.Windows.Forms.MouseEventHandler(this.lblMouseClick);
                    this.Controls.Add(m_oMahjong.RepresentationJoueur[0].PictureBoxMain[i]);
                    this.Controls.Add(m_oMahjong.RepresentationJoueur[1].PictureBoxMain[i]);
                    this.Controls.Add(m_oMahjong.RepresentationJoueur[2].PictureBoxMain[i]);
                    this.Controls.Add(m_oMahjong.RepresentationJoueur[3].PictureBoxMain[i]);
                    pbJoueur1 = null;
                    pbJoueur2 = null;
                    pbJoueur3 = null;
                    pbJoueur4 = null;
                }

                for (int i = 0; i < 14; i++)
                {
                    m_oMahjong.RepresentationJoueur[0].PictureBoxCombi[i] = new System.Windows.Forms.PictureBox();
                    m_oMahjong.RepresentationJoueur[1].PictureBoxCombi[i] = new System.Windows.Forms.PictureBox();
                    m_oMahjong.RepresentationJoueur[2].PictureBoxCombi[i] = new System.Windows.Forms.PictureBox();
                    m_oMahjong.RepresentationJoueur[3].PictureBoxCombi[i] = new System.Windows.Forms.PictureBox();

                    m_oMahjong.RepresentationJoueur[0].PictureBoxCombi[i].SetBounds(Constantes.X + (i * 40), Constantes.Y - 55, 40, 50);
                    m_oMahjong.RepresentationJoueur[1].PictureBoxCombi[i].SetBounds(Constantes.X + 700 - 55, Constantes.Y - 550 + (i * 40), 50, 40);
                    m_oMahjong.RepresentationJoueur[2].PictureBoxCombi[i].SetBounds(Constantes.X + (i * 40), Constantes.Y - 610 + 55, 40, 50);
                    m_oMahjong.RepresentationJoueur[3].PictureBoxCombi[i].SetBounds(Constantes.X - 150 + 55, Constantes.Y - 550 + (i * 40), 50, 40);

                    this.Controls.Add(m_oMahjong.RepresentationJoueur[0].PictureBoxCombi[i]);
                    this.Controls.Add(m_oMahjong.RepresentationJoueur[1].PictureBoxCombi[i]);
                    this.Controls.Add(m_oMahjong.RepresentationJoueur[2].PictureBoxCombi[i]);
                    this.Controls.Add(m_oMahjong.RepresentationJoueur[3].PictureBoxCombi[i]);
                }
                for (int i = 14; i < 24; i++)
                {
                    m_oMahjong.RepresentationJoueur[0].PictureBoxCombi[i] = new System.Windows.Forms.PictureBox();
                    m_oMahjong.RepresentationJoueur[1].PictureBoxCombi[i] = new System.Windows.Forms.PictureBox();
                    m_oMahjong.RepresentationJoueur[2].PictureBoxCombi[i] = new System.Windows.Forms.PictureBox();
                    m_oMahjong.RepresentationJoueur[3].PictureBoxCombi[i] = new System.Windows.Forms.PictureBox();

                    m_oMahjong.RepresentationJoueur[0].PictureBoxCombi[i].SetBounds(Constantes.X + ((i - 14) * 40), Constantes.Y - 108, 40, 50);
                    m_oMahjong.RepresentationJoueur[1].PictureBoxCombi[i].SetBounds(Constantes.X - 150 + 108, Constantes.Y - 550 + ((i - 14) * 40), 50, 40);
                    m_oMahjong.RepresentationJoueur[2].PictureBoxCombi[i].SetBounds(Constantes.X + ((i - 14) * 40), Constantes.Y - 630 + 108, 40, 50);
                    m_oMahjong.RepresentationJoueur[3].PictureBoxCombi[i].SetBounds(Constantes.X + 700 - 108, Constantes.Y - 550 + ((i - 14) * 40), 50, 40);

                    this.Controls.Add(m_oMahjong.RepresentationJoueur[0].PictureBoxCombi[i]);
                    this.Controls.Add(m_oMahjong.RepresentationJoueur[1].PictureBoxCombi[i]);
                    this.Controls.Add(m_oMahjong.RepresentationJoueur[2].PictureBoxCombi[i]);
                    this.Controls.Add(m_oMahjong.RepresentationJoueur[3].PictureBoxCombi[i]);
                }

                /* initialisation des label pour le Vent des joueurs */
                m_oMahjong.RepresentationJoueur[0].PictureBoxVent.SetBounds(750, 650, 40, 50);
                m_oMahjong.RepresentationJoueur[1].PictureBoxVent.SetBounds(880, 50, 50, 40);
                m_oMahjong.RepresentationJoueur[2].PictureBoxVent.SetBounds(130, 40, 40, 50);
                m_oMahjong.RepresentationJoueur[3].PictureBoxVent.SetBounds(30, 50, 50, 40);


                this.Controls.Add(m_oMahjong.RepresentationJoueur[0].PictureBoxVent);
                this.Controls.Add(m_oMahjong.RepresentationJoueur[1].PictureBoxVent);
                this.Controls.Add(m_oMahjong.RepresentationJoueur[2].PictureBoxVent);
                this.Controls.Add(m_oMahjong.RepresentationJoueur[3].PictureBoxVent);
            }
            catch (Exception ex) {
                System.Windows.Forms.MessageBox.Show(ex.Message + "\n\n" + ex.StackTrace, "Erreur...", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }