示例#1
0
    private void Draw()
    {
        biomeRect = new Rect(borderSize, borderSize, 50, position.height - (borderSize * 2));
        GUI.DrawTexture(biomeRect, biome.GetVertTexture((int)biomeRect.height));

        keyRects = new Rect[biome.regions.Count];
        for (int i = 0; i < keyRects.Length; i++)
        {
            TerrainType terrain = biome.regions [i];
            Rect        keyRect = new Rect(biomeRect.xMax + borderSize, biomeRect.y + biomeRect.height * (1f - terrain.height) - (keyHeight / 2f), keyWidth, keyHeight);
            if (i == selectedKeyIndex)
            {
                EditorGUI.DrawRect(new Rect(keyRect.x - 2, keyRect.y - 2, keyRect.width + 4, keyRect.height + 4), Color.black);
            }
            EditorGUI.DrawRect(keyRect, terrain.colour);
            keyRects [i] = keyRect;
        }

        settingsRect = new Rect(keyRects [0].xMax + borderSize, borderSize, position.width, position.height);
        GUILayout.BeginArea(settingsRect);
        EditorGUI.BeginChangeCheck();
        Color newColour = EditorGUILayout.ColorField(biome.regions [selectedKeyIndex].colour, GUILayout.MaxWidth(250));

        if (EditorGUI.EndChangeCheck())
        {
            biome.SetRegionColour(selectedKeyIndex, newColour);
        }
        biome.threshold = EditorGUILayout.FloatField("Threshold", biome.threshold, GUILayout.MaxWidth(200));
        GUILayout.EndArea();
    }