Browse Source

Show boolean variable state as True / False instead of toggle

master
chrisgregan 10 years ago
parent
commit
8ddd25e728
  1. 8
      Assets/Fungus/FungusScript/Editor/VariableEditor.cs

8
Assets/Fungus/FungusScript/Editor/VariableEditor.cs

@ -61,6 +61,12 @@ namespace Fungus
[CustomPropertyDrawer (typeof(BooleanData))] [CustomPropertyDrawer (typeof(BooleanData))]
public class BooleanDataDrawer : PropertyDrawer public class BooleanDataDrawer : PropertyDrawer
{ {
protected enum BooleanState
{
True,
False
}
public override void OnGUI (Rect position, SerializedProperty property, GUIContent label) public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)
{ {
EditorGUI.BeginProperty(position, label, property); EditorGUI.BeginProperty(position, label, property);
@ -77,7 +83,7 @@ namespace Fungus
if (referenceProp.objectReferenceValue == null) if (referenceProp.objectReferenceValue == null)
{ {
valueProp.boolValue = EditorGUI.Toggle(valueRect, valueProp.boolValue); valueProp.boolValue = ((BooleanState)EditorGUI.EnumPopup(valueRect, valueProp.boolValue ? BooleanState.True : BooleanState.False) == BooleanState.True);
popupRect.x += valueRect.width + 5; popupRect.x += valueRect.width + 5;
popupRect.width = popupWidth; popupRect.width = popupWidth;
} }

Loading…
Cancel
Save