Exemplo n.º 1
0
        void OnRecordContextMenu(RecorderItem recorder)
        {
            var contextMenu = new GenericMenu();

            if (ShouldDisableRecordSettings())
            {
                contextMenu.AddDisabledItem(Styles.DuplicateLabel);
                contextMenu.AddDisabledItem(Styles.DeleteLabel);
            }
            else
            {
                contextMenu.AddItem(Styles.DuplicateLabel, false,
                                    data =>
                {
                    DuplicateRecorder((RecorderItem)data);
                }, recorder);

                contextMenu.AddItem(Styles.DeleteLabel, false,
                                    data =>
                {
                    DeleteRecorder((RecorderItem)data, true);
                }, recorder);
            }

            contextMenu.ShowAsContext();
        }
Exemplo n.º 2
0
        void DuplicateRecorder(RecorderItem item)
        {
            var candidate = item.settings;
            var copy      = Instantiate(candidate);

            copy.OnAfterDuplicate();
            AddLastAndSelect(copy, candidate.name, candidate.Enabled);
        }
Exemplo n.º 3
0
        void DeleteRecorder(RecorderItem item)
        {
            var s = item.settings;

            m_ControllerSettings.RemoveRecorder(s);
            UnityHelpers.Destroy(item.editor, true);
            m_RecordingListItem.Remove(item);
        }
Exemplo n.º 4
0
        void OnRecordSelectionChanged()
        {
            m_SelectedRecorderItem = m_RecordingListItem.selection;

            foreach (var r in m_RecordingListItem.items)
            {
                r.SetItemSelected(m_SelectedRecorderItem == r);
            }

            if (m_SelectedRecorderItem != null)
            {
                UIElementHelper.SetDirty(m_RecorderSettingPanel);
            }

            Repaint();
        }
Exemplo n.º 5
0
        void OnRecordSelectionChanged()
        {
            m_SelectedRecorderItem = m_RecordingListItem.selection;

            foreach (var r in m_RecordingListItem.items)
            {
                r.SetItemSelected(m_SelectedRecorderItem == r);
            }

            if (m_SelectedRecorderItem != null)
            {
                m_RecorderSettingPanel.Dirty(ChangeType.Layout | ChangeType.Styles);
            }

            Repaint();
        }
Exemplo n.º 6
0
        void DeleteRecorder(RecorderItem item, bool prompt)
        {
            if (!prompt || EditorUtility.DisplayDialog("Delete Recoder?",
                                                       "Are you sure you want to delete '" + item.settings.name + "' ?", "Delete", "Cancel"))
            {
                var s = item.settings;
                m_ControllerSettings.RemoveRecorder(s);
                UnityHelpers.Destroy(s, true);
                UnityHelpers.Destroy(item.editor, true);
                m_RecordingListItem.Remove(item);
            }

            if (prompt)
            {
                Focus();
            }
        }
Exemplo n.º 7
0
        RecorderItem CreateRecorderItem(RecorderSettings recorderSettings)
        {
            var info = RecordersInventory.GetRecorderInfo(recorderSettings.GetType());

            var hasError = info == null;

            var recorderItem = new RecorderItem(m_ControllerSettings, recorderSettings, hasError ? null : info.iconName);

            recorderItem.OnEnableStateChanged += enabled =>
            {
                if (enabled)
                {
                    m_RecordingListItem.selection = recorderItem;
                }
            };

            if (hasError)
            {
                recorderItem.state = RecorderItem.State.HasErrors;
            }

            return(recorderItem);
        }