Browse Source

Implemented Hide On Visited option condition

master
chrisgregan 11 years ago
parent
commit
c2ae79d921
  1. 2
      Assets/Fungus/Editor/AddOptionCommandEditor.cs
  2. 6
      Assets/Fungus/Editor/CompareCommandEditor.cs
  3. 2
      Assets/Fungus/Editor/SetVariableCommandEditor.cs
  4. 3
      Assets/Fungus/VisualScripting/AddOptionCommand.cs
  5. 4
      Assets/Fungus/VisualScripting/FungusCommand.cs
  6. 12
      Assets/Fungus/VisualScripting/Sequence.cs

2
Assets/Fungus/Editor/AddOptionCommandEditor.cs

@ -18,7 +18,7 @@ namespace Fungus
string newText = EditorGUILayout.TextField(new GUIContent("Text", "Text to display on option button"), t.text);
Sequence newSequence = SequenceEditor.SequenceField(new GUIContent("Sequence", "Sequence to execute when this option is selected"),
t.GetParentFungusScript(),
t.GetFungusScript(),
t.sequence);
AddOptionCommand.Condition newCondition = (AddOptionCommand.Condition)EditorGUILayout.EnumPopup(new GUIContent("Condition", "Conditions for when this option is displayed"), t.condition);

6
Assets/Fungus/Editor/CompareCommandEditor.cs

@ -13,7 +13,7 @@ namespace Fungus
{
CompareCommand t = target as CompareCommand;
FungusScript sc = t.GetParentFungusScript();
FungusScript sc = t.GetFungusScript();
if (sc == null)
{
return;
@ -115,11 +115,11 @@ namespace Fungus
}
Sequence onTrue = SequenceEditor.SequenceField(new GUIContent("On True Sequence", "Sequence to execute if comparision is true"),
t.GetParentFungusScript(),
t.GetFungusScript(),
t.onTrueSequence);
Sequence onFalse = SequenceEditor.SequenceField(new GUIContent("On False Sequence", "Sequence to execute if comparision is false"),
t.GetParentFungusScript(),
t.GetFungusScript(),
t.onFalseSequence);
if (onTrue != t.onTrueSequence)

2
Assets/Fungus/Editor/SetVariableCommandEditor.cs

@ -13,7 +13,7 @@ namespace Fungus
{
SetVariableCommand t = target as SetVariableCommand;
FungusScript fungusScript = t.GetParentFungusScript();
FungusScript fungusScript = t.GetFungusScript();
if (fungusScript == null)
{
return;

3
Assets/Fungus/VisualScripting/AddOptionCommand.cs

@ -24,7 +24,8 @@ namespace Fungus
{
Dialog dialog = Game.GetInstance().dialog;
if (dialog != null &&
sequence != null)
sequence != null &&
!(condition == Condition.HideOnVisited && sequence.GetExecutionCount() > 0))
{
dialog.AddOption(text, () => {
Stop();

4
Assets/Fungus/VisualScripting/FungusCommand.cs

@ -22,10 +22,10 @@ namespace Fungus
public virtual void Start()
{
parentSequence = GetComponent<Sequence>();
parentFungusScript = GetParentFungusScript();
parentFungusScript = GetFungusScript();
}
public FungusScript GetParentFungusScript()
public FungusScript GetFungusScript()
{
FungusScript sc = null;

12
Assets/Fungus/VisualScripting/Sequence.cs

@ -22,6 +22,8 @@ namespace Fungus
[System.NonSerialized]
public FungusCommand activeCommand;
int executionCount;
public virtual void Start()
{
fungusScript = GetFungusScript();
@ -67,8 +69,18 @@ namespace Fungus
return (fungusScript.activeSequence == this);
}
public int GetExecutionCount()
{
return executionCount;
}
public void ExecuteNextCommand(FungusCommand currentCommand = null)
{
if (currentCommand == null)
{
executionCount++;
}
activeCommand = null;
FungusCommand nextCommand = null;

Loading…
Cancel
Save