OnFlowPlayerPaused & flowPlayer.Play()

Thu 16. Mar 2017, 10:55

Hi,

I think I miss something, I try to do the prototype of my game. I have some Dialogue wich got some Dialogue fragment: (the last it's just a try, I don't want two dialogue like that in the future)


Image
Image

I set my articyflow player on a dialogue with this :

Code: Select all
  public class entry : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, IPointerClickHandler
{
    public ArticyObject element; // My Dialogue
    public SceneHandler scene;
    public void OnPointerClick(PointerEventData eventData)
    {
        scene.ContinueFlow(element);
    }

    public void OnPointerEnter(PointerEventData eventData)
    {
       // throw new NotImplementedException();
    }

    public void OnPointerExit(PointerEventData eventData)
    {
        //throw new NotImplementedException();
    }
}


My SceneHandler :
Fil Message are Dialogue, and Message are Dialogue Frgment
Code: Select all
         
public class SceneHandler : MonoBehaviour, IArticyFlowPlayerCallbacks, IScriptMethodProvider
{
   #region fields and properties
   [Header("Setup")]

   [Header("UI")]

   [Header("Debug")]
   private ArticyFlowPlayer flowPlayer;
   public static SceneHandler instance;
    public GameObject filMessageContainer;
    public GameObject choiceMessagePrefab;
    public GameObject choiceMessageContainer;
    public GameObject HisMessage;
    public GameObject MyMessage;
    public GameObject canvas;
    public GameObject listcontainer;
    public GameObject view;
    public GameObject FilMessage;

    #endregion

    #region initialization

    void Awake()
   {
      if (instance == null)
      {
         instance = this;
            DontDestroyOnLoad(gameObject);


        }
        else if (instance != this)
      {
         Destroy(gameObject);
      }

      flowPlayer = GetComponent<ArticyFlowPlayer>();

   }

   #endregion

   /// <summary>
   /// This method is used to trigger different behaviours depending on the result or outcome of an interaction by the user.
   /// </summary>
   public void ContinueFlow(IArticyObject aObject)
   {

        Debug.Log("Id : " + aObject.Id + "   " + aObject.TechnicalName) ;


        if (aObject is FilMessage)
        {
            Debug.Log("FilMessage");

        }


       
        if (aObject is IEntity)
        {

            if (aObject is Liste)
            {
                Debug.Log("List");

                Liste liste = (Liste)aObject;
                foreach (ArticyObject obj in liste.Template.Liste.Elements)
                {
                    //FilMessage are Dialogue fragment
                    if (obj is FilMessage)
                    {
                        string nom = ((Contact)((FilMessage)obj).Template.FilMessage.Contact).Template.Contact.Name;
                        GameObject entry = Instantiate(FilMessage);
                        entry.transform.parent = view.transform;

                        entry.GetComponent<RectTransform>().offsetMin = new Vector2(0, 0);
                        entry.GetComponent<RectTransform>().offsetMax = new Vector2(0, 0);
                        entry.GetComponent<RectTransform>().anchorMin = new Vector2(0, 0);


                        entry.GetComponentInChildren<Text>().text = nom;
                        entry.GetComponentInChildren<entry>().element = obj;
                        entry.GetComponentInChildren<entry>().flow = flowPlayer;
                        entry.GetComponentInChildren<entry>().scene = this;
                        listcontainer.SetActive(true);
                    }
                }

            }
        } else if (aObject != null)
        {
            flowPlayer.StartOn = aObject;
        }
   }


   
   /// <summary>
   /// This is one of the important callbacks from the ArticyFlowPlayer, and will notify us about pausing on any flow object.
   /// It will make sure that the paused object is displayed in our dialog ui, by extracting its text, potential speaker etc.
   /// </summary>
   public void OnFlowPlayerPaused(IFlowObject aObject)
   {
        Debug.Log(flowPlayer.AvailableBranches.Count);

        // if the flow player paused on a dialog, we immediately continue, usually getting to the first dialogue fragment inside the dialogue
        // makes it more convenient to set the startOn to a dialogue
        if (aObject is IDialogue)
        {
             Debug.Log("PLAY " + ((Dialogue)aObject).DisplayName);
            flowPlayer.Play();
            return;
        }

        //Message are Dialogue Fragment
        if (aObject is Message)
        {
            for (int i = view.transform.childCount - 1; i >= 0; --i)
            {
                var child = view.transform.GetChild(i).gameObject;
                Destroy(child);
            }

            string nom = ((Contact)((DialogueFragment)aObject).Speaker).Template.Contact.Name;
            string content = ((DialogueFragment)aObject).Text;
            GameObject entry;
            if (nom != "Moi")
            {
                entry = Instantiate(HisMessage);
            }
            else
            {
                entry = Instantiate(MyMessage);

            }
            entry.transform.parent = view.transform;

            entry.GetComponent<RectTransform>().offsetMin = new Vector2(0, 0);
            entry.GetComponent<RectTransform>().offsetMax = new Vector2(0, 0);
            entry.GetComponent<RectTransform>().anchorMin = new Vector2(0, 0);
            entry.GetComponentInChildren<Text>().text = nom + " : " + content;
        }


   }

   /// <summary>
   /// This is the other important callback from the ArticyFlowPlayer, and is called everytime the flow player has new branches
   /// for us. We use that to update the list of buttons in our dialog interface.
   /// </summary>
   public void OnBranchesUpdated(IList<Branch> aBranches)
   {
        Debug.Log("OnBranchUpdated : " + aBranches.Count);
   }

the availaibleBranchesCount it's always equal to 0, The CurrentPause and the startOn switch correctly between FilMessage, but I never go into Messages, I think the AvailableBranch equal to 0 it's the problem, But I don't find why I got that


I tryed to find what I missed in the Maniac Manfred example, but I don't find at all.


If you have an idea where I have to look up :confused:

Have a nice day,

Zel'
User avatar
Zeldarck
 
Posts: 55
Joined: Thu 9. Mar 2017, 16:03

Re: OnFlowPlayerPaused & flowPlayer.Play()

Thu 16. Mar 2017, 11:22

Hi Zeldarck,

on first sight i can't find a problem either. But i can't read the names on the first image, so i'm not sure on which object you are actually starting.
You said that the CurrentStop is changing, so the flow player seems to do something. But the available branches are 0, this would indeed be odd.

One thing to check if your flow is correctly setup is to use the ArticyDebugFlowPlayer. To do that, create a new scene, just for testing. Add a Canvas and drag and drop the
/Assets/ArticyImporter/Helper/ArticyDebugFlowPlayer.prefab
into the newly created canvas. Set a startOn node via the unity inspector and hit play in unity.

You should now see the correct object with the correct amount of branches as buttons. And clicking those buttons should correctly traverse your flow.
If something does not look right here, its very likely that you have a problem in your flow already in articy(missing connection), disabled a flow important node in the datalayout, or there is a bug in the flow player.

If all that leads to nothing, you can send me your project via email and i will have a look.

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: OnFlowPlayerPaused & flowPlayer.Play()

Thu 16. Mar 2017, 12:48

Thank for the answer,

I tryed with the DebugFlow and all it's ok when I play on a Dialogue.

Maybe I was unclear, the current stop change when I switch between dialogue, but it never go inside them. I send you by mail (at support@nevigo.com] my projet, it's will be more clear :)

Sorry for the screens, there is news:

Image
Image

I continue to search what are difference between Manfred and I :)
User avatar
Zeldarck
 
Posts: 55
Joined: Thu 9. Mar 2017, 16:03

Re: OnFlowPlayerPaused & flowPlayer.Play()

Thu 16. Mar 2017, 13:21

If Somebody have the same problem in the future, Nico found the problem:

Hi Zeldarck,

i had a look on your project and the problem appears because of a small bug in the plugin.

Your flowplayer is not set to use the default global variables. This is to assign a custom one, but i wrote in the helpbox that if you leave that empty, the default one will be used. That is not correct and probably what threw you off.

Image

To fix the issue, just reenable the checkbox to use the default one, or supply a copy and drop it into the "Global Variables" field below it. And it should work again.

Best regards,

Nico
Nevigo Support Team


Thank again :)
User avatar
Zeldarck
 
Posts: 55
Joined: Thu 9. Mar 2017, 16:03

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