public CheckpointPropertiesWindow(Checkpoint checkpoint, Canvas canvas, DesignerItem item, Level level)
     : base()
 {
     InitializeComponent();
     item.PropertyWindow = this;
     DataContext = new CheckpointModel(checkpoint, item, level, canvas);
     (DataContext as CheckpointModel).RespawnIndicator.OnSelected += HandleSelection;
 }
            public CheckpointModel(Checkpoint checkpoint, DesignerItem item, Level level, Canvas canvas)
                : base(item, level)
            {
                IsCentered = true;

                if(!level.Checkpoints.Contains(checkpoint))
                    level.Checkpoints.Add(checkpoint);

                Data = mCheckpoint = checkpoint;
                mCanvas = canvas;

                mCheckpointRegion = new System.Windows.Shapes.Rectangle();
                mCheckpointRegion.Fill = new SolidColorBrush(Colors.Yellow);
                mCheckpointRegion.Fill.Opacity = .25;
                mCheckpointRegion.IsHitTestVisible = false;

                Ellipse rindicator = new Ellipse();
                rindicator.Fill = Brushes.SpringGreen;
                rindicator.Stroke = Brushes.Black;

                TextBlock txt = new TextBlock();
                txt.Text = "R";
                txt.HorizontalAlignment = System.Windows.HorizontalAlignment.Center;
                txt.VerticalAlignment = System.Windows.VerticalAlignment.Center;

                Grid gr = new Grid();
                gr.Children.Add(rindicator);
                gr.Children.Add(txt);
                gr.IsHitTestVisible = false;

                mRespawnIndicator = new DesignerItem();
                mRespawnIndicator.CanResize = false;
                mRespawnIndicator.CanDelete = false;
                mRespawnIndicator.Model = this;
                mRespawnIndicator.Height = 30;
                mRespawnIndicator.Width = 30;
                mRespawnIndicator.MinWidth = 30;
                mRespawnIndicator.MinHeight = 30;
                mRespawnIndicator.Content = gr;

                canvas.Children.Add(mCheckpointRegion);
                canvas.Children.Add(mRespawnIndicator);

                X = (int)checkpoint.Bound.X;
                Y = (int)checkpoint.Bound.Y;
                LocationX = (int)checkpoint.Location.X;
                LocationY = (int)checkpoint.Location.Y;
                Quadrant = Quadrant;

                Canvas.SetZIndex(mRespawnIndicator, 1);
                Canvas.SetZIndex(mCheckpointRegion, -9);
            }
Пример #3
0
 EventHandler<BoolEventArgs> NewCheckpointHandler(DesignerItem item)
 {
     Checkpoint cp = new Checkpoint();
     CheckpointPropertiesWindow cpw = new CheckpointPropertiesWindow(cp, this, item, Level);
     this.Children.Add(cpw);
     return cpw.SelectionHandler;
 }
Пример #4
0
        private void AddCheckpoint(Checkpoint cp)
        {
            DesignerItem item = CreateDesignerImage(mCheckpointImage);

            PropertiesWindow pw = new CheckpointPropertiesWindow(cp, MyDesignerCanvas, item, Level);
            MyDesignerCanvas.Children.Add(pw);

            item.OnSelected += pw.SelectionHandler;
            item.IsSelected = true;
        }