Exemple #1
0
 public void NotifyChanged(ModelData data, Event e)
 {
     _playerPosition = data.PlayerPosition;
     _wallPositions = data.WallPositions;
     _paperPosition = data.PaperPosition;
     _data = data;
     Draw();
 }
        public void DrawInfo(ModelData data)
        {
            var textBlock = new TextBlock
            {
                Text = "Lives: " + data.Lives + "  Pages Remaining: " + data.PagesRemaining,
                Foreground = new SolidColorBrush(Colors.White),
                FontSize = _blockSize/4
            };

            Canvas.SetLeft(textBlock, _blockSize/4);

            Canvas.SetTop(textBlock, _blockSize/4);

            _canvas.Children.Add(textBlock);
            /*
            var rect = new Rectangle
            {
                Fill = Brushes.Tomato,
                Width = _blockSize * Room.UnitWidth,
                Height = _blockSize * Room.UnitHeight
            };
            _canvas.Children.Add(rect);*/
        }
Exemple #3
0
 public void NotifyObserver(Event e)
 {
     foreach (IModelObserver o in _observers)
     {
         var data = new ModelData(GetPlayerPosition(), GetWallPositions(),
             (Room.PaperFound) ? new Point(-1, -1) : GetPaperPosition(), Player.NumLife, _pagesRemaining);
         o.NotifyChanged(data, e);
     }
 }
Exemple #4
0
 public void NotifyChanged(ModelData data, Event e)
 {
     Event = e;
     Draw();
 }