public static void SetFromClipboardTemp(int x1, int y1, int x2, int y2) { if (Editor.Scenes.Clipboard.types != null) { Editor.Scenes.Temp.types = Editor.activeTypeGroup.types.ToArray(); Editor.Scenes.Temp.width = Editor.activeTypeGroup.width; Editor.Scenes.Temp.height = Editor.activeTypeGroup.height; int selWidth = x2 - x1; var clip = Editor.Scenes.Clipboard; for (int y = 0; y < y2 - y1; y++) { for (int x = 0; x < x2 - x1; x++) { var type = clip.GetType(Func.Wrap(x, 0, clip.width), Func.Wrap(y, 0, clip.height)); if (type.graphic.X != 0 || type.graphic.Y != 0 || type.collision != Collisions.none) { Editor.activeTypeGroup.types[(x + x1) + ((y + y1) * Editor.activeTypeGroup.width)] = type; } } } Editor.Refresh(); Editor.activeTypeGroup.types = Editor.Scenes.Temp.types.ToArray(); Editor.activeTypeGroup.width = Editor.Scenes.Temp.width; Editor.activeTypeGroup.height = Editor.Scenes.Temp.height; } }
void button_replace_click(object sender, RoutedEventArgs e) { var replaceWindow = new Replace(); replaceWindow.ShowDialog(); Editor.Refresh(); }
public static void SetCollision(Collisions type, int x1, int y1, int x2, int y2) { Editor.undo = Editor.activeTypeGroup.types.ToArray(); for (int y = y1; y < y2; y++) { for (int x = x1; x < x2; x++) { Editor.activeTypeGroup.types[x + (y * Editor.activeTypeGroup.width)].collision = type; } } Editor.Refresh(); }
public static void BlankOut(int x1, int y1, int x2, int y2) { Editor.undo = Editor.activeTypeGroup.types.ToArray(); int selWidth = x2 - x1; var clip = Editor.Scenes.Clipboard; for (int y = 0; y < y2 - y1; y++) { for (int x = 0; x < x2 - x1; x++) { Editor.activeTypeGroup.types[(x + x1) + ((y + y1) * Editor.activeTypeGroup.width)] = new Type(); } } Editor.Refresh(); }
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(); } } }