An easy to use Unity 3D library for creating illustrated Interactive Fiction games and more.
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.
|
|
using UnityEngine; |
|
|
using UnityEngine.Internal; |
|
|
using UnityEditor; |
|
|
using System; |
|
|
using System.Reflection; |
|
|
|
|
|
/** |
|
|
* Utility functions for drawing custom UI in the editor |
|
|
*/ |
|
|
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; |
|
|
} |
|
|
|
|
|
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); |
|
|
} |
|
|
} |