public void RefreshDialog() { if (ActualLanguage.actualLanguage != null) { int index = 0; string loadedJsonFile = Resources.Load <TextAsset>(ActualLanguage.actualLanguage.chosenLanguage.name).text; DialogueContainerOld dialoguesInJson = JsonUtility.FromJson <DialogueContainerOld>(loadedJsonFile); for (int i = 0; i < dialoguesInJson.dialogues.Length; i++) { if (dialoguesInJson.dialogues[i].id == ID) { index = i; } } if (isUGUI) { this.GetComponent <TMPro.TextMeshProUGUI>().text = dialoguesInJson.dialogues[index].lines[0]; } else { this.GetComponent <TMPro.TextMeshPro>().text = dialoguesInJson.dialogues[index].lines[0]; } } }
public void loadEndOfDialogueData() { string loadedJsonFile = Resources.Load <TextAsset>(ActualLanguage.actualLanguage.chosenLanguage.name).text; DialogueContainerOld dialoguesInJson = JsonUtility.FromJson <DialogueContainerOld>(loadedJsonFile); int dialogueID = findDialogueByID(tmp_dialogue_ID); Character dialogueCharacter = new Character(); switch (dialoguesInJson.dialogues[dialogueID].character) { case "Ice": dialogueCharacter = dialogueCharacter.Ice(); break; case "Earth": dialogueCharacter = dialogueCharacter.Earth(); break; case "Death": dialogueCharacter = dialogueCharacter.Death(); break; case "Wizard": dialogueCharacter = dialogueCharacter.Wizard(); break; default: dialogueCharacter = dialogueCharacter.Fire(); break; } dialogue1 = new OldDialogue(dialogueCharacter, dialoguesInJson.dialogues[dialogueID].lines, 0); dialogueMustStart = true; }
public void loadDialogueafterWait() { //Plus tard on chargera un JSON string loadedJsonFile = Resources.Load <TextAsset>(ActualLanguage.actualLanguage.chosenLanguage.name).text; DialogueContainerOld dialoguesInJson = JsonUtility.FromJson <DialogueContainerOld>(loadedJsonFile); int dialogueID = findDialogueByID(tmp_dialogue_ID); startId = dialoguesInJson.dialogues[dialogueID].next; if (videoValue != "" && timelineValues[videoValue].playableGraph.IsValid()) { timelineValues[videoValue].playableGraph.GetRootPlayable(0).SetSpeed(100); } videoValue = dialoguesInJson.dialogues[dialogueID].backgroundVideo; timelineValues[videoValue].Play(); if (fades && tmp_dialogue_ID != staticStartId) { Invoke("loadEndOfDialogueData", 0.6f); } else { loadEndOfDialogueData(); } }
public int findDialogueByID(int ID) { string loadedJsonFile = Resources.Load <TextAsset>(ActualLanguage.actualLanguage.chosenLanguage.name).text; DialogueContainerOld dialoguesInJson = JsonUtility.FromJson <DialogueContainerOld>(loadedJsonFile); for (int i = 0; i < dialoguesInJson.dialogues.Length; i++) { if (dialoguesInJson.dialogues[i].id == ID) { return(i); } } return(-1); }
private void LoadDialog(int _dialogueID) { //Plus tard on chargera un JSON string loadedJsonFile = Resources.Load <TextAsset>(ActualLanguage.actualLanguage.chosenLanguage.name).text; DialogueContainerOld dialoguesInJson = JsonUtility.FromJson <DialogueContainerOld>(loadedJsonFile); fader.FadeIn(0.3f); Invoke("afterFaded", 0.4f); int dialogueID = findDialogueByID(_dialogueID); startId = dialoguesInJson.dialogues[dialogueID].next; if (startId < 0) { waitForVideoToFinish = true; videoPlayer.isLooping = false; } videoValue = dialoguesInJson.dialogues[dialogueID].backgroundVideo; Character dialogueCharacter = new Character(); switch (dialoguesInJson.dialogues[dialogueID].character) { case "Ice": dialogueCharacter = dialogueCharacter.Ice(); break; case "Earth": dialogueCharacter = dialogueCharacter.Earth(); break; case "Death": dialogueCharacter = dialogueCharacter.Death(); break; case "Wizard": dialogueCharacter = dialogueCharacter.Wizard(); break; default: dialogueCharacter = dialogueCharacter.Fire(); break; } dialogue1 = new OldDialogue(dialogueCharacter, dialoguesInJson.dialogues[dialogueID].lines, 0); }
private void Start() { if (ActualLanguage.actualLanguage != null) { int index = 0; string loadedJsonFile = Resources.Load <TextAsset>(ActualLanguage.actualLanguage.chosenLanguage.name).text; DialogueContainerOld dialoguesInJson = JsonUtility.FromJson <DialogueContainerOld>(loadedJsonFile); for (int i = 0; i < dialoguesInJson.dialogues.Length; i++) { if (dialoguesInJson.dialogues[i].id == 1034) { index = i; } } loadingText = dialoguesInJson.dialogues[index].lines[0]; } }