public void OnFlowPlayerPaused(IFlowObject aObject)
    {
        var objWithText = aObject as IObjectWithText;

        if (objWithText != null)
        {
            Debug.Log(objWithText.Text); // teste para ler o texto no console
                                         //Call the story block generator which spawn a story block on screen

            GameController gc = GetComponent <GameController>();
            if (gc)
            {
                if (gc.StoryNodesList.Count > 0 &&
                    gc.StoryNodesList[gc.StoryNodesList.Count - 1].TextField &&
                    objWithText.Text == gc.StoryNodesList[gc.StoryNodesList.Count - 1].TextField.text)

                {
                    SceneManager.LoadScene("TheEnd");
                }
                else
                {
                    gc.GenerateStoryBlock(0, objWithText.Text);
                }
            }
        }
    }
    //To put it simple: IFlowObject is the basic type of anything the FlowPlayer can encounter while traversing..
    // That means every node, every pin and every connection is also an IFlowObject.If for some reason the passed
    // aObject is null, we have encountered a Dead End.
    protected override void DoOnFlowPlayerPaused(IFlowObject aObject)
    {
        // Debug.Log("**********************************************************************DoOnFlowPlayerPaused()");
        //Debug.Log("OnFlowPlayerPaused() IFlowObject Type: " + aObject.GetType() + ", with TechnicalName: " + ((ArticyObject)aObject).TechnicalName);
        StaticStuff.FlowDebug("**********************************************************************DoOnFlowPlayerPaused()");
        StaticStuff.FlowDebug("OnFlowPlayerPaused() IFlowObject Type: " + aObject.GetType() + ", with TechnicalName: " + ((ArticyObject)aObject).TechnicalName);
        CurPauseObject = aObject;
        // Note...a Dialogue Fragment is NOT a Flow Fragment
        var flowFragType = aObject as IObjectWithFeatureFlow_Fragment_Type;

        if (flowFragType != null)
        {
            Flow_Fragment_Type type     = flowFragType.GetFeatureFlow_Fragment_Type().Flow_Fragment_Type;
            FlowFragment       flowFrag = aObject as FlowFragment;
            //Debug.Log("Fragment name: " + flowFrag.DisplayName + ", has text: " + flowFrag.Text);
            //Debug.Log("enum val: " + type);
            StaticStuff.FlowDebug("Fragment name: " + flowFrag.DisplayName + ", has text: " + flowFrag.Text);
            StaticStuff.FlowDebug("enum val: " + type);
        }
        var dialogueFrag = aObject as Dialogue_Fragment;

        if (dialogueFrag != null)
        {
            //Debug.Log("We have a dialogue fragment...so DO SOMETHING");
            StaticStuff.FlowDebug("We have a dialogue fragment...so don't do anything since branch update will set up the dialogue fragment stuff there");
            // monote - "Ship.DoOnFlowPlayerPaused() about to show dialogue fragment"
            //Debug.LogWarning("We're changing the dialogue setup from Pause to BranchesUpdated because we can have more than 1");
            // base.ShowDialogueFragment(dialogueFrag);
        }
        //Debug.Log("**********DoOnFlowPlayerPaused() END");
        StaticStuff.FlowDebug("**********DoOnFlowPlayerPaused() END");
    }
Beispiel #3
0
    // method to find a preview image to show in the ui.
    private void ExtractCurrentPausePreviewImage(IFlowObject aObject)
    {
        IAsset articyAsset = null;

        // to figure out which asset we could show in our preview, we first try to see if it is an object with a speaker
        var dlgSpeaker = aObject as IObjectWithSpeaker;

        if (dlgSpeaker != null)
        {
            // if we have a speaker, we extract it, because now we have to check if it has a preview image.
            ArticyObject speaker = dlgSpeaker.Speaker;
            if (speaker != null)
            {
                var speakerWithPreviewImage = speaker as IObjectWithPreviewImage;
                if (speakerWithPreviewImage != null)
                {
                    // our speaker has the property for preview image and we assign it to our asset.
                    articyAsset = speakerWithPreviewImage.PreviewImage.Asset;
                }
            }
        }

        // if we have no asset until now, we could try to check if the target itself has a preview image.
        if (articyAsset == null)
        {
            var objectWithPreviewImage = aObject as IObjectWithPreviewImage;
            if (objectWithPreviewImage != null)
            {
                articyAsset = objectWithPreviewImage.PreviewImage.Asset;
            }
        }
    }
 public void OnFlowPlayerPaused(IFlowObject aObject)
 {
     if (aObject == null)
     {
         Debug.LogWarning("NULL aObject in OnFlowPlayerPaused()."); return;
     }
     DoOnFlowPlayerPaused(aObject);
 }
Beispiel #5
0
 public void OnFlowPlayerPaused(IFlowObject aObject)
 {
     if (aObject == null)
     {
         Debug.LogWarning("NULL aObject in OnFlowPlayerPaused()."); return;
     }
     Debug.Log("OnFlowPlayerPaused() IFlowObject Type: " + aObject.GetType());
 }
 public override void Traverse(IFlowObject flowObject)
 {
     if (flowObject is MissionFlowFragment missionFlowFragment)
     {
         _uiManager.SetObjective(missionFlowFragment.Text);
         Debug.Log($"#Objective#Setting objective {missionFlowFragment.Text}.");
     }
 }
    /// <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)
    {
        // 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)
        {
            flowPlayer.Play();
            return;
        }

        // here we extract any Text from the paused object.
        // In most cases this is the spoken text of a dialogue fragment
        var modelWithText = aObject as IObjectWithLocalizableText;

        if (modelWithText != null)
        {
            // but we are not taking Text directly and assigning it to the ui control
            // we take the LocaKey and assign it to our caretaker. The caretaker will localize it
            // using the current language and will set it to our text control. The caretaker will also make sure that the text
            // is updated and localized again if we change the language while it is currently displayed to the screen.
            dialogText.LocaKey = modelWithText.LocaKey_Text;
        }

        // finally we update the speaker image in our ui, by checking if the paused object has a speaker
        var dlgSpeaker = aObject as IObjectWithSpeaker;

        if (dlgSpeaker != null)
        {
            // getting the speaker object
            var speaker = dlgSpeaker.Speaker;
            if (speaker != null)
            {
                // checking if the speaker itself has a preview image
                var speakerAsset = ((speaker as IObjectWithPreviewImage).PreviewImage.Asset as Asset);
                if (speakerAsset != null)
                {
                    // and finally loading the preview image as a sprite and assign it to our image control
                    speakerImage.sprite = speakerAsset.LoadAssetAsSprite();
                }
            }
        }

        // the dialog choice contains a script that is called when this dialog option was taken
        // modifying the moral outcome of the play through
        var dialogChoice = aObject as DialogChoice;

        if (dialogChoice != null)
        {
            dialogChoice.Template.DialogChoice.MoraleChange.CallScript();
        }
    }
    public void OnFlowPlayerPaused(IFlowObject aObject)
    {
        if (PlayerStandBy)
        {
            return;
        }
        _currentSpeed = (float)textSpeed * 0.02f;

        if (aObject is PhraseDialogueFragment df)
        {
            Current = aObject as PhraseDialogueFragment;
            _spawner.SpawnPhrase(df.Text);
        }
    }
    public void OnFlowPlayerPaused(IFlowObject aObject)
    {
        // we just print every text to the console

        //Au lieu de print dans la console, display le texte au bon endroit comme dans les scripts de display
        //Voir pour setActive() des bouttons en fonction du nombre de possibilités de réponses et display les textes de réponse sur ces boutons

        var textObject = aObject as IObjectWithText;

        if (textObject != null)
        {
            Debug.Log(textObject.Text);
        }
    }
    // This is called everytime the flow player reaches and object of interest.
    public void OnFlowPlayerPaused(IFlowObject aObject)
    {
        if (aObject != null)
        {
            typeLabel.text = aObject.GetType().Name;

            // reset, just in case we don't have any
            idLabel.text            = string.Empty;
            technicalNameLabel.text = string.Empty;

            var articyObj = aObject as IArticyObject;

            if (articyObj != null)
            {
                idLabel.text            = articyObj.Id.ToHex();
                technicalNameLabel.text = articyObj.TechnicalName;
            }
        }
        // To show the displayname in the ui of the current node
        var modelWithDisplayName = aObject as IObjectWithDisplayName;

        if (modelWithDisplayName != null)
        {
            displayNameLabel.text = modelWithDisplayName.DisplayName;
        }
        else
        {
            displayNameLabel.text = string.Empty;
        }

        // To show text in the ui of the current node
        // we just check if it has a text property by using the object property interfaces, if it has the property we use it to show the text in our main text label.
        var modelWithText = aObject as IObjectWithText;

        if (modelWithText != null)
        {
            textLabel.text = modelWithText.Text;
        }
        else
        {
            textLabel.text = string.Empty;
        }

        // this will make sure that we find a proper preview image to show in our ui.
        ExtractCurrentPausePreviewImage(aObject);
    }
Beispiel #11
0
    // This is called everytime the flow player reaches and object of interest.
    public void OnFlowPlayerPaused(IFlowObject aObject)
    {
        // To show text in the ui of the current node
        // we just check if it has a text property by using the object property interfaces, if it has the property we use it to show the text in our main text label.
        var modelWithText = aObject as IObjectWithText;

        if (modelWithText != null)
        {
            textLabel.text = modelWithText.Text;
        }
        else
        {
            textLabel.text = string.Empty;
        }

        var chapterObject = aObject as Articy.Asylumjame.Chapter;

        if (chapterObject != null)
        {
            //this is a chapter, not a normal node
            //show chapter image and hide text
            chapterImage.enabled = true;
            //var sprite = (IAsset)chapterObject.Template.ChapterFeatures.ChapterImage;
            //Sprite s = sprite.LoadAssetAsSprite();
            //chapterImage.sprite = s;
            //CHECK FOR CHAPTER NUMBER
            chapterIndex++;
            chapterUpdate(chapterIndex);
        }
        else
        {
            chapterImage.enabled = false;
            //this is NOT a chapter header,
            //hide chapter image, show text
        }

        // this will make sure that we find a proper preview image to show in our ui.
        //ExtractCurrentPausePreviewImage(aObject);

        FlowIsUpdated();
    }
    public override void Traverse(IFlowObject flowObject)
    {
        AboutToRequestMain = false;
#if UNITY_EDITOR
        if (editor_SkipDialogues)
        {
            return;
        }
#endif
        if (flowObject is Dialogue dialogue)
        {
            AboutToRequestMain = true;
            return;
        }

        if (flowObject is DialogueFragment dialogueFragment)
        {
            AboutToRequestMain = true;
            OnDialogue(dialogueFragment);
        }
    }
Beispiel #13
0
    // This is called everytime the flow player reaches and object of interest.
    public void OnFlowPlayerPaused(IFlowObject aObject)
    {
        if (aObject != null)
        {
            IArticyObject articyObj = aObject as IArticyObject;
        }
        // To show text in the ui of the current node
        // we just check if it has a text property by using the object property interfaces,
        // if it has the property we use it to show the text in our main text label.
        var modelWithText = aObject as IObjectWithText;

        if (modelWithText != null)
        {
            textLabel.text = modelWithText.Text;
        }
        else
        {
            EndDialog();
        }
        //textLabel.text = string.Empty;

        // this will make sure that we find a proper preview image to show in our ui.
        ExtractCurrentPausePreviewImage(aObject);
    }
 public override void Traverse(IFlowObject flowObject)
 {
     AboutToRequestMain = flowObject is VideoFlowFragment;
 }
Beispiel #15
0
 /// <summary>
 /// Receives the current node and decides if this manager should request
 /// to control the articy player.
 /// </summary>
 /// <param name="flowObject">The current node in the graph</param>
 public abstract void Traverse(IFlowObject flowObject);
 public override void Traverse(IFlowObject flowObject)
 {
 }
 protected virtual void DoOnFlowPlayerPaused(IFlowObject aObject)
 {
 }