Exemple #1
0
        protected override void CustomOnGUI()
        {
            _maxHits           = EditorUIHelper.IntSlider("射线最多碰撞次数(检测叠层的时候才需要)", _maxHits, MinHitNums, MaxHitNums);
            _checkLayerMask    = EditorUIHelper.LayerMask(_checkLayerMask, "检测层(涉及层)");
            _generateLayerMask = EditorUIHelper.LayerMask(_generateLayerMask, "生成层(某些层的内外围)");

            EditorUIHelper.Space();
            _calculateType = EditorUIHelper.EnumPopup <SceneInfoCalculation.CalculateType>(_calculateType, "筛选条件(如内外围)");
            _minRange      = EditorUIHelper.IntSlider("边界最近距离(-1代表全部)", _minRange, MinRange, MaxRange);
            _maxRange      = EditorUIHelper.IntSlider("影响最远距离(-1代表全部)", _maxRange, MinRange, MaxRange);

            EditorUIHelper.Space();
            EditorUIHelper.Button("刷新", Refresh);

            EditorUIHelper.Space();
            EditorUIHelper.ObjectField <Texture>(_previewTexture, "预览");

            EditorUIHelper.Space();
            _noise          = EditorUIHelper.Vector4Field("noise偏移及缩放", _noise);
            _noiseThreshold = EditorUIHelper.Slider("noise阈值", _noiseThreshold, 0, 1);
            EditorUIHelper.Button("叠加噪声图", CompositionNoise);

            EditorUIHelper.Space();
            EditorUIHelper.ObjectField <Texture>(_finalTexture, "叠加噪声图之后");

            EditorUIHelper.Space();
            _parent      = EditorUIHelper.ObjectField <Transform>(_parent, "父节点", true);
            _clearParent = EditorUIHelper.Toggle("清理父节点", _clearParent);
            _space       = EditorUIHelper.IntSlider("间隔(密度)", _space, MinSpace, MaxSpace);

            EditorUIHelper.Space();
            EditorUIHelper.BeginScrollView(_scenePrefabScrollPos);

            var deletePrefabIndex = -1;

            for (int i = 0; i < _scenePrefabs.Count; i++)
            {
                var scenePrefab = _scenePrefabs[i];

                EditorUIHelper.BeginHorizontal();
                scenePrefab.Prefab = EditorUIHelper.ObjectField <GameObject>(scenePrefab.Prefab);
                scenePrefab.Weight = EditorUIHelper.IntSlider("权重", scenePrefab.Weight, MinWeight, MaxWeight);

                var i1 = i;
                EditorUIHelper.Button("删除", () =>
                {
                    deletePrefabIndex = i1;
                });
                EditorUIHelper.EndHorizontal();

                EditorUIHelper.BeginHorizontal();
                scenePrefab.MinScale = EditorUIHelper.Slider("缩放随机最小值", scenePrefab.MinScale, MinScale, MaxScale);
                scenePrefab.MaxScale = EditorUIHelper.Slider("缩放随机最大值", scenePrefab.MaxScale, MinScale, MaxScale);
                EditorUIHelper.EndHorizontal();

                EditorUIHelper.Space();
            }
            if (deletePrefabIndex >= 0)
            {
                _scenePrefabs.RemoveAt(deletePrefabIndex);
            }

            EditorUIHelper.Button("添加", () => _scenePrefabs.Add(new ScenePrefab()));

            EditorUIHelper.EndScrollView();

            EditorUIHelper.Space();
            EditorUIHelper.Button("生成", Generate);
        }