internal static void Show(EditorPopupContent windowContent) { if (_inst == null) { _inst = ScriptableObject.CreateInstance <EditorPopupHolderWindow>(); // _ShowAsDropDownFitToScreen = typeof(EditorWindow).GetMethod("ShowAsDropDownFitToScreen", BindingFlags.Instance | BindingFlags.NonPublic); } if (_inst._contents.Count == 0) { _coveredResolution = new Rect(0, 0, Screen.currentResolution.width, Screen.currentResolution.height); _bgWindows = Resources.FindObjectsOfTypeAll <EditorWindow>(); foreach (var window in _bgWindows) { // Debug.LogFormat("{0} {1}", window.GetType().Name, window.name); if (_inst == window) { continue; } _coveredResolution.xMin = Mathf.Min(_coveredResolution.xMin, window.position.xMin); _coveredResolution.yMin = Mathf.Min(_coveredResolution.yMin, window.position.yMin); _coveredResolution.xMax = Mathf.Max(_coveredResolution.xMax, window.position.xMax); _coveredResolution.yMax = Mathf.Max(_coveredResolution.yMax, window.position.yMax); } // Debug.Log(res); if (_texBuf == null || _texBuf.width != _coveredResolution.width || _texBuf.height != _coveredResolution.height) { _texBuf = new Texture2D((int)_coveredResolution.width, (int)_coveredResolution.height); _texBuf.hideFlags = HideFlags.DontSave; } var pixels = UnityEditorInternal.InternalEditorUtility.ReadScreenPixel(_coveredResolution.position, (int)_coveredResolution.width, (int)_coveredResolution.height); _texBuf.SetPixels(pixels); _texBuf.Apply(); // var rect = new Rect(0, 0, res.width, res.height); var rect = _coveredResolution; // rect.position = GUIUtility.GUIToScreenPoint(rect.position); _inst.minSize = new Vector2(rect.width, rect.height); _inst.maxSize = new Vector2(rect.width, rect.height); _inst.position = rect; } // _inst.ShowPopup(); _inst.Add(windowContent); if (focusedWindow != _inst) { _inst.Focus(); } GUIUtility.ExitGUI(); }
public void Close() { EditorPopupHolderWindow.Close(this); }
protected void Repaint() { EditorPopupHolderWindow.RepaintInst(); }
public void Show(Rect activatorRect) { _activatorRect = activatorRect; EditorPopupHolderWindow.Show(this); }