public static void Popup() { window = EditorWindow.GetWindow(typeof(MainWindow), true, "多重窗口编辑器") as MainWindow; window.minSize = minResolution; window.Init(); EditorWindowMgr.AddEditorWindow(window); window.Show(); }
public static void Popup(Vector3 position) { // RepeateWindow window = new RepeateWindow(); RepeateWindow window = GetWindowWithRectPrivate(typeof(RepeateWindow), leftUpRect, true, "重复弹出窗口") as RepeateWindow; window.minSize = minResolution; //要在设置位置之前,先把窗体注册到管理器中,以便更新窗体的优先级 EditorWindowMgr.AddRepeateWindow(window); //刷新界面偏移量 int offset = (window.Priority - 10) * 30; window.position = new Rect(new Vector2(position.x + offset, position.y + offset), new Vector2(800, 400)); window.Show(); //手动聚焦 window.Focus(); }
private void OnDestroy() { //销毁窗体的时候,从管理器中移除该窗体的缓存,并且重新刷新焦点 EditorWindowMgr.RemoveRepeateWindow(this); EditorWindowMgr.FoucusWindow(); }
private void OnFocus() { EditorWindowMgr.FoucusWindow(); }
private void OnFocus() { //重写OnFocus方法,让EditorWindowMgr去自动排序汇聚焦点 EditorWindowMgr.FoucusWindow(); }
private void OnDestroy() { //主界面销毁的时候,附带销毁创建出来的子界面 EditorWindowMgr.RemoveEditorWindow(window); EditorWindowMgr.DestoryAllWindow(); }