public TagYarnDialogSelector(string[] fileContent) : this(new Yarn.MemoryVariableStore()) { foreach (var content in fileContent) { Dialogue.LoadString(content); } }
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)); }
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)); }
private void LoadDialogueString(string fileContent) { try { dialogue.LoadString(fileContent); } catch (InvalidOperationException e) { DebugLog.Err(e); } }
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")); }
public YarnDialogSelector(string fileContent) : this() { dialogue.LoadString(fileContent); }
void Start() { // Ensure that we have our Implementation object if (dialogueUI == null) { Debug.LogError ("Implementation was not set! Can't run the dialogue!"); return; } // 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 (); // Create the main Dialogue runner, and pass our variableStorage to it dialogue = new Yarn.Dialogue (variableStorage); // Set up the logging system. dialogue.LogDebugMessage = Debug.Log; dialogue.LogErrorMessage = Debug.LogError; // Load all JSON foreach (var source in sourceText) { dialogue.LoadString (source.text); } if (startAutomatically) { StartDialogue(); } }