private RpgtalkElement readSceneElement(string line) { RpgtalkElement newElement = new RpgtalkElement(); newElement.originalSpeakerName = line; //replace any variable that may exist on the text if (line.Contains("*mutation*")) { line = line.Replace("*mutation*", caractMonster); } if (line.Contains("*cheveux*")) { line = line.Replace("*cheveux*", caractHumain); } //If we want to show the dialoger's name, slipt the line at the ':' if (dialoger) { if (line.IndexOf(':') != -1) { string[] splitLine = line.Split(new char[] { ':' }, 2); newElement.speakerName = splitLine [0].Trim(); newElement.dialogText = splitLine [1].Trim(); string[] originalSplitLine = newElement.originalSpeakerName.Split(new char[] { ':' }, 2); newElement.originalSpeakerName = originalSplitLine [0].Trim(); } else { newElement.dialogText = line; } } else { newElement.dialogText = line; } newElement.hasDialog = true; return(newElement); }
private RpgtalkElement readSceneElement(string line) { RpgtalkElement newElement = new RpgtalkElement(); newElement.originalSpeakerName = line; //replace any variable that may exist on the text for (int i = 0; i < variables.Length; i++) { if (line.Contains(variables[i].variableName)) { line = line.Replace(variables[i].variableName, variables[i].variableValue); } } //If we want to show the dialoger's name, slipt the line at the ':' if (dialoger) { if (line.IndexOf(':') != -1) { string[] splitLine = line.Split(new char[] { ':' }, 2); newElement.speakerName = splitLine [0].Trim(); newElement.dialogText = splitLine [1].Trim(); string[] originalSplitLine = newElement.originalSpeakerName.Split(new char[] { ':' }, 2); newElement.originalSpeakerName = originalSplitLine [0].Trim(); } else { newElement.dialogText = line; } } else { newElement.dialogText = line; } newElement.hasDialog = true; return(newElement); }
/// <summary> /// Plays the next dialog in the current Talk. /// </summary> public void PlayNext() { // increment the cutscene counter cutscenePosition++; currentChar = 0; /*if (triggerInLineName != "" && cutscenePosition == triggerInLine) { * animatorWhenTalking.SetTrigger (triggerInLineName); * }*/ CancelInvoke("blink"); if (blinkWhenReady) { blinkWhenReady.SetActive(false); } if (cutscenePosition <= rpgtalkElements.Count) { textUI.enabled = true; RpgtalkElement currentRpgtalkElement = rpgtalkElements[cutscenePosition - 1]; if (dialoger) { dialogerUI.enabled = true; dialogerUI.text = currentRpgtalkElement.speakerName; if (shouldUsePhotos) { for (int i = 0; i < photos.Length; i++) { if (photos[i].name == currentRpgtalkElement.originalSpeakerName) { UIPhoto.sprite = photos[i].photo; if (animatorWhenTalking && animatorIntName != "") { animatorWhenTalking.SetInteger(animatorIntName, i); } } } } } //if we have an animator.. play it if (animatorWhenTalking != null) { animatorWhenTalking.SetBool(animatorBooleanName, true); } } else { if (!shouldStayOnScreen) { textUI.enabled = false; if (dialoger) { dialogerUI.enabled = false; } for (int i = 0; i < showWithDialog.Length; i++) { showWithDialog[i].SetActive(false); } } if (callbackScript != null) { callbackScript.Invoke(callbackFunction, 0f); } } }