|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
void DrawBoolItem() |
|
|
|
bool DrawBoolItem() |
|
|
|
{ |
|
|
|
bool value = (bool)m_MenuItem.GetValue(); |
|
|
|
if (m_MenuItem.readOnly) |
|
|
|
|
|
|
if (EditorGUI.EndChangeCheck()) |
|
|
|
{ |
|
|
|
m_MenuItem.SetValue(value); |
|
|
|
return true; |
|
|
|
|
|
|
|
return false; |
|
|
|
void DrawIntItem() |
|
|
|
bool DrawIntItem() |
|
|
|
{ |
|
|
|
int value = (int)m_MenuItem.GetValue(); |
|
|
|
if (m_MenuItem.readOnly) |
|
|
|
|
|
|
if (EditorGUI.EndChangeCheck()) |
|
|
|
{ |
|
|
|
m_MenuItem.SetValue(value); |
|
|
|
return true; |
|
|
|
|
|
|
|
return false; |
|
|
|
void DrawUIntItem() |
|
|
|
bool DrawUIntItem() |
|
|
|
{ |
|
|
|
int value = (int)(uint)m_MenuItem.GetValue(); |
|
|
|
if (m_MenuItem.readOnly) |
|
|
|
|
|
|
{ |
|
|
|
value = System.Math.Max(0, value); |
|
|
|
m_MenuItem.SetValue((uint)value); |
|
|
|
return true; |
|
|
|
|
|
|
|
return false; |
|
|
|
void DrawFloatItem() |
|
|
|
bool DrawFloatItem() |
|
|
|
{ |
|
|
|
float value = (float)m_MenuItem.GetValue(); |
|
|
|
if(m_MenuItem.readOnly) |
|
|
|
|
|
|
if (EditorGUI.EndChangeCheck()) |
|
|
|
{ |
|
|
|
m_MenuItem.SetValue(value); |
|
|
|
return true; |
|
|
|
|
|
|
|
return false; |
|
|
|
void DrawColorItem() |
|
|
|
bool DrawColorItem() |
|
|
|
{ |
|
|
|
EditorGUI.BeginChangeCheck(); |
|
|
|
Color value = EditorGUILayout.ColorField(m_Label, (Color)m_MenuItem.GetValue()); |
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
return false; |
|
|
|
void DrawEnumItem() |
|
|
|
bool DrawEnumItem() |
|
|
|
{ |
|
|
|
EditorGUI.BeginChangeCheck(); |
|
|
|
int value = EditorGUILayout.IntPopup(m_Label, (int)m_MenuItem.GetValue(), m_EnumStrings.ToArray(), m_EnumValues.ToArray()); |
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
return false; |
|
|
|
public virtual void OnEditorGUI() |
|
|
|
public virtual bool OnEditorGUI() |
|
|
|
DrawBoolItem(); |
|
|
|
return DrawBoolItem(); |
|
|
|
DrawIntItem(); |
|
|
|
return DrawIntItem(); |
|
|
|
DrawUIntItem(); |
|
|
|
return DrawUIntItem(); |
|
|
|
DrawFloatItem(); |
|
|
|
return DrawFloatItem(); |
|
|
|
DrawColorItem(); |
|
|
|
return DrawColorItem(); |
|
|
|
DrawEnumItem(); |
|
|
|
return DrawEnumItem(); |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
#endif
|
|
|
|
} |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#if UNITY_EDITOR
|
|
|
|
public override void OnEditorGUI() |
|
|
|
public override bool OnEditorGUI() |
|
|
|
{ |
|
|
|
EditorGUI.BeginChangeCheck(); |
|
|
|
float value = EditorGUILayout.Slider(m_MenuItem.name, (float)m_MenuItem.GetValue(), m_Min, m_Max); |
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
#endif
|
|
|
|
} |