Browse Source

replaced say dropdown menu with object picker

master
Timothy Ng 9 years ago
parent
commit
74c14f5985
  1. 6
      Assets/Fungus/Flowchart/Editor/CommandEditor.cs
  2. 7
      Assets/Fungus/Narrative/Editor/SayEditor.cs

6
Assets/Fungus/Flowchart/Editor/CommandEditor.cs

@ -154,6 +154,7 @@ namespace Fungus
serializedObject.ApplyModifiedProperties();
}
static public void ObjectField<T>(SerializedProperty property, GUIContent label, GUIContent nullLabel, List<T> objectList) where T : Object
{
if (property == null)
@ -172,14 +173,16 @@ namespace Fungus
if (objectList[i] == null) continue;
objectNames.Add(new GUIContent(objectList[i].name));
if (selectedObject == objectList[i])
{
selectedIndex = i + 1;
}
}
T result;
selectedIndex = EditorGUILayout.Popup(label, selectedIndex, objectNames.ToArray());
if (selectedIndex == 0)
{
@ -192,6 +195,7 @@ namespace Fungus
property.objectReferenceValue = result;
}
/**
* When modifying custom editor code you can occasionally end up with orphaned editor instances.

7
Assets/Fungus/Narrative/Editor/SayEditor.cs

@ -111,17 +111,14 @@ namespace Fungus
{
DestroyImmediate(blackTex);
}
public override void DrawCommandGUI()
{
serializedObject.Update();
bool showPortraits = false;
CommandEditor.ObjectField<Character>(characterProp,
new GUIContent("Character", "Character that is speaking"),
new GUIContent("<None>"),
Character.activeCharacters);
characterProp.objectReferenceValue = (Character) EditorGUILayout.ObjectField(characterProp.objectReferenceValue, typeof(Character), true);
Say t = target as Say;

Loading…
Cancel
Save