Exemple #1
0
        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();
                }
            }
        }