internal static bool ShowAtPosition(Rect buttonRect, bool isGameView) { // 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_AnnotationWindow == null) { s_AnnotationWindow = ScriptableObject.CreateInstance <AnnotationWindow>(); } else { // We are treating AnnotationWindow like a PopupWindow which has logic to reclose it when opened, // AuxWindows derived from EditorWindow reset/reopen when repeatedly clicking the open button by design. // Call Cancel() here if it is already open. s_AnnotationWindow.Cancel(); return(false); } s_AnnotationWindow.Init(buttonRect, isGameView); return(true); } return(false); }
internal static bool ShowAtPosition(Rect buttonRect, bool isGameView) { // 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_AnnotationWindow == null) { s_AnnotationWindow = ScriptableObject.CreateInstance <AnnotationWindow>(); } s_AnnotationWindow.Init(buttonRect, isGameView); return(true); } return(false); }