Ejemplo n.º 1
0
    void OnGUI()
    {
        MapEditTool.GUILabelType();

        GUILayout.Label("场景地图选择");

        MapEditTool.GUILabelType(TextAnchor.UpperLeft);

        GUILayout.Label("当前的场景为 :" + EditorSceneManager.GetActiveScene().name);

        map = MapEditTool.GUIobject_CaneditArea("加载地形文件", map, true, LoadMap);

        GUILayout.Space(2);
        MapEditTool.CreateSplit();

        if (showVertexs && map != null)
        {
            ShowVertexs();
        }

        if (showAddLines)
        {
            ShowAddLines();
        }

        if (lineList.Count > 0)
        {
            ShowOutput();
        }

        test();
    }
Ejemplo n.º 2
0
    private void test()
    {
        MapEditTool.CreateSplit();

        MapEditTool.GUILabelType();

        GUILayout.Label("仅测试:导出数据读取并生成网格");

        MapEditTool.GUILabelType(TextAnchor.UpperLeft);

        if (GUILayout.Button("逆向生成区域块"))
        {
            ReverseCreateBlock();
        }

        if (GUILayout.Button("读取并生成"))
        {
            ReadAndCreate();
        }

        if (GUILayout.Button("清除所有生成面片"))
        {
            ClearAllMesh();
        }
    }
Ejemplo n.º 3
0
    private void ShowVertexs()
    {
        MapEditTool.GUILabelType();

        GUILayout.Label("场景地图顶点生成");

        MapEditTool.GUILabelType(TextAnchor.UpperLeft);

        GUILayout.BeginHorizontal();

        GUILayout.Label("顶点材质");

        material = (Material)EditorGUILayout.ObjectField(material, typeof(Material), false);

        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();

        GUILayout.Label("顶点大小");

        vertexSize = EditorGUILayout.FloatField(vertexSize, GUILayout.Width(100));

        GUILayout.EndHorizontal();

        if (GUILayout.Button("生成网点"))
        {
            GenVertex();
        }

        MapEditTool.CreateSplit();
    }
Ejemplo n.º 4
0
    private void ShowAddLines()
    {
        MapEditTool.GUILabelType();

        GUILayout.Label("场景地图分割");

        MapEditTool.GUILabelType(TextAnchor.UpperLeft);

        GUILayout.BeginHorizontal();

        GUILayout.Label("网线颜色");

        lineColor = EditorGUILayout.ColorField(lineColor, GUILayout.Width(100));

        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();

        GUILayout.Label("网线粗细");

        lineSize = EditorGUILayout.FloatField(lineSize, GUILayout.Width(100));

        GUILayout.EndHorizontal();

        if (lineList.Count > 0 && GUILayout.Button("撤销上次连线区域块"))
        {
            ClearLastBlock();
        }

        if (lineList.Count > 0 && GUILayout.Button("清除所有连线区域块"))
        {
            ClearAllBlocks();
        }


        GUIStyle labelstyle = new GUIStyle();

        labelstyle.alignment        = TextAnchor.UpperLeft;
        labelstyle.fontSize         = 14;
        labelstyle.normal.textColor = Color.red;

        GUILayout.Label("Tips: 请顺时针编辑节点!", labelstyle);

        //开始检查是否有修改
        EditorGUI.BeginChangeCheck();

        //显示属性
        //第二个参数必须为true,否则无法显示子节点即List内容
        EditorGUILayout.PropertyField(_lineVerticesProperty, true);

        //结束检查是否有修改
        if (EditorGUI.EndChangeCheck())
        {//提交修改
            _serializedObject.ApplyModifiedProperties();
        }

        if (GUILayout.Button("添加选中顶点"))
        {
            AddLineVertexs();
        }

        if (lineVertices.Count > 3 && GUILayout.Button("生成区域块"))
        {
            CreateBlock();
        }

        MapEditTool.CreateSplit();
    }