コード例 #1
0
        public ScreenDocument AddScreen(string name, int tile_width, int tile_height)
        {
            var screen = new ScreenInfo(name, Tileset.Tileset);

            int[,] tiles = new int[tile_width, tile_height];

            screen.Layers.Add(new ScreenLayerInfo(name, new TileLayer(tiles, Tileset.Tileset, 0, 0), false, new List <ScreenLayerKeyframe>()));

            _map.Screens.Add(name, screen);

            if (StartScreen == null)
            {
                _map.StartScreen = _map.Screens.Keys.First();
                Dirty            = true;
            }

            ScreenDocument doc = WrapScreen(screen);

            if (ScreenAdded != null)
            {
                ScreenAdded(doc);
            }

            return(doc);
        }
コード例 #2
0
        public ScreenDocument AddScreen(string name, int tile_width, int tile_height)
        {
            var screen = new MegaMan.Common.ScreenInfo(name, Tileset.Tileset);

            int[,] tiles = new int[tile_width, tile_height];

            screen.Layers.Add(new ScreenLayerInfo(name, new TileLayer(tiles, Tileset.Tileset, 0, 0), false, new List <EntityPlacement>(), new List <ScreenLayerKeyframe>()));

            map.Screens.Add(name, screen);

            if (StartScreen == null)
            {
                map.StartScreen = map.Screens.Keys.First();
                Dirty           = true;
            }

            ScreenDocument doc = WrapScreen(screen);

            // now I can do things like fire an event... how useful!
            if (ScreenAdded != null)
            {
                ScreenAdded(doc);
            }

            return(doc);
        }
コード例 #3
0
        private void ScreenRenamed(string oldName, string newName)
        {
            if (!screens.ContainsKey(oldName))
            {
                return;
            }
            ScreenDocument doc = screens[oldName];

            screens.Remove(oldName);
            screens.Add(newName, doc);
            if (_map.StartScreen == oldName)
            {
                _map.StartScreen = newName;
            }
            foreach (var join in Joins)
            {
                if (join.screenOne == oldName)
                {
                    join.screenOne = newName;
                }
                if (join.screenTwo == oldName)
                {
                    join.screenTwo = newName;
                }
            }
            Dirty = true;
        }
コード例 #4
0
        // Initialize the ResizingAdorner.
        public ScreenResizeAdorner(UIElement adornedElement, ScreenDocument screen)
            : base(adornedElement)
        {
            Screen = screen;

            visualChildren = new VisualCollection(this);

            // Call a helper method to initialize the Thumbs
            // with a customized cursors.
            BuildAdornerCorner(ref top, Cursors.SizeNS);
            BuildAdornerCorner(ref right, Cursors.SizeWE);
            BuildAdornerCorner(ref left, Cursors.SizeWE);
            BuildAdornerCorner(ref bottom, Cursors.SizeNS);

            // Add handlers for resizing.
            left.DragDelta += new DragDeltaEventHandler(HandleLeft);
            bottom.DragDelta += new DragDeltaEventHandler(HandleBottom);
            top.DragDelta += new DragDeltaEventHandler(HandleTop);
            right.DragDelta += new DragDeltaEventHandler(HandleRight);

            right.DragStarted += DragStarted;

            adornedElement.MouseEnter += adornedElement_MouseEnter;
            adornedElement.MouseLeave += adornedElement_MouseLeave;
            this.Visibility = System.Windows.Visibility.Hidden;
        }
コード例 #5
0
 void OnScreenResized(ScreenDocument screen, int width, int height)
 {
     if (ScreenResized != null)
     {
         ScreenResized(screen, width, height);
     }
 }
コード例 #6
0
        protected override void UnbindScreen(ScreenDocument oldScreen)
        {
            oldScreen.EntityAdded -= EntityAdded;
            oldScreen.EntityRemoved -= EntityRemoved;

            this.Children.Clear();
        }
コード例 #7
0
ファイル: StageTileControl.cs プロジェクト: laazer/cs_megaman
        protected override ScreenCanvas CreateScreenCanvas(ScreenDocument screen)
        {
            var canvas = new TileScreenCanvas(ToolProvider);
            canvas.Screen = screen;

            return canvas;
        }
コード例 #8
0
        protected override void BindScreen(ScreenDocument newScreen)
        {
            newScreen.Stage.EntryPointsChanged += Update;

            var player = newScreen.Stage.Project.EntityByName("Player");
            if (player != null)
                _playerSprite = player.DefaultSprite;
        }
コード例 #9
0
 public TileChange(ScreenDocument screen, int tx, int ty, int oldId, int newId)
 {
     this.screen    = screen;
     this.tileX     = tx;
     this.tileY     = ty;
     this.oldTileId = oldId;
     this.newTileId = newId;
 }
コード例 #10
0
        private ScreenDocument WrapScreen(MegaMan.Common.ScreenInfo screen)
        {
            ScreenDocument doc = new ScreenDocument(screen, this);

            doc.Renamed     += ScreenRenamed;
            doc.TileChanged += () => Dirty = true;
            doc.Resized     += (w, h) => OnScreenResized(doc, w, h);
            return(doc);
        }
コード例 #11
0
        protected override void BindScreen(ScreenDocument newScreen)
        {
            newScreen.EntityAdded += EntityAdded;
            newScreen.EntityRemoved += EntityRemoved;

            foreach (var placement in newScreen.Entities)
            {
                EntityAdded(placement);
            }
        }
コード例 #12
0
 public void SetStartPoint(ScreenDocument screenDocument, Point location)
 {
     _map.StartScreen  = screenDocument.Name;
     _map.PlayerStartX = location.X;
     _map.PlayerStartY = location.Y;
     Dirty             = true;
     if (EntryPointsChanged != null)
     {
         EntryPointsChanged();
     }
 }
コード例 #13
0
        public void RemoveScreen(ScreenDocument screen)
        {
            screen.Renamed     -= ScreenRenamed;
            screen.TileChanged -= () => Dirty = true;
            screen.Resized     -= (w, h) => OnScreenResized(screen, w, h);

            screens.Remove(screen.Name);

            if (ScreenRemoved != null)
            {
                ScreenRemoved(screen);
            }
        }
コード例 #14
0
        public void AddScreenDocumentWithoutHistory(ScreenDocument doc)
        {
            _map.Screens.Add(doc.Name, doc.Info);
            screens.Add(doc.Name, doc);

            if (StartScreen == null)
            {
                _map.StartScreen = _map.Screens.Keys.First();
                Dirty            = true;
            }

            if (ScreenAdded != null)
            {
                ScreenAdded(doc);
            }
        }
コード例 #15
0
        public void AddContinuePoint(ScreenDocument screenDocument, Point location)
        {
            if (_map.ContinuePoints.ContainsKey(screenDocument.Name))
            {
                _map.ContinuePoints[screenDocument.Name] = location;
            }
            else
            {
                _map.AddContinuePoint(screenDocument.Name, location);
            }

            Dirty = true;
            if (EntryPointsChanged != null)
            {
                EntryPointsChanged();
            }
        }
コード例 #16
0
        public void RemoveScreenWithoutHistory(ScreenDocument screen)
        {
            screen.Renamed     -= ScreenRenamed;
            screen.TileChanged -= () => Dirty = true;
            screen.Resized     -= (w, h) => OnScreenResized(screen, w, h);

            screens.Remove(screen.Name);
            _map.Screens.Remove(screen.Name);

            if (StartScreen == screen.Name)
            {
                _map.StartScreen = _map.Screens.Keys.FirstOrDefault();
                Dirty            = true;
            }

            if (ScreenRemoved != null)
            {
                ScreenRemoved(screen);
            }
        }
コード例 #17
0
        public EntityPlacementControlViewModel(EntityPlacement placement, EntityInfo entityInfo, ScreenDocument screen)
        {
            if (placement == null)
                throw new ArgumentNullException("placement");

            if (entityInfo == null)
                throw new ArgumentNullException("entityInfo");

            if (screen == null)
                throw new ArgumentNullException("screen");

            this.Placement = placement;
            this._entityInfo = entityInfo;
            this._screen = screen;

            DeleteCommand = new RelayCommand(Delete);
            FlipCommand = new RelayCommand(Flip);
            RespawnCommand = new RelayCommand(SetRespawnMode);
            StartStateCommand = new RelayCommand(SetStartState);

            ViewModelMediator.Current.GetEvent<ZoomChangedEventArgs>().Subscribe(ZoomChanged);
        }
コード例 #18
0
 protected override void UnbindScreen(ScreenDocument oldScreen)
 {
     _selectionBounds = null;
     oldScreen.SelectionChanged -= UpdateSelection;
 }
コード例 #19
0
 public void RemoveScreen(ScreenDocument screen)
 {
     RemoveScreenWithoutHistory(screen);
     PushHistoryAction(new RemoveScreenAction(screen));
 }
コード例 #20
0
 protected abstract void UnbindScreen(ScreenDocument oldScreen);
コード例 #21
0
 private void ScreenAddedOrRemoved(ScreenDocument obj)
 {
     ResetScreens();
 }
コード例 #22
0
 protected override void UnbindScreen(ScreenDocument oldScreen)
 {
     oldScreen.TileChanged -= DrawProperties;
 }
コード例 #23
0
 protected override void BindScreen(ScreenDocument newScreen)
 {
     newScreen.TileChanged += DrawProperties;
 }
コード例 #24
0
 protected abstract void BindScreen(ScreenDocument newScreen);
コード例 #25
0
 protected override void BindScreen(ScreenDocument newScreen)
 {
     newScreen.Stage.EntryPointsChanged += Update;
 }
コード例 #26
0
 protected abstract ScreenCanvas CreateScreenCanvas(ScreenDocument screen);
コード例 #27
0
ファイル: StageDocument.cs プロジェクト: laazer/cs_megaman
 void OnScreenResized(ScreenDocument screen, int width, int height)
 {
     if (ScreenResized != null)
     {
         ScreenResized(screen, width, height);
     }
 }
コード例 #28
0
ファイル: StageDocument.cs プロジェクト: laazer/cs_megaman
        public void RemoveScreen(ScreenDocument screen)
        {
            screen.Renamed -= ScreenRenamed;
            screen.TileChanged -= () => Dirty = true;
            screen.Resized -= (w, h) => OnScreenResized(screen, w, h);

            screens.Remove(screen.Name);

            if (ScreenRemoved != null) ScreenRemoved(screen);
        }
コード例 #29
0
 protected override void BindScreen(ScreenDocument newScreen)
 {
     newScreen.EntitiesChanged += Update;
 }
コード例 #30
0
 protected override void UnbindScreen(ScreenDocument oldScreen)
 {
     oldScreen.Stage.EntryPointsChanged -= Update;
 }
コード例 #31
0
 private void ScreenResized(ScreenDocument screen, int width, int height)
 {
     LayoutScreens();
 }
コード例 #32
0
 public AddScreenAction(ScreenDocument screen)
 {
     this.screen = screen;
 }
コード例 #33
0
 protected override void UnbindScreen(ScreenDocument oldScreen)
 {
     oldScreen.EntitiesChanged -= Update;
 }
コード例 #34
0
 private void DeleteScreen(ScreenDocument screen)
 {
 }
コード例 #35
0
 public RemoveScreenAction(ScreenDocument screen)
 {
     this.screen = screen;
 }
コード例 #36
0
ファイル: StageDocument.cs プロジェクト: laazer/cs_megaman
        public void AddContinuePoint(ScreenDocument screenDocument, Point location)
        {
            if (map.ContinuePoints.ContainsKey(screenDocument.Name))
            {
                map.ContinuePoints[screenDocument.Name] = location;
            }
            else
            {
                map.AddContinuePoint(screenDocument.Name, location);
            }

            Dirty = true;
            if (EntryPointsChanged != null)
                EntryPointsChanged();
        }
コード例 #37
0
 public AddEntityAction(EntityPlacement entity, ScreenDocument screen)
 {
     this.entity = entity;
     this.screen = screen;
 }
コード例 #38
0
ファイル: StageDocument.cs プロジェクト: laazer/cs_megaman
 public void SetStartPoint(ScreenDocument screenDocument, Point location)
 {
     map.StartScreen = screenDocument.Name;
     map.PlayerStartX = location.X;
     map.PlayerStartY = location.Y;
     Dirty = true;
     if (EntryPointsChanged != null)
         EntryPointsChanged();
 }
コード例 #39
0
 private void SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (e.Selection != null)
     {
         _selection = e.Selection;
         _selectionScreen = e.Screen;
     }
     else if (e.Screen == _selectionScreen)
     {
         _selection = null;
     }
 }
コード例 #40
0
ファイル: StageDocument.cs プロジェクト: laazer/cs_megaman
 private ScreenDocument WrapScreen(MegaMan.Common.ScreenInfo screen)
 {
     ScreenDocument doc = new ScreenDocument(screen, this);
     screens.Add(screen.Name, doc);
     doc.Renamed += ScreenRenamed;
     doc.TileChanged += () => Dirty = true;
     doc.Resized += (w, h) => OnScreenResized(doc, w, h);
     return doc;
 }
コード例 #41
0
 protected override void BindScreen(ScreenDocument newScreen)
 {
     newScreen.SelectionChanged += UpdateSelection;
     UpdateSelection(newScreen.Selection);
 }