Files
XCharts/Editor/MainComponents/ThemeEditor.cs

39 lines
958 B
C#
Raw Normal View History

2021-11-23 13:20:07 +08:00
using UnityEditor;
using UnityEngine;
2022-02-19 22:37:57 +08:00
using XCharts.Runtime;
2021-11-23 13:20:07 +08:00
#if dUI_TextMeshPro
using TMPro;
#endif
2021-12-24 13:33:09 +08:00
namespace XCharts.Editor
2021-11-23 13:20:07 +08:00
{
[CustomEditor(typeof(Theme))]
2021-12-24 13:33:09 +08:00
public class ThemeEditor : UnityEditor.Editor
2021-11-23 13:20:07 +08:00
{
2022-05-22 22:17:38 +08:00
static class Styles
{
internal static GUIContent btnReset = new GUIContent("Reset", "Reset to default theme");
internal static GUIContent btnSync = new GUIContent("Sync Font", "Sync main theme font to sub theme font");
}
2021-11-23 13:20:07 +08:00
private Theme m_Theme;
2022-05-22 22:17:38 +08:00
2021-11-23 13:20:07 +08:00
void OnEnable()
{
m_Theme = target as Theme;
}
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
2022-05-22 22:17:38 +08:00
if (GUILayout.Button(Styles.btnReset))
2021-11-23 13:20:07 +08:00
{
m_Theme.ResetTheme();
}
2022-05-22 22:17:38 +08:00
if (GUILayout.Button(Styles.btnSync))
{
m_Theme.SyncFontToSubComponent();
}
2021-11-23 13:20:07 +08:00
}
}
}