Browse Source

Fixed bug with Hide On Selected option

master
chrisgregan 10 years ago
parent
commit
9285dfa8a0
  1. 3
      Assets/Fungus/Dialog/Scripts/Commands/ChooseOption.cs
  2. 6
      Assets/Fungus/Dialog/Scripts/Commands/Option.cs

3
Assets/Fungus/Dialog/Scripts/Commands/ChooseOption.cs

@ -14,7 +14,7 @@ namespace Fungus
{ {
[Tooltip("Story text to display to prompt player to choose an option")] [Tooltip("Story text to display to prompt player to choose an option")]
[TextArea(5,10)] [TextArea(5,10)]
public string chooseText; public string chooseText = "";
[Tooltip("Speaking character to use when prompting the player to choose an option")] [Tooltip("Speaking character to use when prompting the player to choose an option")]
public Character character; public Character character;
@ -101,6 +101,7 @@ namespace Fungus
dialogOption.onSelect = delegate { dialogOption.onSelect = delegate {
chooseDialog.ShowDialog(false); chooseDialog.ShowDialog(false);
theOption.wasSelected = true;
Continue(theOption.commandIndex + 1); Continue(theOption.commandIndex + 1);
}; };

6
Assets/Fungus/Dialog/Scripts/Commands/Option.cs

@ -12,7 +12,7 @@ namespace Fungus
public class Option : If public class Option : If
{ {
[Tooltip("Option text to display when presenting the option to the player")] [Tooltip("Option text to display when presenting the option to the player")]
public string optionText; public string optionText = "";
[Tooltip("Hide this option once it has been selected so that it won't appear again even if executed again")] [Tooltip("Hide this option once it has been selected so that it won't appear again even if executed again")]
public bool hideOnSelected; public bool hideOnSelected;
@ -50,8 +50,8 @@ namespace Fungus
for (int i = commandIndex + 1; i < parentSequence.commandList.Count; ++i) for (int i = commandIndex + 1; i < parentSequence.commandList.Count; ++i)
{ {
End endCommand = parentSequence.commandList[i] as End; End endCommand = parentSequence.commandList[i] as End;
if (endCommand != null && if (endCommand != null &&
endCommand.indentLevel == indentLevel) endCommand.indentLevel == indentLevel)
{ {
// Continue at next command after End // Continue at next command after End

Loading…
Cancel
Save