Пример #1
0
        //CONTEXT
        void DoClipContextMenu()
        {
            var menu = new GenericMenu();

            if (multiSelection != null && multiSelection.Contains(this))
            {
                menu.AddItem(new GUIContent("Delete Clips"), false, () =>
                {
                    editor.SafeDoAction(() =>
                    {
                        foreach (var act in multiSelection.Select(b => b.action).ToArray())
                        {
                            (act.parent as Track).DeleteClip(act);
                        }
                        editor.InitClipWrappers();
                        multiSelection = null;
                    });
                });

                menu.ShowAsContext();
                e.Use();
                return;
            }


            menu.AddItem(new GUIContent("Copy Clip"), false, () =>
            {
                editor.SafeDoAction(() => { CutsceneUtility.CopyClip(action); });
            });

            var clips = action.parent.clips.FindAll((t) => { return(t.startTime == action.startTime && t.length <= action.length); });

            if (clips != null && clips.Count > 1)
            {
                int index = 0;
                foreach (var clip in clips)
                {
                    menu.AddItem(new GUIContent("重叠的clip/" + clip.name + "  " + index), false, () =>
                    {
                        CutsceneUtility.selectedObject = clip;
                    });
                    index++;
                }
            }

            menu.AddSeparator("/");

            menu.AddItem(new GUIContent("Delete Clip"), false, () =>
            {
                editor.SafeDoAction(() => { (action.parent as Track).DeleteClip(action); editor.InitClipWrappers(); });
            });

            menu.ShowAsContext();
            e.Use();
        }