public DialogueVariables(string globalFilePath) { string inkFileContents = File.ReadAllText(globalFilePath); Ink.Compiler compiler = new Ink.Compiler(inkFileContents); Story globalVariblesStory = compiler.Compile(); variables = new Dictionary <string, Ink.Runtime.Object>(); foreach (string name in globalVariblesStory.variablesState) { Ink.Runtime.Object value = globalVariblesStory.variablesState.GetVariableWithName(name); variables.Add(name, value); Debug.Log("initialize global dialogue variable: " + name + "=" + value); } }
public async void StoryTrainingIntro() { if (running) { DialogueOverlay.TerminateCurrentStory = true; } var compiler = new Ink.Compiler(File.ReadAllText("Assets/Resources/Stories/Training.ink")); var story = compiler.Compile(); story.variablesState["IsFirstMet"] = isFirstMet; var shouldIntroduceMechanisms = Context.Player.ShouldOneShot("Training Mode: Should Introduce Mechanisms"); story.variablesState["ShouldIntroduceMechanisms"] = shouldIntroduceMechanisms; story.variablesState["SignedIn"] = signedIn; story.variablesState["Rating"] = rating; running = true; await DialogueOverlay.Show(story); running = false; if (shouldIntroduceMechanisms && (int)story.variablesState["IntroducedMechanisms"] == 0) { Context.Player.ClearOneShot("Training Mode: Should Introduce Mechanisms"); } }