|
|
|
|
|
|
m_DebugMenu = DebugMenuManager.instance; |
|
|
|
} |
|
|
|
|
|
|
|
void DrawBoolItem(DebugMenuItem item) |
|
|
|
{ |
|
|
|
EditorGUI.BeginChangeCheck(); |
|
|
|
bool value = EditorGUILayout.Toggle(item.name, (bool)item.GetValue()); |
|
|
|
if(EditorGUI.EndChangeCheck()) |
|
|
|
{ |
|
|
|
item.SetValue(value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void DrawFloatItem(DebugMenuItem item) |
|
|
|
{ |
|
|
|
EditorGUI.BeginChangeCheck(); |
|
|
|
float value = EditorGUILayout.FloatField(item.name, (float)item.GetValue()); |
|
|
|
if (EditorGUI.EndChangeCheck()) |
|
|
|
{ |
|
|
|
item.SetValue(value); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void OnMenuItemGUI(DebugMenuItem item) |
|
|
|
{ |
|
|
|
if(item.GetItemType() == typeof(bool)) |
|
|
|
{ |
|
|
|
DrawBoolItem(item); |
|
|
|
} |
|
|
|
else if(item.GetItemType() == typeof(float)) |
|
|
|
{ |
|
|
|
DrawFloatItem(item); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void OnGUI() |
|
|
|
{ |
|
|
|
if (m_DebugMenu == null) |
|
|
|
|
|
|
EditorGUI.BeginChangeCheck(); |
|
|
|
int debugMenuCount = m_DebugMenu.menuCount; |
|
|
|
int activeMenuIndex = m_DebugMenu.activeMenuIndex; |
|
|
|
using (new EditorGUILayout.HorizontalScope()) |
|
|
|
|
|
|
activeMenuIndex = i; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
m_DebugMenu.activeMenuIndex = activeMenuIndex; |
|
|
|
if(EditorGUI.EndChangeCheck()) |
|
|
|
{ |
|
|
|
m_DebugMenu.activeMenuIndex = activeMenuIndex; |
|
|
|
} |
|
|
|
|
|
|
|
using(new EditorGUILayout.VerticalScope()) |
|
|
|
{ |
|
|
|
DebugMenu activeMenu = m_DebugMenu.GetDebugMenu(m_DebugMenu.activeMenuIndex); |
|
|
|
for (int i = 0; i < activeMenu.itemCount; ++i) |
|
|
|
{ |
|
|
|
OnMenuItemGUI(activeMenu.GetDebugMenuItem(i)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|