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)
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'