module-navigation-tool/Editor/Favorites/Window/Styles/Styles.cs

47 lines
1.6 KiB
C#

using UnityEngine;
namespace Game.NavigationTool.Editor
{
internal sealed class Styles
{
public GUIStyle toolbox;
public GUIStyle buttonAddFolder;
public GUIStyle entry;
public Texture2D foldoutIn;
public Texture2D foldoutOut;
public GUIStyle contextOption;
private GUISkin skin;
public void Initialize(GUISkin skin)
{
if (this.skin == skin)
return;
toolbox = new GUIStyle(skin.box);
buttonAddFolder = new GUIStyle(skin.button);
buttonAddFolder.padding = new RectOffset(4, 0, 0, 4);
entry = new GUIStyle(skin.label);
entry.hover.textColor = entry.onHover.textColor = Color.white;
entry.active.textColor = entry.onActive.textColor = Color.yellow;
GUIStyle style = skin.FindStyle("Foldout");
if (style != null)
{
foldoutIn = style.normal.scaledBackgrounds[0];
foldoutOut = style.onNormal.scaledBackgrounds[0];
}
contextOption = new GUIStyle(skin.label);
contextOption.hover.textColor = contextOption.onHover.textColor = Color.white;
contextOption.hover.scaledBackgrounds = contextOption.onHover.scaledBackgrounds = skin.box.normal.scaledBackgrounds;
contextOption.active.textColor = contextOption.onActive.textColor = Color.yellow;
contextOption.active.scaledBackgrounds = contextOption.onActive.scaledBackgrounds = skin.box.normal.scaledBackgrounds;
}
}
}