You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.4 KiB
42 lines
1.4 KiB
8 years ago
|
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus).
|
||
|
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE)
|
||
9 years ago
|
|
||
10 years ago
|
using UnityEngine;
|
||
|
|
||
9 years ago
|
namespace Fungus
|
||
|
{
|
||
8 years ago
|
/// <summary>
|
||
|
/// Utility functions for drawing custom UI in the editor.
|
||
|
/// </summary>
|
||
8 years ago
|
public static class CustomGUI
|
||
|
{
|
||
|
public static Texture2D CreateBlackTexture()
|
||
|
{
|
||
|
Texture2D blackTex = new Texture2D(1,2);
|
||
|
blackTex.SetPixel(0, 0, Color.gray);
|
||
|
blackTex.SetPixel(1, 0, Color.black);
|
||
|
blackTex.Apply();
|
||
|
blackTex.hideFlags = HideFlags.DontSave;
|
||
|
return blackTex;
|
||
|
}
|
||
9 years ago
|
|
||
8 years ago
|
public static Texture2D CreateColorTexture(Color color)
|
||
|
{
|
||
|
Texture2D colorTex = new Texture2D(1,1);
|
||
|
colorTex.SetPixel(0, 0, color);
|
||
|
colorTex.Apply();
|
||
|
colorTex.hideFlags = HideFlags.DontSave;
|
||
|
return colorTex;
|
||
|
}
|
||
|
|
||
|
public static void DrawLineSeparator(Texture2D blackTex, float width)
|
||
|
{
|
||
|
GUIStyle separatorStyle = new GUIStyle(GUI.skin.box);
|
||
|
separatorStyle.fixedWidth = width;
|
||
|
separatorStyle.fixedHeight = 2;
|
||
|
separatorStyle.margin.top = 10;
|
||
|
separatorStyle.margin.bottom = 10;
|
||
|
GUILayout.Box(blackTex,separatorStyle);
|
||
|
}
|
||
|
}
|
||
9 years ago
|
}
|