コード例 #1
0
        public void Details()
        {
            const string description = "Apply details to your biomes. These include textures, objects, and grass.";

            Header("Details", description);

            EditorGUIExtension.BeginBlockArea();

            for (var i = 0; i < _config.BiomesData.Count; i++)
            {
                var biome  = _config.BiomesData[i];
                var detail = biome.Details;

                EditorGUILayout.BeginHorizontal();

                EditorGUILayout.LabelField(biome.Name, EditorGUIExtension.TerraStyle.TextTitle);

                //Show color preview
                var bg = new Texture2D(1, 1);
                bg.SetPixel(1, 1, biome.Color);
                bg.Apply();

                var bgStyle = new GUIStyle();
                bgStyle.normal.background = bg;
                bgStyle.padding.bottom    = (int)EditorGUIUtility.singleLineHeight;

                EditorGUILayout.BeginVertical(bgStyle);
                EditorGUILayout.EndVertical();

                EditorGUILayout.EndHorizontal();

                EditorGUILayout.Space();
                EditorGUI.indentLevel++;

                detail.ShowMaterialFoldout = EditorGUILayout.Foldout(detail.ShowMaterialFoldout, "Textures");
                if (detail.ShowMaterialFoldout)
                {
                    EditorGUI.indentLevel--;
                    Detail_Texture(biome);
                    EditorGUI.indentLevel++;
                }

                detail.ShowObjectFoldout = EditorGUILayout.Foldout(detail.ShowObjectFoldout, "Objects");
                if (detail.ShowObjectFoldout)
                {
                    EditorGUI.indentLevel--;
                    Detail_Object(biome);
                    EditorGUI.indentLevel++;
                }

                detail.ShowGrassFoldout = EditorGUILayout.Foldout(detail.ShowGrassFoldout, "Grass");
                EditorGUI.indentLevel--;

                if (i < _config.BiomesData.Count - 1)
                {
                    EditorGUIExtension.AddBlockAreaSeperator();
                }
            }

            EditorGUIExtension.EndBlockArea();
            EditorGUILayout.Space();

            //Shader Settings
            const string desc = "Scale up textures in the distance to hide texture tiling.";

            Header("Distance Texture Scaling", desc);

            ShaderData sd = _config.ShaderData;

            sd.FarScaleMultiplier = EditorGUILayout.FloatField("Far Tex Scale", sd.FarScaleMultiplier);
            sd.TransitionStart    = EditorGUILayout.FloatField("Blend Start", sd.TransitionStart);
            sd.TransitionFalloff  = EditorGUILayout.FloatField("Blend Falloff", sd.TransitionFalloff);
        }