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); }
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); }
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; }
// 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; }
void OnScreenResized(ScreenDocument screen, int width, int height) { if (ScreenResized != null) { ScreenResized(screen, width, height); } }
protected override void UnbindScreen(ScreenDocument oldScreen) { oldScreen.EntityAdded -= EntityAdded; oldScreen.EntityRemoved -= EntityRemoved; this.Children.Clear(); }
protected override ScreenCanvas CreateScreenCanvas(ScreenDocument screen) { var canvas = new TileScreenCanvas(ToolProvider); canvas.Screen = screen; return canvas; }
protected override void BindScreen(ScreenDocument newScreen) { newScreen.Stage.EntryPointsChanged += Update; var player = newScreen.Stage.Project.EntityByName("Player"); if (player != null) _playerSprite = player.DefaultSprite; }
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; }
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); }
protected override void BindScreen(ScreenDocument newScreen) { newScreen.EntityAdded += EntityAdded; newScreen.EntityRemoved += EntityRemoved; foreach (var placement in newScreen.Entities) { EntityAdded(placement); } }
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(); } }
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); } }
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); } }
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(); } }
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); } }
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); }
protected override void UnbindScreen(ScreenDocument oldScreen) { _selectionBounds = null; oldScreen.SelectionChanged -= UpdateSelection; }
public void RemoveScreen(ScreenDocument screen) { RemoveScreenWithoutHistory(screen); PushHistoryAction(new RemoveScreenAction(screen)); }
protected abstract void UnbindScreen(ScreenDocument oldScreen);
private void ScreenAddedOrRemoved(ScreenDocument obj) { ResetScreens(); }
protected override void UnbindScreen(ScreenDocument oldScreen) { oldScreen.TileChanged -= DrawProperties; }
protected override void BindScreen(ScreenDocument newScreen) { newScreen.TileChanged += DrawProperties; }
protected abstract void BindScreen(ScreenDocument newScreen);
protected override void BindScreen(ScreenDocument newScreen) { newScreen.Stage.EntryPointsChanged += Update; }
protected abstract ScreenCanvas CreateScreenCanvas(ScreenDocument screen);
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); }
protected override void BindScreen(ScreenDocument newScreen) { newScreen.EntitiesChanged += Update; }
protected override void UnbindScreen(ScreenDocument oldScreen) { oldScreen.Stage.EntryPointsChanged -= Update; }
private void ScreenResized(ScreenDocument screen, int width, int height) { LayoutScreens(); }
public AddScreenAction(ScreenDocument screen) { this.screen = screen; }
protected override void UnbindScreen(ScreenDocument oldScreen) { oldScreen.EntitiesChanged -= Update; }
private void DeleteScreen(ScreenDocument screen) { }
public RemoveScreenAction(ScreenDocument screen) { this.screen = screen; }
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(); }
public AddEntityAction(EntityPlacement entity, ScreenDocument screen) { this.entity = entity; this.screen = screen; }
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(); }
private void SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.Selection != null) { _selection = e.Selection; _selectionScreen = e.Screen; } else if (e.Screen == _selectionScreen) { _selection = null; } }
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; }
protected override void BindScreen(ScreenDocument newScreen) { newScreen.SelectionChanged += UpdateSelection; UpdateSelection(newScreen.Selection); }