Browse Source

Control Stage command works if only 1 stage exists.

master
chrisgregan 10 years ago
parent
commit
f15764f155
  1. 18
      Assets/Fungus/Portrait/Editor/StageEditor.cs

18
Assets/Fungus/Portrait/Editor/StageEditor.cs

@ -41,23 +41,23 @@ namespace Fungus
// Format Enum names // Format Enum names
string[] displayLabels = StringFormatter.FormatEnumNames(t.display,"<None>"); string[] displayLabels = StringFormatter.FormatEnumNames(t.display,"<None>");
displayProp.enumValueIndex = EditorGUILayout.Popup("Display", (int)displayProp.enumValueIndex, displayLabels); displayProp.enumValueIndex = EditorGUILayout.Popup("Display", (int)displayProp.enumValueIndex, displayLabels);
string replaceLabel = "Portrait Stage"; string replaceLabel = "Portrait Stage";
if (t.display == StageDisplayType.Swap) if (t.display == StageDisplayType.Swap)
{ {
CommandEditor.ObjectField<Stage>(replacedStageProp, CommandEditor.ObjectField<Stage>(replacedStageProp,
new GUIContent("Replace", "Character to swap with"), new GUIContent("Replace", "Character to swap with"),
new GUIContent("<Default>"), new GUIContent("<Default>"),
Stage.activeStages); Stage.activeStages);
replaceLabel = "With"; replaceLabel = "With";
} }
if (Stage.activeStages.Count > 1) if (Stage.activeStages.Count > 0)
{ {
CommandEditor.ObjectField<Stage>(stageProp, CommandEditor.ObjectField<Stage>(stageProp,
new GUIContent(replaceLabel, "Stage to display the character portraits on"), new GUIContent(replaceLabel, "Stage to display the character portraits on"),
new GUIContent("<Default>"), new GUIContent("<Default>"),
Stage.activeStages); Stage.activeStages);
} }
bool showOptionalFields = true; bool showOptionalFields = true;
@ -71,7 +71,7 @@ namespace Fungus
} }
if (s == null) if (s == null)
{ {
EditorGUILayout.HelpBox("No portrait stage has been set. Please create a new portrait stage using [Game Object > Fungus > Portrait > Portrait Stage].", MessageType.Error); EditorGUILayout.HelpBox("No portrait stage has been set. Please create a new portrait stage using [Game Object > Fungus > Portrait > Stage].", MessageType.Error);
showOptionalFields = false; showOptionalFields = false;
} }
} }

Loading…
Cancel
Save