protected override void OnRightMouseButtonMove(LevelMapEditor editor, TileLocation location, Keys modifierKeys) { if (editor.LayerMode == LayerMode.LowerLayer) { modifierKeys |= Keys.Shift; } switch (modifierKeys) { case Keys.Alt | Keys.Shift: editor.RightTile = editor.Level.LowerLayer[location]; break; case Keys.Alt: editor.RightTile = editor.Level.UpperLayer[location]; break; case Keys.Shift: editor.SetLowerLayerTile(location, editor.RightTile); break; default: editor.SetUpperLayerTile(location, editor.RightTile); break; } editor.TileLocationHistory.Add(location); }
public MonstersDialog(LevelMapEditor owner) { InitializeComponent(); Font = SystemFonts.MessageBoxFont; _owner = owner ?? throw new ArgumentNullException("owner"); owner._monstersDialog = this; owner.Level.PropertyChanged += new PropertyChangedEventHandler(Level_PropertyChanged); listBox.DataSource = owner.Level.MonsterLocations; owner.Level.MonsterLocations.ListChanged += new ListChangedEventHandler(listBox_SelectedIndexChanged); UpdateTitle(); }
internal void UpdateCutCopyPasteFillEnabled(LevelMapEditor editor) { if (editor != null) { cutToolStripButton.Enabled = copyToolStripButton.Enabled = fillToolStripButton.Enabled = editorTool == EditorTool.Select && !editor.Selection.IsEmpty; pasteToolStripButton.Enabled = LevelMapEditor.CanPaste; } else { cutToolStripButton.Enabled = copyToolStripButton.Enabled = pasteToolStripButton.Enabled = fillToolStripButton.Enabled = false; } }
public LevelEditorTabPage(Form1 owner, Level level) : base() { _owner = owner; _level = level ?? throw new ArgumentNullException("level"); level.PropertyChanged += new PropertyChangedEventHandler(Level_PropertyChanged); _editor = new LevelMapEditor(owner, _level); _editor.MouseDown += new MouseEventHandler(Editor_MouseDown); _editor.MouseEnter += new EventHandler(Editor_MouseEnter); AutoScroll = true; Controls.Add(_editor); Name = Text = level.ToString(); }
public void OnMouseMove(LevelMapEditor editor, TileLocation location, MouseButtons mouseButtons, Keys modifierKeys) { switch (mouseButtons) { case MouseButtons.Left: OnLeftMouseButtonMove(editor, location, modifierKeys); break; case MouseButtons.Right: OnRightMouseButtonMove(editor, location, modifierKeys); break; default: break; } }
static bool InitializeLocations(LevelMapEditor editor, out TileLocation location, out TileLocation previous) { location = TileLocation.Invalid; previous = TileLocation.Invalid; if (editor.TileLocationHistory.Count > 0) { location = editor.TileLocationHistory[editor.TileLocationHistory.Count - 1]; if (editor.TileLocationHistory.Count > 1) { previous = editor.TileLocationHistory[editor.TileLocationHistory.Count - 2]; } } else { return(false); } return(true); }
protected override void OnLeftMouseButtonMove(LevelMapEditor editor, TileLocation location, Keys modifierKeys) { if (editor.LayerMode == LayerMode.LowerLayer) { modifierKeys |= Keys.Shift; } if (!InitializeLocations(editor, out TileLocation lastLocation, out TileLocation secondLastLocation)) { if (modifierKeys == Keys.Shift) { editor.SetLowerLayerTile(location, editor.LeftTile); } else { editor.SetUpperLayerTile(location, editor.LeftTile); } editor.TileLocationHistory.Add(location); return; } var tile = editor.LeftTile; var previousTile = Control.ModifierKeys == Keys.Shift ? editor.Level.LowerLayer[lastLocation] : editor.Level.UpperLayer[lastLocation]; UpdateTiles(location, ref tile, lastLocation, ref previousTile, secondLastLocation); editor.LeftTile = tile; if ((Control.ModifierKeys & Keys.Shift) == Keys.Shift || editor.LayerMode == LayerMode.LowerLayer) { editor.SetLowerLayerTile(lastLocation, previousTile); editor.SetLowerLayerTile(location, tile); } else { editor.SetUpperLayerTile(lastLocation, previousTile); editor.SetUpperLayerTile(location, tile); } editor.TileLocationHistory.Add(location); }
protected override void OnLeftMouseButtonDown(LevelMapEditor editor, TileLocation location, Keys modifierKeys) { editor.SetTrapConnection(location); }
protected override void OnLeftMouseButtonMove(LevelMapEditor editor, TileLocation location, Keys modifierKeys) { // Do nothing }
public override void Invalidate(LevelMapEditor editor) { editor.Invalidate(location); }
public abstract void Invalidate(LevelMapEditor editor);
protected virtual void OnLeftMouseButtonDown(LevelMapEditor editor, TileLocation location, Keys modifierKeys) { Default.OnLeftMouseButtonDown(editor, location, modifierKeys); }
public UndoRedoManager(LevelMapEditor owner) { this.Owner = owner; }
protected virtual void OnRightMouseButtonMove(LevelMapEditor editor, TileLocation location, Keys modifierKeys) { Default.OnRightMouseButtonMove(editor, location, modifierKeys); }
protected override void OnLeftMouseButtonMove(LevelMapEditor editor, TileLocation location, Keys modifierKeys) { editor.Selection = TileRectangle.FromLTRB(editor.Selection.Left, editor.Selection.Top, location.X, location.Y); }
protected override void OnLeftMouseButtonDown(LevelMapEditor editor, TileLocation location, Keys modifierKeys) { editor.Selection = (modifierKeys & Keys.Shift) == Keys.Shift ? TileRectangle.FromLTRB(editor.Selection.Left, editor.Selection.Top, location.X, location.Y) : new TileRectangle(location, 1, 1); }
public override void Invalidate(LevelMapEditor editor) { editor.Invalidate(Rectangle.Union(connection.Source.ToRectangle(editor.TileSize), connection.Destination.ToRectangle(editor.TileSize))); }