void objectsList_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (objectsList.SelectedIndex > -1) { Event.DeselectAll(); Editor.Scenes.Level.events[objectsList.SelectedIndex].selected = true; Editor.selectedEventsCount = 1; Editor.RefreshObjectInfo(); RefreshEvents(); } }
public static void Select(int x1, int y1, int x2, int y2) { x1 -= 6; y1 -= 6; x2 += 6; y2 += 6; foreach (Event e in Editor.activeTypeGroup.events) { if (!Input.CTRL) { e.selected = false; } if (e.position.X > x1 && e.position.X < x2 && e.position.Y > y1 && e.position.Y < y2) { e.selected = true; } } Editor.RefreshObjectInfo(); Editor.mainWindow.RefreshEvents(); }
public static void Changed() { if (CTRL && Z) { if (Editor.undo != null) { Type[] undoHold = Editor.activeTypeGroup.types.ToArray(); Editor.activeTypeGroup.types = Editor.undo; Editor.undo = undoHold; Editor.Refresh(); } } if (MouseLeft && !Editor.selectingRight) { Editor.selectingLeft = true; Editor.SelectingLeft(); Editor.hasSelection = false; } if (MouseRight && !Editor.selectingLeft) { Editor.selectingRight = true; Editor.SelectingRight(); Editor.hasSelection = false; } if (Editor.hasSelection) { if (DEL) { Type.BlankOut(Editor.sel1.X / 16, Editor.sel1.Y / 16, Editor.sel2.X / 16, Editor.sel2.Y / 16); } if (CTRL && C) { Type.Copy(Editor.sel1.X / 16, Editor.sel1.Y / 16, Editor.sel2.X / 16, Editor.sel2.Y / 16); } if (CTRL && X) { Type.Copy(Editor.sel1.X / 16, Editor.sel1.Y / 16, Editor.sel2.X / 16, Editor.sel2.Y / 16); Type.BlankOut(Editor.sel1.X / 16, Editor.sel1.Y / 16, Editor.sel2.X / 16, Editor.sel2.Y / 16); } } if (Editor.selectedEventsCount > 0) { foreach (Event e in Editor.Scenes.Level.events) { if (e.selected && (UP || DOWN || LEFT || RIGHT)) { if (UP) { e.position.Y -= 1; } if (DOWN) { e.position.Y += 1; } if (LEFT) { e.position.X -= 1; } if (RIGHT) { e.position.X += 1; } Editor.mainWindow.RefreshEvents(); Editor.RefreshObjectInfo(); } } } if (Editor.selectedEventsCount > 0) { if (DEL) { int i = 0; while (i < Editor.Scenes.Level.events.Count) { Event e = Editor.Scenes.Level.events[i]; if (e.selected) { Editor.Scenes.Level.events.RemoveAt(e.ID); foreach (Event eu in Editor.Scenes.Level.events) { if (eu.ID > e.ID) { eu.ID--; } } } else { i++; } } Editor.selectedEventsCount = 0; Editor.selectedEvent = null; Editor.RefreshObjectsList(); Editor.ClearObjectInfo(); Editor.mainWindow.RefreshEvents(); } } }