mirror of
https://github.com/DCFApixels/DragonECS-Unity.git
synced 2025-09-18 18:14:35 +08:00
update settings window
This commit is contained in:
parent
786c457b6a
commit
547ff3495b
@ -43,22 +43,54 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
private void OnGUI()
|
private void OnGUI()
|
||||||
{
|
{
|
||||||
float labelWidth = EditorGUIUtility.labelWidth;
|
float labelWidth = EditorGUIUtility.labelWidth;
|
||||||
EditorGUIUtility.labelWidth *= 2f;
|
EditorGUIUtility.labelWidth = 0f;
|
||||||
|
|
||||||
|
float checkBoxWidth = 20f;
|
||||||
|
|
||||||
|
GUILayout.Space(20f);
|
||||||
|
using (new EcsGUI.ColorScope(Color.white * 0.5f))
|
||||||
|
GUILayout.BeginVertical(EditorStyles.helpBox);
|
||||||
|
//using (new EcsGUI.ColorScope(Color.white * 1.2f))
|
||||||
|
GUILayout.Label("", EditorStyles.toolbar, GUILayout.ExpandWidth(true), GUILayout.Height(22f));
|
||||||
|
Rect rect = GUILayoutUtility.GetLastRect();
|
||||||
|
rect.xMin += 9f;
|
||||||
|
GUI.Label(rect, "Settings", EditorStyles.whiteLargeLabel);
|
||||||
|
|
||||||
GUILayout.Label("Settings", EditorStyles.whiteLargeLabel);
|
|
||||||
EditorGUI.BeginChangeCheck();
|
EditorGUI.BeginChangeCheck();
|
||||||
Settings settings = new Settings();
|
Settings settings = new Settings();
|
||||||
settings.IsShowHidden = EditorGUILayout.Toggle(nameof(SettingsPrefs.IsShowHidden), SettingsPrefs.instance.IsShowHidden);
|
|
||||||
settings.IsShowInterfaces = EditorGUILayout.Toggle(nameof(SettingsPrefs.IsShowInterfaces), SettingsPrefs.instance.IsShowInterfaces);
|
GUILayout.BeginHorizontal();
|
||||||
settings.IsShowRuntimeComponents = EditorGUILayout.Toggle(nameof(SettingsPrefs.IsShowRuntimeComponents), SettingsPrefs.instance.IsShowRuntimeComponents);
|
settings.IsShowHidden = EditorGUILayout.Toggle(SettingsPrefs.instance.IsShowHidden, GUILayout.Width(checkBoxWidth));
|
||||||
|
GUILayout.Label(nameof(SettingsPrefs.IsShowHidden), GUILayout.ExpandWidth(false));
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
settings.IsShowInterfaces = EditorGUILayout.Toggle(SettingsPrefs.instance.IsShowInterfaces, GUILayout.Width(checkBoxWidth));
|
||||||
|
GUILayout.Label(nameof(SettingsPrefs.IsShowInterfaces), GUILayout.ExpandWidth(false));
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
settings.IsShowRuntimeComponents = EditorGUILayout.Toggle(SettingsPrefs.instance.IsShowRuntimeComponents, GUILayout.Width(checkBoxWidth));
|
||||||
|
GUILayout.Label(nameof(SettingsPrefs.IsShowRuntimeComponents), GUILayout.ExpandWidth(false));
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
if (EditorGUI.EndChangeCheck())
|
if (EditorGUI.EndChangeCheck())
|
||||||
{
|
{
|
||||||
SettingsPrefs.instance.IsShowHidden = settings.IsShowHidden;
|
SettingsPrefs.instance.IsShowHidden = settings.IsShowHidden;
|
||||||
SettingsPrefs.instance.IsShowInterfaces = settings.IsShowInterfaces;
|
SettingsPrefs.instance.IsShowInterfaces = settings.IsShowInterfaces;
|
||||||
SettingsPrefs.instance.IsShowRuntimeComponents = settings.IsShowRuntimeComponents;
|
SettingsPrefs.instance.IsShowRuntimeComponents = settings.IsShowRuntimeComponents;
|
||||||
}
|
}
|
||||||
GUILayout.Label("Scripting Define Symbols", EditorStyles.whiteLargeLabel);
|
GUILayout.EndVertical();
|
||||||
|
|
||||||
|
|
||||||
|
GUILayout.Space(20f);
|
||||||
|
using (new EcsGUI.ColorScope(Color.white * 0.5f))
|
||||||
|
GUILayout.BeginVertical(EditorStyles.helpBox);
|
||||||
|
//using (new EcsGUI.ColorScope(Color.white * 1.2f))
|
||||||
|
GUILayout.Label("", EditorStyles.toolbar, GUILayout.ExpandWidth(true), GUILayout.Height(22f));
|
||||||
|
rect = GUILayoutUtility.GetLastRect();
|
||||||
|
rect.xMin += 9f;
|
||||||
|
GUI.Label(rect, "Scripting Define Symbols", EditorStyles.whiteLargeLabel);
|
||||||
if (_defineSymbols == null)
|
if (_defineSymbols == null)
|
||||||
{
|
{
|
||||||
InitDefines();
|
InitDefines();
|
||||||
@ -66,8 +98,18 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
EditorGUI.BeginChangeCheck();
|
EditorGUI.BeginChangeCheck();
|
||||||
for (int i = 0; i < _defineSymbols.Count; i++)
|
for (int i = 0; i < _defineSymbols.Count; i++)
|
||||||
{
|
{
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
var symbol = _defineSymbols[i];
|
var symbol = _defineSymbols[i];
|
||||||
symbol.isOn = EditorGUILayout.Toggle(symbol.name, symbol.isOn);
|
symbol.isOn = EditorGUILayout.Toggle(symbol.isOn, GUILayout.Width(checkBoxWidth));
|
||||||
|
if(symbol.name == "DEBUG")
|
||||||
|
{
|
||||||
|
GUILayout.Label(symbol.name + " (Build Olny)", GUILayout.ExpandWidth(false));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GUILayout.Label(symbol.name, GUILayout.ExpandWidth(false));
|
||||||
|
}
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
}
|
}
|
||||||
if (EditorGUI.EndChangeCheck()) { }
|
if (EditorGUI.EndChangeCheck()) { }
|
||||||
if (GUILayout.Button("Apply"))
|
if (GUILayout.Button("Apply"))
|
||||||
@ -82,6 +124,7 @@ namespace DCFApixels.DragonECS.Unity.Editors
|
|||||||
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, symbolsString);
|
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, symbolsString);
|
||||||
InitDefines();
|
InitDefines();
|
||||||
}
|
}
|
||||||
|
GUILayout.EndVertical();
|
||||||
|
|
||||||
EditorGUIUtility.labelWidth = labelWidth;
|
EditorGUIUtility.labelWidth = labelWidth;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user