void OnGUI()
    {
        scrollVec2 = EditorGUILayout.BeginScrollView(scrollVec2, GUILayout.Width(position.width), GUILayout.Height(position.height));

        #region 打开网页
        EditorGUILayout.BeginHorizontal("MeTransitionHead");
        if (GUILayout.Button("访问CSDN博客", "toolbarbutton"))
        {
            Help.BrowseURL(@"http://blog.csdn.net/qq992817263/article/details/51579913");
        }
        if (GUILayout.Button("访问github项目", "toolbarbutton"))
        {
            Help.BrowseURL(@"https://github.com/coding2233/MeshEditor");
        }
        EditorGUILayout.EndHorizontal();
        #endregion

        #region 当前编辑目标
        EditorGUILayout.BeginHorizontal("HelpBox");
        GUILayout.Label("当前编辑目标:");
        if (target != null)
        {
            targetName = target.name;
            if (GUILayout.Button(targetName, GUILayout.Width(200)))
            {
                EditorApplication.delayCall += SelectTarget;
            }
        }
        else
        {
            GUILayout.Label("无", "ErrorLabel");
            GUILayout.FlexibleSpace();
        }
        EditorGUILayout.EndHorizontal();
        #endregion

        #region 目标克隆体
        EditorGUILayout.BeginHorizontal("HelpBox");
        GUILayout.Label("目标克隆体:");
        if (targetClone != null)
        {
            targetCloneName = targetClone.name;
            if (GUILayout.Button(targetCloneName, GUILayout.Width(200)))
            {
                EditorApplication.delayCall += SelectTargetClone;
            }
        }
        else
        {
            GUILayout.Label("无", "ErrorLabel");
            GUILayout.FlexibleSpace();
        }
        EditorGUILayout.EndHorizontal();
        #endregion

        #region 顶点大小
        EditorGUILayout.BeginHorizontal("HelpBox");
        GUILayout.Label("顶点大小:");
        if (target != null && editMeshVertexSenior != null)
        {
            vertexSize = GUILayout.HorizontalSlider(vertexSize, 0, 1);
            if (vertexSize != oldVertexSize)
            {
                editMeshVertexSenior._VertexSize = oldVertexSize = vertexSize;
                editMeshVertexSenior.RefishVertexSize();
            }
        }
        else
        {
            GUILayout.Label("无", "ErrorLabel");
            GUILayout.FlexibleSpace();
        }
        EditorGUILayout.EndHorizontal();
        #endregion

        #region 顶点数量
        EditorGUILayout.BeginHorizontal("HelpBox");
        GUILayout.Label("顶点数量:");
        if (target != null && editMeshVertexSenior != null)
        {
            GUILayout.Label(editMeshVertexSenior._VertexNumber.ToString());
        }
        else
        {
            GUILayout.Label("无", "ErrorLabel");
            GUILayout.FlexibleSpace();
        }
        EditorGUILayout.EndHorizontal();
        #endregion

        #region 创建、删除
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("创建顶点", "LargeButtonLeft"))
        {
            EditorApplication.delayCall += AddVertex;
        }
        if (GUILayout.Button("删除顶点", "LargeButtonRight"))
        {
            EditorApplication.delayCall += DeleteVertex;
        }
        EditorGUILayout.EndHorizontal();
        #endregion

        #region 相交、镜像
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("相交位移", "LargeButtonLeft"))
        {
            EditorApplication.delayCall += IntersectionDisplacement;
        }
        if (GUILayout.Button("镜像位移", "LargeButtonRight"))
        {
            EditorApplication.delayCall += MirrorDisplacement;
        }
        EditorGUILayout.EndHorizontal();
        #endregion

        #region 两点塌陷、多点塌陷
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("两点塌陷", "LargeButtonLeft"))
        {
            EditorApplication.delayCall += CollapseOnTwoVertex;
        }
        if (GUILayout.Button("多点塌陷", "LargeButtonRight"))
        {
            EditorApplication.delayCall += CollapseOnMoreVertex;
        }
        EditorGUILayout.EndHorizontal();
        #endregion

        #region 取消编辑
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("取消编辑", "LargeButton"))
        {
            EditorApplication.delayCall += CancelEditor;
        }
        EditorGUILayout.EndHorizontal();
        #endregion

        #region 编辑完成
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("编辑完成", "LargeButton"))
        {
            EditorApplication.delayCall += Finish;
        }
        EditorGUILayout.EndHorizontal();
        #endregion

        EditorGUILayout.EndScrollView();
    }
示例#2
0
    void OnGUI()
    {
        scrollVec2 = EditorGUILayout.BeginScrollView(scrollVec2, GUILayout.Width(position.width), GUILayout.Height(position.height));

        #region 当前编辑目标
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("当前编辑目标:");
        if (target != null)
        {
            targetName = target.name;
            if (GUILayout.Button(targetName))
            {
                EditorApplication.delayCall += SelectTarget;
            }
        }
        else
        {
            GUILayout.Label("无");
        }
        EditorGUILayout.EndHorizontal();
        #endregion

        #region 目标克隆体
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("目标克隆体:");
        if (targetClone != null)
        {
            targetCloneName = targetClone.name;
            if (GUILayout.Button(targetCloneName))
            {
                EditorApplication.delayCall += SelectTargetClone;
            }
        }
        else
        {
            GUILayout.Label("无");
        }
        EditorGUILayout.EndHorizontal();
        #endregion

        #region 顶点大小
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("顶点大小:");
        if (target != null && editMeshVertexSenior != null)
        {
            vertexSize = GUILayout.HorizontalSlider(vertexSize, 0, 1);
            if (vertexSize != oldVertexSize)
            {
                editMeshVertexSenior._VertexSize = oldVertexSize = vertexSize;
                editMeshVertexSenior.RefishVertexSize();
            }
        }
        else
        {
            GUILayout.Label("无");
        }
        EditorGUILayout.EndHorizontal();
        #endregion

        #region 顶点数量
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label("顶点数量:");
        if (target != null && editMeshVertexSenior != null)
        {
            GUILayout.Label(editMeshVertexSenior._VertexNumber.ToString());
        }
        else
        {
            GUILayout.Label("无");
        }
        EditorGUILayout.EndHorizontal();
        #endregion

        #region 创建、删除
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("创建顶点"))
        {
            EditorApplication.delayCall += AddVertex;
        }
        if (GUILayout.Button("删除顶点"))
        {
            EditorApplication.delayCall += DeleteVertex;
        }
        EditorGUILayout.EndHorizontal();
        #endregion

        #region 相交、镜像
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("相交位移"))
        {
            EditorApplication.delayCall += IntersectionDisplacement;
        }
        if (GUILayout.Button("镜像位移"))
        {
            EditorApplication.delayCall += MirrorDisplacement;
        }
        EditorGUILayout.EndHorizontal();
        #endregion

        #region 两点塌陷、多点塌陷
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("两点塌陷"))
        {
            EditorApplication.delayCall += CollapseOnTwoVertex;
        }
        if (GUILayout.Button("多点塌陷"))
        {
            EditorApplication.delayCall += CollapseOnMoreVertex;
        }
        EditorGUILayout.EndHorizontal();
        #endregion

        #region 编辑完成
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("编辑完成"))
        {
            EditorApplication.delayCall += Finish;
        }
        EditorGUILayout.EndHorizontal();
        #endregion

        EditorGUILayout.EndScrollView();
    }