Exemplo n.º 1
0
        protected override void CustomOnGUI()
        {
            EditorUIHelper.BeginChangeCheck();
            {
                _selectedIndex = EditorUIHelper.Popup("类型:", _selectedIndex, AssetImporterTypeStrs);
            }
            if (EditorUIHelper.EndChangeCheck())
            {
                ClearData();
            }

            var op = Operator;

            if (op != null)
            {
                EditorUIHelper.Space();
                EditorUIHelper.BeginHorizontal();
                {
                    _showTypeIndex = EditorUIHelper.Toolbar(_showTypeIndex, _showTypes);
                }
                EditorUIHelper.EndHorizontal();

                EditorUIHelper.Space();
                EditorUIHelper.BeginChangeCheck();
                {
                    _searchText = EditorUIHelper.SearchCancelTextField(_searchText);
                }
                if (EditorUIHelper.EndChangeCheck())
                {
                    ClearData();
                }

                EditorUIHelper.Space();
                _showTypeScroll = EditorUIHelper.BeginScrollView(_showTypeScroll);
                {
                    ShowTypePanel();
                }
                EditorUIHelper.EndScrollView();
            }
        }
Exemplo n.º 2
0
        protected override void CustomOnGUI()
        {
            _curAnalyzerIndex = EditorUIHelper.Popup("选择分析器:", _curAnalyzerIndex, AssetAnalyzerStrs);

            EditorUIHelper.Space();
            EditorUIHelper.Button("搜索", () =>
            {
                CurAnalyzer.Analyse(Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.DeepAssets));
            });

            EditorUIHelper.Space();
            EditorUIHelper.Button("修正全部", () =>
            {
                CurAnalyzer.CorrectAll();
            });

            EditorUIHelper.Space();
            _analyzerScroll = EditorUIHelper.BeginScrollView(_analyzerScroll);
            {
                CurAnalyzer.ShowResult();
            }
            EditorUIHelper.EndScrollView();
        }
Exemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            if (_grid.HexMat == null)
            {
                LoadMaterial();
            }
            _grid.HexMat = EditorUIHelper.ObjectField <Material>(_grid.HexMat, "材质球");

            _grid.Data = EditorUIHelper.ObjectField <HexGridData>(_grid.Data, "数据");
            var gridData = _grid.Data;

            if (gridData == null)
            {
                EditorUIHelper.Space();
                EditorUIHelper.Button("创建数据", CreateHexGridData);
            }
            else
            {
                gridData.width  = EditorUIHelper.Slider("宽度", gridData.width, 0, 1000);
                gridData.height = EditorUIHelper.Slider("高度", gridData.height, 0, 1000);
                gridData.size   = EditorUIHelper.Slider("六边形边长", gridData.size, 0, 10);
                EditorUIHelper.Button("更新HexGrid", UpdateHexGrid);

                _grid.BorderColor = EditorUIHelper.ColorField(_grid.BorderColor, "边界颜色");
                EditorUIHelper.PropertyField(serializedObject, "Renderer", "网格颜色");
                _grid.ShowScope = EditorUIHelper.Toggle("显示边界", _grid.ShowScope);
                _grid.ShowGrid  = EditorUIHelper.Toggle("显示网格", _grid.ShowGrid);
            }

            EditorUIHelper.Space();
            _grid.BrushData = EditorUIHelper.ObjectField <BrushData>(_grid.BrushData, "笔刷");
            var brushData = _grid.BrushData;

            if (brushData == null)
            {
                EditorUIHelper.Space();
                EditorUIHelper.Button("创建笔刷", CreateBrushData);
            }
            else
            {
                EditorUIHelper.Button("编辑笔刷", () => BrushDataEditorWindow.Open(brushData));

                EditorUIHelper.Space();
                _brushType = EditorUIHelper.EnumPopup <BrushData.BrushType>(_brushType, "笔刷类型");

                if (_brushType != BrushData.BrushType.None)
                {
                    if (brushData.pathBrushes.Count > 0)
                    {
                        _curBrush = EditorUIHelper.Popup("刷路", _curBrush,
                                                         brushData.pathBrushes.Select(brush => brush.name).ToArray());
                    }

                    _brushFeature.brushOptionType = EditorUIHelper.EnumPopup <BrushFeature.BrushOptionType>(_brushFeature.brushOptionType);
                    _brushFeature.brushRange      = EditorUIHelper.IntSlider("笔刷大小", _brushFeature.brushRange, 0, 10);
                }
            }

            if (EditorUIHelper.Changed)
            {
                serializedObject.ApplyModifiedProperties();
                EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
                if (gridData != null)
                {
                    EditorUtility.SetDirty(gridData);
                }
            }
        }