Exemple #1
0
 void OnGUI()
 {
     vo.name  = EditorGUILayout.TextField("名 称", vo.name);
     vo.color = EditorGUILayout.ColorField("颜 色", vo.color);
     vo.type  = EditorGUILayout.IntField("类 型", vo.type);
     vo.data  = EditorGUILayout.TextField("数 据", vo.data);
     if (GUILayout.Button("确 定"))
     {
         if (mod == 0)
         {
             vo.id = Coord2D.maxBrushIndex++;
             Coord2D.AddBrush(Output());
             CoordEditor.UpdateBrushOptions();
         }
         else
         {
             CoordEditor.UpdateBrushOptions();
         }
         Coord2D.SaveBrushInfo();
         this.Close();
     }
 }
Exemple #2
0
        public override void OnInspectorGUI()
        {
            Coord2D coord = (Coord2D)target;

            coord.UpdateTransform();
            coord.UpdateRotation();

            coord.position = EditorGUILayout.Vector3Field("位 置", coord.position);
            //coord.size = EditorGUILayout.Vector2Field("尺 寸", coord.size);
            coord.alpha = EditorGUILayout.Slider("透明度", coord.alpha, 0.0f, 1.0f);

            if (NGUIEditorTools.DrawHeader("单 元 格 设 定"))
            {
                NGUIEditorTools.BeginContents();
                GUILayout.BeginVertical();

                coord.gridSize     = EditorGUILayout.FloatField("尺 寸", coord.gridSize);
                coord.gridAngel    = EditorGUILayout.FloatField("角 度", coord.gridAngel);
                coord.gridRotation = EditorGUILayout.FloatField("旋 转", coord.gridRotation);
                coord.gridArea     = EditorGUILayout.FloatField("范 围", coord.gridArea);

                GUILayout.EndVertical();
                NGUIEditorTools.EndContents();
            }

            if (NGUIEditorTools.DrawHeader("地 形 绘 制"))
            {
                NGUIEditorTools.BeginContents();

                GUILayout.BeginVertical();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PrefixLabel("选择笔刷");

                Coord2D.curBrushIndex = EditorGUILayout.Popup(Coord2D.curBrushIndex, options);

                EditorGUILayout.ColorField(Coord2D.curBrush.color);
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.BeginHorizontal();
                if (GUILayout.Button("新 增"))
                {
                    BrushWindow window = BrushWindow.GetInstance();
                    window.title = "新增笔刷";
                    window.mod   = 0;
                    window.Input(new BrushVo());
                    window.ShowPopup();
                }
                if (GUILayout.Button("编 辑"))
                {
                    BrushWindow window = BrushWindow.GetInstance();
                    window.title = "编辑笔刷";
                    window.mod   = 1;
                    window.Input(Coord2D.curBrush);
                    window.ShowPopup();
                }
                if (GUILayout.Button("删 除"))
                {
                    Coord2D.DelBrush();
                    UpdateBrushOptions();
                    Coord2D.SaveBrushInfo();
                }
                EditorGUILayout.EndHorizontal();

                GUILayout.EndVertical();

                NGUIEditorTools.EndContents();
            }

            EditorGUILayout.LabelField("场景视图按Q键进入拖动状态:");
            EditorGUILayout.LabelField("【单击鼠标左键编辑地形】【单击鼠标右键编辑事件】【再次单击取消】");

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("清空地形数据"))
            {
                if (EditorUtility.DisplayDialog("清空地形数据", "确定清空全部地形数据吗?(该操作不可撤销!!)", "确定", "取消"))
                {
                    coord.ClearTerrain();
                }
            }

            if (GUILayout.Button("清空事件数据"))
            {
                if (EditorUtility.DisplayDialog("清空事件数据", "确定清空全部事件数据吗?(该操作不可撤销!!)", "确定", "取消"))
                {
                    coord.ClearTerrain();
                }
            }
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.Space();

            coord.udata = EditorGUILayout.TextField("用户数据", coord.udata);

            if (coord.needSaveTerrain)
            {
                if (GUILayout.Button("保存场景"))
                {
                    coord.SaveTerrain();
                    EditorApplication.SaveScene();
                }
            }
        }