Exemple #1
0
 /// <summary>
 /// Constructs a PigView for the specified Pig.
 /// </summary>
 /// <param name="pigWorldView"> the PigWorldView that this PigView is part of. </param>
 /// <param name="pig"> the pig to view. </param>
 public PigView(PigWorldView pigWorldView, Pig pig)
     : base(pigWorldView, pig)
 {
     this.pig      = pig;
     this.ageBrush = Brushes.White;
     InitialiseContextMenu();
 }
Exemple #2
0
        /// <summary>
        /// Constructs the GapView.
        /// </summary>
        /// <param name="gap"> the Gap to view </param>
        public GapView(PigWorldView pigWorldView, Gap gap)
        {
            this.gap    = gap;
            this.Dock   = DockStyle.Fill;
            this.Margin = new Padding(0);  // Fill the entire space available.

            gap.gapChangedEvent += GapChangedEvent;
        }
Exemple #3
0
        /// <summary>
        /// Constructs the LifeFormView.
        /// </summary>
        /// <param name="pigWorldView"> the view of the pigWorld. </param>
        /// <param name="lifeForm"> the LifeForm to view. </param>
        protected LifeFormView(PigWorldView pigWorldView, LifeForm lifeForm)
        {
            this.pigWorldView = pigWorldView;
            this.lifeForm     = lifeForm;

            Position position = lifeForm.Cell.Position;
            CellView cellView = pigWorldView.GetCellViewFromPosition(position);

            this.containingCellView = cellView;

            this.lifeForm.lifeFormMovedEvent += LifeFormMovedEvent;
        }
        private Dictionary <NonlivingThing, NonlivingThingView> nonLivingThingViews = new Dictionary <NonlivingThing, NonlivingThingView>(); // NonlivingThing -> NonLivingThingView

        /// <summary>
        /// Constructs the CellView, to view the specified cell.
        /// </summary>
        /// <param name="pigWorldView"> the view of the pigWorld </param>
        /// <param name="cell"> the cell to view </param>
        public CellView(PigWorldView pigWorldView, Cell cell)
        {
            this.pigWorldView = pigWorldView;
            this.cell         = cell;

            this.cell.nonlivingThingPutDownEvent  += NonlivingThingPutDownEvent;
            this.cell.nonlivingThingPickedUpEvent += NonlivingThingPickedUpEvent;
            this.cell.cellChangedEvent            += CellChangedEvent;

            // Fill the entire space available to this cell.
            this.Dock     = DockStyle.Fill;
            this.Margin   = new Padding(0);
            this.SizeMode = PictureBoxSizeMode.StretchImage;
        }
Exemple #5
0
 /// <summary>
 /// Constructs a TreeView for the specified Tree.
 /// </summary>
 /// <param name="pigWorldView"></param>
 /// <param name="tree"> the tree to view </param>
 public TreeView(PigWorldView pigWorldView, Tree tree)
     : base(pigWorldView, tree)
 {
     this.tree = tree;
     InitialiseContextMenu();
 }
 /// <summary>
 /// Constructs the AnimalView.
 /// </summary>
 /// <param name="pigWorldView"></param>
 /// <param name="plant"></param>
 public PlantView(PigWorldView pigWorldView, Plant plant)
     : base(pigWorldView, plant)
 {
 }
        private RopePiece ropePiece;  // The ropePiece being displayed.

        /// <summary>
        /// Constructs a RopeView.
        ///
        /// The constructor must include a PigWorldView parameter so that all views
        /// created by the CreateView method(s) have similar signatures.
        /// </summary>
        /// <param name="ropePiece"> the ropePiece to view. </param>
        public RopePieceView(PigWorldView pigWorldView, RopePiece ropePiece)
            : base(ropePiece)
        {
            this.ropePiece = ropePiece;
        }
 /// <summary>
 /// Constructs the AnimalView.
 /// </summary>
 /// <param name="pigWorldView"></param>
 /// <param name="animal"></param>
 protected AnimalView(PigWorldView pigWorldView, Animal animal)
     : base(pigWorldView, animal)
 {
     this.animal = animal;
 }
 /// <summary>
 /// Constructs a WolfView.
 /// </summary>
 /// <param name="wolf"> the wolf to view. </param>
 public WolfView(PigWorldView pigWorldView, Wolf wolf)
     : base(pigWorldView, wolf)
 {
     this.wolf = wolf;
     InitialiseContextMenu();
 }
Exemple #10
0
        private PigFood pigFood;  // A reference to the pig food being viewed.

        /// <summary>
        /// Constructs a PigFoodView.
        ///
        /// The constructor must include a PigWorldView parameter so that all views
        /// created by the CreateView method(s) have similar signatures.
        /// </summary>
        /// <param name="pigFood"> the pig food to view. </param>
        public PigFoodView(PigWorldView pigWorldView, PigFood pigFood) : base(pigFood)
        {
            this.pigFood = pigFood;
        }