void DoPresetsDropDown()
        {
            var rect = GUILayoutUtility.GetRect(Styles.PresetContent, Styles.dropdown);

            if (EditorGUI.DropdownButton(rect, Styles.PresetContent, FocusType.Passive, Styles.dropdown))
            {
                if (PresetWindow.ShowAtPosition(rect))
                {
                    GUIUtility.ExitGUI();
                }
            }
        }
Esempio n. 2
0
        internal static bool ShowAtPosition(Rect buttonRect)
        {
            // We could not use realtimeSinceStartUp since it is set to 0 when entering/exitting playmode, we assume an increasing time when comparing time.
            long nowMilliSeconds = System.DateTime.Now.Ticks / System.TimeSpan.TicksPerMillisecond;
            bool justClosed      = nowMilliSeconds < s_LastClosedTime + 50;

            if (!justClosed)
            {
                Event.current.Use();
                if (s_PresetWindow == null)
                {
                    s_PresetWindow = CreateInstance <PresetWindow>();
                }
                s_PresetWindow.Init(buttonRect);
                return(true);
            }
            return(false);
        }
Esempio n. 3
0
 internal void OnDisable()
 {
     s_LastClosedTime = System.DateTime.Now.Ticks / System.TimeSpan.TicksPerMillisecond;
     s_PresetWindow   = null;
 }