Browse Source

Merge pull request #419 from FungusGames/fix-menu-button

Fixed menu buttons not executing target block
master
Chris Gregan 9 years ago
parent
commit
d86c1634a1
  1. 12
      Assets/Fungus/Flowchart/Scripts/Block.cs
  2. 2457
      Assets/Tests/Narrative/NarrativeTests.unity
  3. 27
      Assets/Tests/UI/FakeButtonClick.cs
  4. 12
      Assets/Tests/UI/FakeButtonClick.cs.meta

12
Assets/Fungus/Flowchart/Scripts/Block.cs

@ -142,12 +142,20 @@ namespace Fungus
return executionCount;
}
/// <summary>
/// Start a coroutine which executes all commands in the Block. Only one running instance of each Block is permitted.
/// </summary>
public virtual void Execute()
{
StartCoroutine(Execute(0, null));
}
/// <summary>
/// Execute the Block in a coroutine. Only one running instance of each Block is permitted.
/// A coroutine method that executes all commands in the Block. Only one running instance of each Block is permitted.
/// </summary>
/// <param name="commandIndex">Index of command to start execution at</param>
/// <param name="onComplete">Delegate function to call when execution completes</param>
public virtual IEnumerator Execute(int commandIndex = 0, Action onComplete = null)
public virtual IEnumerator Execute(int commandIndex, Action onComplete)
{
if (executionState != ExecutionState.Idle)
{

2457
Assets/Tests/Narrative/NarrativeTests.unity

File diff suppressed because it is too large Load Diff

27
Assets/Tests/UI/FakeButtonClick.cs

@ -0,0 +1,27 @@
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
namespace Fungus
{
/// <summary>
/// Test utility that simulates user clicking on a button after a delay.
/// </summary>
public class FakeButtonClick : MonoBehaviour
{
public float delay;
void Start ()
{
Invoke("DoFakeInput", delay);
}
void DoFakeInput()
{
Button button = GetComponent<Button>();
button.onClick.Invoke();
}
}
}

12
Assets/Tests/UI/FakeButtonClick.cs.meta

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b3c48140c357649cbab8cf65a56093b5
timeCreated: 1459430825
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Loading…
Cancel
Save