Exemplo n.º 1
0
 public int DeleteCourse(int index)
 {
     if (!Editors[index].IsDisposed)
     {
         Editors[index].Close();
     }
     Editors.RemoveAt(index);
     Program.Project.Courses.RemoveAt(index);
     return(index);
 }
Exemplo n.º 2
0
        public void UpdateListFromOffsets()
        {
            if (SequenceEditor.EditorDragged == null)
            {
                return;
            }

            int currentIndex = SequenceEditor.EditorDragged.Obj.GetId();
            int newIndex     = currentIndex;

            for (int i = 0; i != Editors.Count; ++i)
            {
                if (i == currentIndex)
                {
                    continue;
                }

                if (_editors[i].Offset.target.y > 0)
                {
                    --newIndex;
                }
                else if (_editors[i].Offset.target.y < 0)
                {
                    ++newIndex;
                }
            }

            if (newIndex != currentIndex)
            {
                string undoText = "reorder";

                Undo.SetTransformParent(SequenceEditor.EditorDragged.Obj.transform, ContentTransform, undoText);
                SequenceEditor.EditorDragged.Obj.transform.SetSiblingIndex(newIndex);

                Editors.RemoveAt(currentIndex);
                Editors.Insert(newIndex, (T)SequenceEditor.EditorDragged);
            }
        }