void PlaytestFrom_Internal(string startPassageName, bool reset = true, int onlyFromThisNodeID = -1)
        {
            if (reset)
            {
                MerinoEditorWindow.errorLog.Clear();
                dialogue.Stop();
                dialogue.UnloadAll();
                varStorage.ResetToDefaults();

                try
                {
                    var program = MerinoCore.SaveAllNodesAsString(onlyFromThisNodeID);
                    if (!string.IsNullOrEmpty(program))
                    {
                        string filename = MerinoData.CurrentFiles.Count > 1 ? "<input>" : MerinoData.CurrentFiles[0].name;
                        if (onlyFromThisNodeID > 0 && MerinoData.GetNode(onlyFromThisNodeID).leafType == MerinoTreeElement.LeafType.File)
                        {
                            filename = MerinoData.GetNode(onlyFromThisNodeID).name;
                        }
                        dialogue.LoadString(program, filename);
                    }
                }
                catch (Exception ex)
                {
                    validDialogue = false;
                    PlaytestErrorLog(ex.Message);
                    return;
                }
            }

            validDialogue = true;
            this.StopAllCoroutines();
            this.StartCoroutine(RunDialogue(startPassageName));
        }
示例#2
0
        void PlaytestFrom_Internal(string startPassageName, bool reset = true)
        {
            if (reset)
            {
                MerinoEditorWindow.errorLog.Clear();
                dialogue.Stop();
                dialogue.UnloadAll();
                varStorage.ResetToDefaults();

                try
                {
                    var program = MerinoCore.SaveAllNodesAsString();
                    if (!string.IsNullOrEmpty(program))
                    {
                        dialogue.LoadString(program);
                    }
                }
                catch (Exception ex)
                {
                    validDialogue = false;
                    PlaytestErrorLog(ex.Message);
                    return;
                }
            }

            validDialogue = true;
            this.StopAllCoroutines();
            this.StartCoroutine(RunDialogue(startPassageName));
        }
示例#3
0
        public void TestNodeExists()
        {
            dialogue.LoadFile("../Unity/Assets/Yarn Spinner/Examples/Demo Assets/Space.json");

            dialogue.Compile();

            Assert.True(dialogue.NodeExists("Sally"));

            // Test clearing everything
            dialogue.UnloadAll();

            // Load an empty node
            dialogue.LoadString("// Test, this is empty");
            dialogue.Compile();

            Assert.False(dialogue.NodeExists("Sally"));
        }