Beispiel #1
0
 /// <summary>
 /// 绘制编辑器界面
 /// </summary>
 private void ShowEditorGUI()
 {
     GUILayout.BeginArea(middleCenterRect);
     GUILayout.BeginVertical();
     EditorGUILayout.LabelField("点击下面的按钮创建重复弹出窗口", labelStyle, GUILayout.Width(220));
     if (GUILayout.Button("创建窗口", GUILayout.Width(80)))
     {
         RepeateWindow.Popup(window.position.position);
     }
     GUILayout.EndVertical();
     GUILayout.EndArea();
 }
Beispiel #2
0
    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();
    }