public override void OnStartConversation(ConversationsManager manager, object state)
        {
            if (manager == null)
            {
                throw new ArgumentNullException(nameof(manager));
            }

            manager.ExecuteNode(manager.RunningConversation.DefaultRootNodeID);
        }
        public void OnChoiceCN1Selected(ConversationsManager manager, object state)
        {
            string id = state as String;

            if (id == "sn_c1")
            {
                // We want to rest so?
                manager.ExecuteNode("node_002");
            }
            else
            {
                // Wrong call. We can fallback on the default handler.
                this.DefaultOnChoiceSelected(manager, state);
            }
        }
        public override void DefaultOnChoiceSelected(ConversationsManager manager, object state)
        {
            string id = state as String;

            switch (id)
            {
            case "text_sn_c1":
                // Wrong call.
                this.OnChoiceCN1Selected(manager, state);
                break;

            case "sn_c1":
                // Selected sn_c1
                break;

            case ReservedIdentifiers.DefaultContinueConversationChoiceID:
            default:
                manager.EndCurrentConversation();
                break;
            }
        }
Exemplo n.º 4
0
        public void Initialize()
        {
            string[] dialoguesJson = null;

            if (this.Initialized == false)
            {
                this.conversationsLocalesImporter = new ConversationsLocalesImporter();
                this.dialogueJsonConverter        = new DialogueSystemJsonConverter();

                this.conversationsManager = new ConversationsManager(this.dialogueJsonConverter);
                this.conversationsManager.ConversationStarted += ConversationsManager_ConversationStarted;
                this.conversationsManager.ConversationEnded   += ConversationsManager_ConversationEnded;

                // Import localizations

                this.conversationsLocalesImporter.RefreshStrings();
                this.conversationsManager.LocalizationManager.ImportLocales(this.conversationsLocalesImporter);

                // Import convesations

                dialoguesJson = this.GetDialoguesJsonFromAssets();

                foreach (string currentDialogueJson in dialoguesJson)
                {
                    this.conversationsManager.ParseConversation(currentDialogueJson);
                }

                // Init characters

                this.InitializeAdventureCharacters();

                // Init delegates

                this.InitializeConversationHandlers();

                this.Initialized = true;
            }
        }
Exemplo n.º 5
0
    void Start()
    {
        conversationsManager = transform.parent.transform.Find("ConversationsManager").GetComponent <ConversationsManager>();
        timeManager          = gameObject.GetComponent <TimeManager>();

        creditsScreen = GameObjectsList.gameObjectsList.creditsScreen;
        creditsScreen.SetActive(false);

        homeScreen = GameObjectsList.gameObjectsList.homeScreen;
        homeScreen.SetActive(false);
        messagesScreen = GameObjectsList.gameObjectsList.messagesScreen;
        messagesScreen.SetActive(false);
        flyrScreen = GameObjectsList.gameObjectsList.flyrScreen;
        flyrScreen.SetActive(false);

        headingText = GameObjectsList.gameObjectsList.headingText;

        heading_Bg_HomeScreen = GameObjectsList.gameObjectsList.heading_Bg_HomeScreen;
        heading_Bg_HomeScreen.SetActive(false);
        heading_Bg_Messages = GameObjectsList.gameObjectsList.heading_Bg_Messages;
        heading_Bg_Messages.SetActive(false);
        heading_Bg_Flyr = GameObjectsList.gameObjectsList.heading_Bg_Flyr;
        heading_Bg_Flyr.SetActive(false);

        returnButton = GameObjectsList.gameObjectsList.returnButton;
        GameObjectsList.gameObjectsList.returnButton.SetActive(false);
        returnButtonCredits = GameObjectsList.gameObjectsList.returnButtonCredits;
        GameObjectsList.gameObjectsList.returnButtonCredits.SetActive(false);

        creditsPage_2 = GameObjectsList.gameObjectsList.creditsPage_2;
        creditsPage_2.SetActive(false);
        GameObjectsList.gameObjectsList.previousCreditsPageButton.SetActive(false);

        GameObjectsList.gameObjectsList.endSceneCreditsPage_2.SetActive(false);
        GameObjectsList.gameObjectsList.endScenePreviousCreditsPageButton.SetActive(false);
    }
 public bool SnC1CanShow(ConversationsManager manager, object state)
 {
     return(true);
 }
 public override bool DefaultCanShow(ConversationsManager manager, object state)
 {
     return(true);
 }
 public override void DefaultDidExitNode(ConversationsManager manager, object state)
 {
     this.OnDidExitNode();
 }
        /// <summary>
        /// Converts the conversation json data class to a conversation model.
        /// </summary>
        /// <param name="source">Current json data class</param>
        /// <param name="manager">The manager that is linked to current conversation that is parsing the data.</param>
        /// <returns></returns>
        internal static Conversation AsConversation(this ConversationJsonData source, ConversationsManager manager)
        {
            Conversation            currentConversation = null;
            List <ConversationNode> nodesList           = null;

            currentConversation = new Conversation(manager,
                                                   source.ID,
                                                   source.DefaultRootNodeID,
                                                   source.OnStartConversation,
                                                   source.DidEnterNode,
                                                   source.DidExitNode,
                                                   source.DefaultOnSelected,
                                                   source.DefaultCanShow);

            nodesList = new List <ConversationNode>();

            foreach (ConversationNodeJsonData currentNodeData in source.Nodes)
            {
                ConversationNode currentConversationNode = null;

                currentConversationNode = currentNodeData.AsConversationNode(currentConversation);
                nodesList.Add(currentConversationNode);
            }
            currentConversation.AddConversationNodes(nodesList.ToArray());
            return(currentConversation);
        }