Exemplo n.º 1
0
        /// Start the dialogue
        void Start()
        {
            // Ensure that we have our Implementation object
            if (dialogueUI == null)
            {
                Debug.LogError("Implementation was not set! Can't run the dialogue!");
                return;
            }

            variableStorage = FindObjectOfType <VariableStorageBehaviour>();
            // And that we have our variable storage object
            if (variableStorage == null)
            {
                Debug.LogError("Variable storage was not set! Can't run the dialogue!");
                return;
            }


            // Ensure that the variable storage has the right stuff in it
            variableStorage.ResetToDefaults();

            // Load all scripts
            if (sourceText != null)
            {
                foreach (var source in sourceText)
                {
                    // load and compile the text
                    dialogue.LoadString(source.text, source.name);
                }
            }

            if (startAutomatically)
            {
                StartDialogue();
            }

            if (stringGroups != null)
            {
                // Load the string table for this language, if appropriate
                var stringsGroup = new List <LocalisedStringGroup>(stringGroups).Find(
                    entry => entry.language == (shouldOverrideLanguage ? overrideLanguage : Application.systemLanguage)
                    );

                if (stringsGroup != null)
                {
                    foreach (var table in stringsGroup.stringFiles)
                    {
                        this.AddStringTable(table.text);
                    }
                }
            }
        }