[improve][editor] improve editor edit

This commit is contained in:
monitor1394
2022-08-10 08:16:19 +08:00
parent fcc1314f17
commit 65d32f7aec
4 changed files with 33 additions and 6 deletions

View File

@@ -12,8 +12,9 @@ namespace XCharts.Editor
{
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");
internal static GUIContent btnReset = new GUIContent("Reset to Default", "Reset to default theme");
internal static GUIContent btnSyncFontToSubTheme = new GUIContent("Sync Font to Sub Theme", "Sync main theme font to sub theme font");
internal static GUIContent btnSyncFontFromSetting = new GUIContent("Sync Font from Setting", "Sync main theme font and sub theme font from XCSetting font");
}
private Theme m_Theme;
@@ -28,11 +29,35 @@ namespace XCharts.Editor
base.OnInspectorGUI();
if (GUILayout.Button(Styles.btnReset))
{
m_Theme.ResetTheme();
if (EditorUtility.DisplayDialog(Styles.btnReset.text, Styles.btnReset.tooltip, "Yes", "Cancel"))
{
m_Theme.ResetTheme();
Debug.Log("XCharts: Reset Finish.");
}
}
if (GUILayout.Button(Styles.btnSync))
if (GUILayout.Button(Styles.btnSyncFontFromSetting))
{
m_Theme.SyncFontToSubComponent();
if (EditorUtility.DisplayDialog(Styles.btnSyncFontFromSetting.text, Styles.btnSyncFontFromSetting.tooltip, "Yes", "Cancel"))
{
m_Theme.common.font = XCSettings.font;
m_Theme.SyncFontToSubComponent();
#if dUI_TextMeshPro
m_Theme.common.tmpFont = XCSettings.tmpFont;
m_Theme.SyncTMPFontToSubComponent();
#endif
Debug.Log("XCharts: Sync Finish.");
}
}
if (GUILayout.Button(Styles.btnSyncFontToSubTheme))
{
if (EditorUtility.DisplayDialog(Styles.btnSyncFontToSubTheme.text, Styles.btnSyncFontToSubTheme.tooltip, "Yes", "Cancel"))
{
m_Theme.SyncFontToSubComponent();
#if dUI_TextMeshPro
m_Theme.SyncTMPFontToSubComponent();
#endif
Debug.Log("XCharts: Sync Finish.");
}
}
}
}