Esempio n. 1
0
 private void savannahPictureBox_Paint(object sender, PaintEventArgs e)
 {
     var min = Math.Min(e.ClipRectangle.Width, e.ClipRectangle.Height);
     var width = min / Columns;
     var height = min / Rows;
     var size = new Size(width, height);
     var visitor = new GraphicsVisitor(e.Graphics, this.textures, size);
     var counter = new CounterVisitor();
     this.game.Accept((ISavannahVisitor) visitor);
     this.game.Accept((IAnimalVisitor) visitor);
     this.game.Accept(counter);
     this.lionsTextBox.Text = counter.Lions.ToString("N0");
     this.rabbitsTextBox.Text = counter.Rabbits.ToString("N0");
     this.are.Set();
 }
Esempio n. 2
0
        private void savannahPictureBox_Paint(object sender, PaintEventArgs e)
        {
            var min     = Math.Min(e.ClipRectangle.Width, e.ClipRectangle.Height);
            var width   = min / Columns;
            var height  = min / Rows;
            var size    = new Size(width, height);
            var visitor = new GraphicsVisitor(e.Graphics, this.textures, size);
            var counter = new CounterVisitor();

            this.game.Accept((ISavannahVisitor)visitor);
            this.game.Accept((IAnimalVisitor)visitor);
            this.game.Accept(counter);
            this.lionsTextBox.Text   = counter.Lions.ToString("N0");
            this.rabbitsTextBox.Text = counter.Rabbits.ToString("N0");
            this.are.Set();
        }