ArticyFlowPlayer: How to Know If A Flow Has Reached Its End?

Fri 29. Nov 2019, 21:22

Hi, have checked the documents and tried to play with OnBranchesUpdated. Couldn't find a stable way to check if a flow has reached its end or not. Any suggestions?
shanehou
 
Posts: 7
Joined: Wed 20. Nov 2019, 23:53

Re: ArticyFlowPlayer: How to Know If A Flow Has Reached Its

Mon 2. Dec 2019, 09:24

Hi shanehou,

The "End" is not always the same for each project. For example in our Demo Project a Dialogue has reached its end when all branches are not of the DialogueFragment type anymore, then we hide the Dialogue UI.
But the easiest is just checking if the list of branches is empty, that will tell you that you reached the end of your flow. Or do you need something different?

Best regards

Nico
Nico Probst
Senior Software Engineer | Articy | LinkedIn
User avatar
[Articy] Nico Probst
Articy Staff
Articy Staff
 
Posts: 217
Joined: Wed 23. Nov 2011, 09:45
Location: Bochum

Re: ArticyFlowPlayer: How to Know If A Flow Has Reached Its

Mon 2. Dec 2019, 16:37

Hi Nico,

To check the numbers of the branch list was my first attempt, but I found it had some interesting behaviours. Below is part of the code I'm using:

Code: Select all
public void OnBranchesUpdated(IList<Branch> aBranches)
{
    string branchName = "-1";
    if (aBranches.Count > 0)
    {
      branchName = aBranches[0].DefaultDescription;
    }

    Debug.Log("OnBranchesUpdated " + branchName + " branch cnt " + aBranches.Count);
}

public void Init(ArticyObject flowObj = null)
  {
    if (flowObj != null)
    {
      ArticyFlowPlayer flowPlayer = GetComponent<ArticyFlowPlayer>();
      flowPlayer.StartOn = flowObj;
      flowPlayer.Play();
    }
  }


So basically for the first attempt of running the Articy flow, the debug message would always be:

Code: Select all
OnBranchesUpdated -1 branch cnt 0


I have also made some debug code for advancing the flow, the other outputs looked correct though. To the end of the flow, the message above showed again as what you've said. I tried to keep running the flow and found other messages like below:

Code: Select all
OnBranchesUpdated 0x100000000001168 branch cnt 1
OnBranchesUpdated 0x100000000001168 branch cnt 1
OnBranchesUpdated 0x100000000001168 branch cnt 1... (same results)


Since the count of the branch list is always zero at the first attempt of running the flow, it seems not possible to check if the flow reaches its end by using this method. I'm wondering if that's a bug or not?

My flow below:

https://i.imgur.com/1iOOHl4.png
shanehou
 
Posts: 7
Joined: Wed 20. Nov 2019, 23:53

Re: ArticyFlowPlayer: How to Know If A Flow Has Reached Its

Mon 2. Dec 2019, 16:39

[Articy] Nico Probst wrote:Hi shanehou,

The "End" is not always the same for each project. For example in our Demo Project a Dialogue has reached its end when all branches are not of the DialogueFragment type anymore, then we hide the Dialogue UI.
But the easiest is just checking if the list of branches is empty, that will tell you that you reached the end of your flow. Or do you need something different?

Best regards

Nico


Hi Nico,

To check the numbers of the branch list was my first attempt, but I found it had some interesting behaviours. Below is part of the code I'm using:

Code: Select all
public void OnBranchesUpdated(IList<Branch> aBranches)
{
    string branchName = "-1";
    if (aBranches.Count > 0)
    {
      branchName = aBranches[0].DefaultDescription;
    }

    Debug.Log("OnBranchesUpdated " + branchName + " branch cnt " + aBranches.Count);
}

public void Init(ArticyObject flowObj = null)
  {
    if (flowObj != null)
    {
      ArticyFlowPlayer flowPlayer = GetComponent<ArticyFlowPlayer>();
      flowPlayer.StartOn = flowObj;
      flowPlayer.Play();
    }
  }


So basically for the first attempt of running the Articy flow, the debug message would always be:

Code: Select all
OnBranchesUpdated -1 branch cnt 0


I have also made some debug code for advancing the flow, the other outputs looked correct though. To the end of the flow, the message above showed again as what you've said. I tried to keep running the flow and found other messages like below:

Code: Select all
OnBranchesUpdated 0x100000000001168 branch cnt 1
OnBranchesUpdated 0x100000000001168 branch cnt 1
OnBranchesUpdated 0x100000000001168 branch cnt 1... (same results)


Since the count of the branch list is always zero at the first attempt of running the flow, it seems not possible to check if the flow reaches its end by using this method. I'm wondering if that's a bug or not?

My flow below:

https://i.imgur.com/1iOOHl4.png
shanehou
 
Posts: 7
Joined: Wed 20. Nov 2019, 23:53

Re: ArticyFlowPlayer: How to Know If A Flow Has Reached Its

Tue 3. Dec 2019, 09:56

Code: Select all
flowPlayer.StartOn = flowObj;
flowPlayer.Play();



Just want to point out that setting the StartOn will automatically "start" the flow, traversing until the first PauseOn is hit. When the flowObj is already a PausedOn the flow player will pause directly, and your Play() call restarts directly again. This all might be intentional, i just wanted to clarify it.

So regarding your output, this could be a bug, it should not report zero if there are any. I will check on that.

Best regards

Nico
Nico Probst
Senior Software Engineer | Articy | LinkedIn
User avatar
[Articy] Nico Probst
Articy Staff
Articy Staff
 
Posts: 217
Joined: Wed 23. Nov 2011, 09:45
Location: Bochum

Return to articy:draft Unity Importer

Who is online

Users browsing this forum: No registered users and 10 guests

Who We Are
Contact Us
Social Links