Example #1
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            EditorGUILayout.Slider(mergeIntersectionThresholdProp, 0.1f, 100f, new GUIContent("交叉口焊接阈值"));
            EditorGUILayout.Slider(removeDoubleThresholdProp, 0.1f, 100f, new GUIContent("冗余点焊接阈值"));
            EditorGUILayout.Slider(laneWidthProp, 0.1f, 100f, new GUIContent("车道宽度"));
            EditorGUILayout.Slider(sectionLengthProp, 0.1f, 100f, new GUIContent("段长度"));

            EditorGUILayout.ObjectField(builderNodeMeshProp, typeof(Mesh));

            if (BuilderData.Data.builderNodes.Count == 0)
            {
                if (GUILayout.Button("创建根节点"))
                {
                    Selection.activeGameObject = BuilderCore.CreateRootNode(Vector3.zero).gameObject;
                }
            }
//			if (GUILayout.Button ("刷新贝塞尔曲线")) {
//				BuilderCore.RefreshBezierSegment ();
//			}
            if (GUILayout.Button("整理冗余点和交叉口"))
            {
                for (int i = 0; i < BuilderData.Data.lineSetMap.Count; i++)
                {
                    BuilderCore.MergeIntersection();
                    BuilderCore.RemoveDouble();
                }
                BuilderCore.RefreshSectionNodes();
            }
            if (GUILayout.Button("加载数据库文件"))
            {
                BuilderCore.Load();
            }
            if (GUILayout.Button("保存至数据库"))
            {
                BuilderCore.Save();
            }

            serializedObject.ApplyModifiedProperties();
        }
Example #2
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();
            base.OnInspectorGUI();
            Transform[] selectedObjs = Selection.transforms;
            if (GUILayout.Button("挤出"))
            {
                Selection.activeGameObject = ((BuilderNode)serializedObject.targetObject).Extrude();
            }
            if (GUILayout.Button("删除"))
            {
                BuilderCore.DeleteNode((BuilderNode)serializedObject.targetObject);
                Selection.activeObject = BuilderData.Data.gameObject;
                return;
            }
            if (selectedObjs.Length == 2 && selectedObjs [0].GetComponent <BuilderNode> () != null &&
                selectedObjs [1].GetComponent <BuilderNode> () != null)
            {
                if (GUILayout.Button("连接"))
                {
                    BuilderCore.LinkNode(Selection.transforms [0].GetComponent <BuilderNode> ().builderNodeId,
                                         Selection.transforms [1].GetComponent <BuilderNode> ().builderNodeId);
                }
                if (GUILayout.Button("断开"))
                {
                    BuilderCore.BreakLink(Selection.transforms [0].GetComponent <BuilderNode> ().builderNodeId,
                                          Selection.transforms [1].GetComponent <BuilderNode> ().builderNodeId);
                }
            }
            if (GUILayout.Button("整理冗余点和交叉口"))
            {
                for (int i = 0; i < BuilderData.Data.lineSetMap.Count; i++)
                {
                    BuilderCore.MergeIntersection();
                    BuilderCore.RemoveDouble();
                }
                BuilderCore.RefreshSectionNodes();
            }

            serializedObject.ApplyModifiedProperties();
        }