コード例 #1
0
        private void Damier_Paint(object sender, PaintEventArgs e)
        {
            FabriqueManagerDame fm = new FabriqueManagerDame();

            fm.CreatePersonnagesDuJeu(new FactoryPersonnageDame());

            fm.Organisme.PlacerLesPionsSurDamier(fm.LesPersonnes, fm.Organisme.Plateau);
            var plateau = fm.Organisme.Plateau.getZoneForFree().Count;

            fm.Organisme.PlacerLesPionsSurDamier(fm.LesPersonnes, fm.Organisme.Plateau);
            var       p   = fm.Organisme.Plateau;
            Rectangle rec = new Rectangle();

            foreach (var zone in fm.Organisme.Plateau.getZoneForFree())
            {
                //p.X = zone.X;
                //p.Y = zone.Y;
                //p.Height = 4;
                //p.Width = 4;
                rec.Height = 5;
                rec.Width  = 5;
                rec.X      = zone.X * rec.Height;
                rec.Y      = zone.Y * rec.Width;

                listeRectanges.Add(rec);
            }

            Pen pen = new Pen(Color.Red, 2);

            using (Graphics g = this.painter1.CreateGraphics())
            {
                g.DrawRectangles(pen, listeRectanges.ToArray());
                // this.Invalidate();
            }
        }
コード例 #2
0
        private void launcher_Click(object sender, EventArgs e)
        {
            FabriqueManagerDame fm = new FabriqueManagerDame();

            fm.CreatePersonnagesDuJeu(new FactoryPersonnageDame());
            fm.Organisme.PlacerLesPionsSurDamier(fm.LesPersonnes, fm.Organisme.Plateau);
            var plateau = fm.Organisme.Plateau.getZoneForFree().Count;
        }
コード例 #3
0
        private void launcher_Click(object sender, EventArgs e)
        {
            FabriqueManagerDame fm = new FabriqueManagerDame();

            fm.CreatePersonnagesDuJeu(new FactoryPersonnageDame());

            fm.Organisme.PlacerLesPionsSurDamier(fm.LesPersonnes, fm.Organisme.Plateau);
            var plateau = fm.Organisme.Plateau.getZoneForFree().Count;

            //Graphics checkBoard = Graphics.FromImage(checkerBoardBitmap);

            //    SolidBrush fillColourBrush = new SolidBrush(Color.Red);
            //    checkBoard.Clear(this.consoleBox.BackColor);

            //    //var sim = simulation.usa.GetPlateauDeJeuDame();

            //    var dimensionPlateau = Math.Sqrt(plateau);

            //    List<Rectangle> listeRectangle = new List<Rectangle>();

            //    //using (Rectangle p = new Rectangle())
            //    //{
            //    Rectangle p = new Rectangle();
            //    foreach (var zone in fm.Organisme.Plateau.getZoneForFree())
            //    {
            //        p.X = zone.X;
            //        p.Y = zone.Y;
            //        p.Height = 4;
            //        p.Width = 4;

            //        listeRectangle.Add(p);
            //    }

            //    Pen pen = new Pen(Color.White, 10);


            //        foreach (var item in listeRectangle)
            //        {
            //            Brush brush = (item.X % 2 == 0 && item.Y % 2 == 0) || (item.X % 2 != 0 && item.Y % 2 != 0) ? Brushes.Black : Brushes.White;
            //            checkBoard.DrawRectangle(pen, item);
            //            checkBoard.FillRectangle(brush, item);

            //            //graph.DrawRectangle(brush, item);
            //        }
            //        //BackgroundImage = image;

            //    // code needs to be inserted here
            //    //.
            //    //.
            //    //.
            //    consoleBox.Refresh();
            //    consoleBox.Dispose();
            //    fillColourBrush.Dispose();



            //    /*

            //    FabriqueManagerDame fm = new FabriqueManagerDame();
            //    fm.CreatePersonnagesDuJeu(new FactoryPersonnageDame());

            //    fm.Organisme.PlacerLesPionsSurDamier(fm.LesPersonnes, fm.Organisme.Plateau);
            //    var p = fm.Organisme.Plateau;

            //     */

            //      //var perso = fm.
            //    //SimulationDeJeuDame sdj = new SimulationDeJeuDame();
            //    //sdj.CreatePersonnagesDuJeu(new FactoryPersonnageDame());
            //    ////sdj.CreatePersonnagesDuJeu(new FactoryPersonnageGuerreDuGolf());
            //    ////sdj.FaireCrierToutLeMonde();
            //    //Console.WriteLine("--------");
            //    //consoleBox.Text += sdj.ShowAllPersonnage();
            //    //consoleBox.Text += "\n";
            //    //Console.WriteLine("--------");
            //    ////sdj.PartirAuCombat();
            //    //consoleBox.Text += sdj.AfficherLesUploads();
            //    //consoleBox.Text += "\n";
            //    //Console.WriteLine("--------");
            //    //sdj.ChangeEtat(eMode.AVANCER);
            //    //consoleBox.Text += sdj.AfficherLesUploadsObservateur();
            //    //consoleBox.Text += "\n";
            //    //Console.WriteLine("--------");

            //    //List<AbstractZone> lesZones = sdj.usa.GetPlateauDeJeu().getZonesAcces();

            //    //var f2 = new Form2();
            //    //this.Hide();
            //    //f2.ShowDialog();

            //    //this.Controls.Clear();
            //    //EnvironnementDame env = new EnvironnementDame();
            //    //FactoryPersonnage per = new FactoryPersonnageDame();
            //    //FabriqueManagerDame fm = new FabriqueManagerDame(env, per);

            //    //TableLayoutPanel pan = fm.InitTableLayout(10, 10);


            //    //this.Controls.Add(pan);
        }