Browse Source

Hide selected options

master
chrisgregan 11 years ago
parent
commit
424e7a1195
  1. 9
      Assets/Fungus/Dialog/Commands/AddOption.cs
  2. 4
      Assets/Fungus/Dialog/Commands/Say.cs
  3. 5
      Assets/Fungus/Dialog/Editor/AddOptionEditor.cs
  4. 4
      Assets/Fungus/Dialog/Editor/SayEditor.cs
  5. BIN
      Assets/Shuttle/ShuttleGame.unity

9
Assets/Fungus/Dialog/Commands/AddOption.cs

@ -13,8 +13,17 @@ namespace Fungus.Script
public string optionText; public string optionText;
public Sequence targetSequence; public Sequence targetSequence;
public bool hideOnSelected;
public override void OnEnter() public override void OnEnter()
{ {
if (hideOnSelected &&
targetSequence.GetExecutionCount() > 0)
{
Continue();
return;
}
Choose.Option option = new Choose.Option(); Choose.Option option = new Choose.Option();
option.optionText = optionText; option.optionText = optionText;
option.targetSequence = targetSequence; option.targetSequence = targetSequence;

4
Assets/Fungus/Dialog/Commands/Say.cs

@ -15,12 +15,12 @@ namespace Fungus.Script
public Character character; public Character character;
public string storyText; public string storyText;
public bool displayOnce; public bool showOnce;
int executionCount; int executionCount;
public override void OnEnter() public override void OnEnter()
{ {
if (displayOnce && executionCount > 0) if (showOnce && executionCount > 0)
{ {
Continue(); Continue();
return; return;

5
Assets/Fungus/Dialog/Editor/AddOptionEditor.cs

@ -17,7 +17,7 @@ namespace Fungus.Script
EditorGUI.BeginChangeCheck(); EditorGUI.BeginChangeCheck();
string optionText = EditorGUILayout.TextField(new GUIContent("Option Text", "Text display on the option button."), string optionText = EditorGUILayout.TextField(new GUIContent("Option Text", "Text to display on the option button."),
t.optionText); t.optionText);
Sequence targetSequence = SequenceEditor.SequenceField(new GUIContent("Target Sequence", "Sequence to execute when this option is selected by the player."), Sequence targetSequence = SequenceEditor.SequenceField(new GUIContent("Target Sequence", "Sequence to execute when this option is selected by the player."),
@ -25,11 +25,14 @@ namespace Fungus.Script
t.GetFungusScript(), t.GetFungusScript(),
t.targetSequence); t.targetSequence);
bool hideOnSelected = EditorGUILayout.Toggle(new GUIContent("Hide On Selected", "Hide this option forever once the player has selected it."), t.hideOnSelected);
if (EditorGUI.EndChangeCheck()) if (EditorGUI.EndChangeCheck())
{ {
Undo.RecordObject(t, "Set Add Option"); Undo.RecordObject(t, "Set Add Option");
t.optionText = optionText; t.optionText = optionText;
t.targetSequence = targetSequence; t.targetSequence = targetSequence;
t.hideOnSelected = hideOnSelected;
} }
} }
} }

4
Assets/Fungus/Dialog/Editor/SayEditor.cs

@ -31,7 +31,7 @@ namespace Fungus.Script
new GUIContent("<Default>"), new GUIContent("<Default>"),
t.dialog); t.dialog);
bool displayOnce = EditorGUILayout.Toggle(new GUIContent("Display Once", "Display this text once and never show it again."), t.displayOnce); bool showOnce = EditorGUILayout.Toggle(new GUIContent("Show Once", "Show this text once and never show it again."), t.showOnce);
if (EditorGUI.EndChangeCheck()) if (EditorGUI.EndChangeCheck())
{ {
@ -39,7 +39,7 @@ namespace Fungus.Script
t.storyText = text; t.storyText = text;
t.character = character; t.character = character;
t.dialog = dialog; t.dialog = dialog;
t.displayOnce = displayOnce; t.showOnce = showOnce;
} }
} }
} }

BIN
Assets/Shuttle/ShuttleGame.unity

Binary file not shown.
Loading…
Cancel
Save