您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
34 行
1.0 KiB
34 行
1.0 KiB
using UnityEngine;
|
|
using UnityEditor;
|
|
|
|
namespace GameplayIngredients
|
|
{
|
|
static class GUIUtils
|
|
{
|
|
public static void ColoredLabel(string text, Color color)
|
|
{
|
|
GUIContent label = new GUIContent(text);
|
|
Rect r = GUILayoutUtility.GetRect(label, Styles.coloredLabel);
|
|
EditorGUI.DrawRect(r, color);
|
|
var r2 = new RectOffset(1, 1, 1, 1).Remove(r);
|
|
EditorGUI.DrawRect(r2, color * new Color(.5f, .5f, .5f, 1f));
|
|
GUI.contentColor = color * 2;
|
|
GUI.Label(r, label, Styles.coloredLabel);
|
|
GUI.contentColor = Color.white;
|
|
}
|
|
|
|
static class Styles
|
|
{
|
|
public static GUIStyle coloredLabel;
|
|
static Styles()
|
|
{
|
|
coloredLabel = new GUIStyle(EditorStyles.label);
|
|
coloredLabel.fontStyle = FontStyle.Bold;
|
|
coloredLabel.fontSize = 10;
|
|
coloredLabel.padding = new RectOffset(6, 6, 2, 2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|