Example #1
0
        internal static bool ShowCenteredAtPosition(Rect buttonRect)
        {
            buttonRect.x -= kWindowWidth / 2;
            // 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)
            {
                // Method may have been triggered programmatically, without a user event to consume.
                if (Event.current.type != EventType.Layout)
                {
                    Event.current.Use();
                }
                if (s_CollabToolbarWindow == null)
                {
                    s_CollabToolbarWindow = CreateInstance <CollabToolbarWindow>() as CollabToolbarWindow;
                }
                var windowSize = new Vector2(kWindowWidth, kWindowHeight);
                s_CollabToolbarWindow.initialOpenUrl = "file:///" + EditorApplication.userJavascriptPackagesPath + "unityeditor-collab-toolbar/dist/index.html";
                s_CollabToolbarWindow.Init();
                s_CollabToolbarWindow.ShowAsDropDown(buttonRect, windowSize);
                s_CollabToolbarWindow.OnFocus();
                return(true);
            }
            return(false);
        }
Example #2
0
        public static bool ShowCenteredAtPosition(Rect buttonRect)
        {
            buttonRect.x -= kWindowWidth / 2;
            // 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 = DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond;
            bool justClosed      = nowMilliSeconds < s_LastClosedTime + 50;

            if (!justClosed)
            {
                // Method may have been triggered programmatically, without a user event to consume.
                if (Event.current.type != EventType.Layout)
                {
                    Event.current.Use();
                }
                if (s_CollabToolbarWindow == null)
                {
                    s_CollabToolbarWindow = CreateInstance <CollabToolbarWindow>();
                }
                var windowSize = new Vector2(kWindowWidth, kWindowHeight);
                s_CollabToolbarWindow.initialOpenUrl =
                    "file:///" + Path.GetFullPath(k_ToolbarPath.Replace("/", Path.DirectorySeparatorChar.ToString()));
                s_CollabToolbarWindow.Init();
                s_CollabToolbarWindow.ShowAsDropDown(buttonRect, windowSize);
                s_CollabToolbarWindow.OnFocus();
                return(true);
            }
            return(false);
        }