Ejemplo n.º 1
0
        public gameForm(Form _MyMainUI)
        {
            this.DoubleBuffered = true;
            InitializeComponent();

            MyMainUI = _MyMainUI;

            myPlateau       = new Plateau(gamePanel);
            MyImagesManager = new ImagesManager(gamePanel);
            MyClient        = new Client(this.gamePanel, this.listBox2, this, MyMainUI);
            MyAnim          = new Animation(this.gamePanel);
        }
Ejemplo n.º 2
0
        public static void PaintEventForm1(int width, int height, PaintEventArgs e)
        {
            if (!boardCreated)
            {
                int countRec   = 0;
                int formWidth  = width;
                int formHeight = height;
                int penWidth   = 1;

                Pen myPen = new Pen(new SolidBrush(Color.Black), penWidth);

                for (int i = recHeight; i <= formHeight; i += recHeight) //dessine les lignes horizontales
                {
                    e.Graphics.DrawLine(myPen, 0, i, formWidth, i);
                    countHorizontal++;
                }

                for (int i = recWidth; i <= formWidth; i += recWidth) //dessine les lignes verticales
                {
                    e.Graphics.DrawLine(myPen, i, 0, i, formHeight);
                    countVertical++;
                }

                countRec = countHorizontal * countVertical;

                for (int x = 0; x < countHorizontal; x++) // Récupère les rectangles
                {
                    for (int y = 0; y < countVertical; y++)
                    {
                        Rectangle newRec = new Rectangle(recHeight * y, recWidth * x, recWidth, recHeight);
                        plateauCases[x][y].Rec = newRec;
                    }
                }

                for (int x = 0; x < plateauCases.Length; x++) // Colorie les cases
                {
                    for (int y = 0; y < plateauCases[x].Length; y++)
                    {
                        if (plateauCases[x][y].isBlack)
                        {
                            e.Graphics.FillRectangle(new SolidBrush(Color.Black), plateauCases[x][y].Rec);
                        }
                    }
                }

                boardCreated = true;

                ImagesManager MyImagesM = new ImagesManager(panelMain);

                MyImagesM.createPictureBox();
            }
        }
Ejemplo n.º 3
0
        public static void CloseGameOpenUI()
        {
            MyMainUIForm.Invoke((MethodInvoker) delegate() {
                MyMainUIForm.Show();
            });

            ImagesManager MyImageM = new ImagesManager(gamePanel);

            MyImageM.resetPlateau();

            gameList.Invoke((MethodInvoker) delegate()
            {
                gameList.Items.Clear();
            });

            MyGameForm.Invoke((MethodInvoker) delegate() {
                MyGameForm.Hide();
            });
        }