Ejemplo n.º 1
0
        void Init(PresetType presetType, Preset currentSelection, bool createNewAllowed, PresetSelectorReceiver eventReceiver)
        {
            AssemblyReloadEvents.beforeAssemblyReload -= OnBeforeAssemblyReload;
            AssemblyReloadEvents.beforeAssemblyReload += OnBeforeAssemblyReload;
            m_ModalUndoGroup = Undo.GetCurrentGroup();

            // Freeze to prevent flicker on OSX.
            // Screen will be updated again when calling
            // SetFreezeDisplay(false) further down.
            ContainerWindow.SetFreezeDisplay(true);

            // Set member variables
            m_SearchField  = string.Empty;
            m_CanCreateNew = createNewAllowed;
            InitListArea();
            m_Presets = FindAllPresetsOfType(presetType);
            UpdateSearchResult(currentSelection != null ? currentSelection.GetInstanceID() : 0);

            m_EventObject = eventReceiver;

            ShowWithMode(ShowMode.AuxWindow);
            titleContent = EditorGUIUtility.TrTextContent("Select Preset");

            // Deal with window size
            Rect rect = m_Parent.window.position;

            rect.width  = EditorPrefs.GetFloat(k_PresetSelectorWidthEditorPref, 200);
            rect.height = EditorPrefs.GetFloat(k_PresetSelectorHeightEditorPref, 200);
            position    = rect;
            minSize     = new Vector2(kMinWidth, kMinTopSize + kPreviewExpandedAreaHeight + 2 * kPreviewMargin);
            maxSize     = new Vector2(500, 600);

            // Focus
            Focus();
            ContainerWindow.SetFreezeDisplay(false);

            // Add after unfreezing display because AuxWindowManager.cpp assumes that aux windows are added after we get 'got/lost'- focus calls.
            m_Parent.AddToAuxWindowList();


            SetSelectedPath(GetCurrentSelection());
        }
Ejemplo n.º 2
0
        private void Init(UnityEngine.Object target, Preset currentSelection, bool createNewAllowed, PresetSelectorReceiver eventReceiver)
        {
            this.m_ModalUndoGroup = Undo.GetCurrentGroup();
            ContainerWindow.SetFreezeDisplay(true);
            this.m_SearchField = string.Empty;
            this.m_MainTarget  = target;
            this.InitListArea();
            this.m_Presets = PresetSelector.FindAllPresetsForObject(target);
            this.UpdateSearchResult((!(currentSelection != null)) ? 0 : currentSelection.GetInstanceID());
            this.m_EventObject  = eventReceiver;
            this.m_CanCreateNew = createNewAllowed;
            base.ShowWithMode(ShowMode.AuxWindow);
            base.titleContent = EditorGUIUtility.TrTextContent("Select Preset", null, null);
            Rect position = this.m_Parent.window.position;

            position.width  = EditorPrefs.GetFloat("PresetSelectorWidth", 200f);
            position.height = EditorPrefs.GetFloat("PresetSelectorHeight", 390f);
            base.position   = position;
            base.minSize    = new Vector2(200f, 335f);
            base.maxSize    = new Vector2(10000f, 10000f);
            base.Focus();
            ContainerWindow.SetFreezeDisplay(false);
            this.m_Parent.AddToAuxWindowList();
        }
Ejemplo n.º 3
0
 void Init(Object target, Preset currentSelection, bool createNewAllowed, PresetSelectorReceiver eventReceiver)
 {
     m_MainTarget = target;
     Init(new PresetType(target), currentSelection, createNewAllowed, eventReceiver);
 }
Ejemplo n.º 4
0
 public static void ShowSelector(PresetType presetType, Preset currentSelection, bool createNewAllowed, PresetSelectorReceiver eventReceiver)
 {
     get.Init(presetType, currentSelection, createNewAllowed, eventReceiver);
 }
Ejemplo n.º 5
0
 public static void ShowSelector(Object target, Preset currentSelection, bool createNewAllowed, PresetSelectorReceiver eventReceiver)
 {
     get.Init(target, currentSelection, createNewAllowed, eventReceiver);
 }