public void SetArgs() { if (args != null) { //Debug.LogWarning("Executing set args"); VsnSaveSystem.SetVariable("argsCount", args.Length); for (int i = 0; i < args.Length; i++) { if (args[i].GetType() == typeof(VsnNumber)) { VsnSaveSystem.SetVariable("arg" + (i + 1), args[i].GetNumberValue()); Debug.Log("Setting variable arg" + (i + 1) + " to value: " + args[i].GetNumberValue()); } else if (args[i].GetType() == typeof(VsnString)) { VsnSaveSystem.SetVariable("arg" + (i + 1), args[i].GetStringValue()); Debug.Log("Setting variable arg" + (i + 1) + " to value: " + args[i].GetStringValue()); } else { VsnSaveSystem.SetVariable("arg" + (i + 1), args[i].GetReference()); Debug.Log("Setting variable arg" + (i + 1) + " to value: " + args[i].GetReference()); } } } }
public static string InterpretStrings(string initialString) { string currentString = initialString; if (initialString == null) { return(""); } if (!initialString.Contains("\\")) { return(initialString); } do { initialString = currentString; currentString = currentString.Replace("\\number_input", VsnSaveSystem.GetIntVariable("number_input").ToString()); currentString = currentString.Replace("\\n", "\n"); currentString = currentString.Replace("\\coins", VsnSaveSystem.GetIntVariable("coins").ToString()); currentString = currentString.Replace("\\current_coins", VsnSaveSystem.GetIntVariable("current_coins").ToString()); } while (currentString != initialString); return(currentString); }
public override float GetNumberValue() { if (variableReferenceValue[0] == '#') { return(SpecialCodes.InterpretFloat(variableReferenceValue)); } return(VsnSaveSystem.GetFloatVariable(variableReferenceValue)); }
public void FinishMinigame() { Time.timeScale = 0; VsnSaveSystem.SetVariable("coins", coins); VsnSaveSystem.SetVariable("current_coins", coins); VsnSaveSystem.SetVariable("minigame_played", 1); VsnController.instance.StartVSNContent("say \"FIM DO MINIGAME!\"\nload_scene \"Main\"", "custom"); }
public override void Execute() { VsnArgument variableName = args[0]; VsnArgument valueToAdd = args[1]; float oldValue = VsnSaveSystem.GetFloatVariable(variableName.GetReference()); float newValue = oldValue + valueToAdd.GetNumberValue(); VsnSaveSystem.SetVariable(variableName.GetReference(), newValue); VsnSaveSystem.Save(0); }
void Start() { // Script is in the Resources folder. (e.g "VSN Scripts/example3" loads from "VSN/Resources/VSN Scripts/example3"). // "example1": basic Say, goto, waypoint // "example2": say with rich tags, choices // "example3": characters, alpha, move, say with text // "example4": example of transition with movex and wait with a character VsnSaveSystem.Load(0); VsnController.instance.StartVSN(scriptToPlay); }
public override void Execute() { int intSlot = 0; if (args.Length > 0) { intSlot = (int)args[0].GetNumberValue(); } VsnSaveSystem.Save(intSlot); }
public void OnTextInputConfirm() { if (string.IsNullOrEmpty(textInputField.text)) { // SoundManager.PlayForbiddenSound(); return; } VsnController.instance.state = ExecutionState.PLAYING; if (textInputField.text != "") { VsnSaveSystem.SetVariable("text_input", textInputField.text); VsnSaveSystem.SetVariable("number_input", int.Parse(textInputField.text)); } ShowTextInput(false); }
private void Start() { instance = this; UpdateUI(); VsnAudioManager.instance.PlayMusic("song_intro", "song_loop"); if (VsnSaveSystem.GetIntVariable("minigame_played") == 0) { VsnController.instance.StartVSN("intro"); } else { VsnSaveSystem.SetVariable("minigame_played", 0); VsnController.instance.StartVSN("return_minigame"); } }
public override void Execute() { float fvalue = args[1].GetNumberValue(); string svalue = args[1].GetStringValue(); Debug.Log("SET VAR FLOAT: " + fvalue + ", STRING: " + svalue); if (args[1].GetType() == typeof(VsnString) || (args[1].GetType() == typeof(VsnReference) && args[1].GetStringValue() != "")) { VsnSaveSystem.SetVariable(args[0].GetReference(), args[1].GetStringValue()); return; } else if (args[1].GetType() == typeof(VsnNumber) || (args[1].GetType() == typeof(VsnReference) && args[1].GetReference()[0] == '#')) { VsnSaveSystem.SetVariable(args[0].GetReference(), args[1].GetNumberValue()); return; } Debug.LogWarning(args[0].GetReference() + " var value: " + args[1].GetPrintableValue()); }
public void LoadVolume() { SetVolume(VsnSaveSystem.GetFloatVariable("audio", 1f)); }
void UpdateUI() { VsnUIManager.instance.scoreText.text = VsnSaveSystem.GetIntVariable("money").ToString(); }
public override string GetReference() { Debug.LogWarning("Meta value: " + metareferenceValue); Debug.LogWarning("Return from meta-reference: " + VsnSaveSystem.GetStringVariable(metareferenceValue)); return(VsnSaveSystem.GetStringVariable(metareferenceValue)); }
public override string GetStringValue() { return(SpecialCodes.InterpretStrings(VsnSaveSystem.GetStringVariable(variableReferenceValue))); }