示例#1
0
        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);
        }
示例#2
0
 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();
 }
示例#3
0
 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;
     }
 }
示例#4
0
 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();
 }
示例#5
0
        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;
            }
        }
示例#6
0
 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);
 }
示例#7
0
        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
 }
示例#10
0
 public override void Invalidate(LevelMapEditor editor)
 {
     editor.Invalidate(location);
 }
示例#11
0
 public abstract void Invalidate(LevelMapEditor editor);
示例#12
0
 protected virtual void OnLeftMouseButtonDown(LevelMapEditor editor, TileLocation location, Keys modifierKeys)
 {
     Default.OnLeftMouseButtonDown(editor, location, modifierKeys);
 }
示例#13
0
 public UndoRedoManager(LevelMapEditor owner)
 {
     this.Owner = owner;
 }
示例#14
0
 protected virtual void OnRightMouseButtonMove(LevelMapEditor editor, TileLocation location, Keys modifierKeys)
 {
     Default.OnRightMouseButtonMove(editor, location, modifierKeys);
 }
示例#15
0
 protected override void OnLeftMouseButtonMove(LevelMapEditor editor, TileLocation location, Keys modifierKeys)
 {
     editor.Selection = TileRectangle.FromLTRB(editor.Selection.Left, editor.Selection.Top, location.X, location.Y);
 }
示例#16
0
 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);
 }
示例#17
0
 public override void Invalidate(LevelMapEditor editor)
 {
     editor.Invalidate(Rectangle.Union(connection.Source.ToRectangle(editor.TileSize), connection.Destination.ToRectangle(editor.TileSize)));
 }