public SpeakingLine(string speaker, string lineText, int lineNumber, string label = "") : base(label) { if (lineText.StartsWith("**")) { type = DialogueBubbleType.Thought; } if (lineText.StartsWith("^^")) { type = DialogueBubbleType.Exclamation; } if (lineText.StartsWith("~~")) { type = DialogueBubbleType.Whisper; } if (lineText.StartsWith("``")) { type = DialogueBubbleType.Weak; } if (lineText.StartsWith("**") || lineText.StartsWith("^^") || lineText.StartsWith("~~")) { lineText = lineText.Substring(2); } content = new SpeakingLineContent(speaker, lineText, lineNumber); }
public static SpeechBubble GenerateSpeechBubblePrefab(DialogueBubbleType type = DialogueBubbleType.Speech) { SpeechBubble speechBubble = Instantiate(staticSpeechBubblePrefab).GetComponent <SpeechBubble>(); speechBubble.SetDialogueBubbleType(type); speechBubble.gameObject.SetActive(false); return(speechBubble); }
internal static ChoiceBubble GenerateChoiceBubblePrefab(int choiceCount, DialogueBubbleType type = DialogueBubbleType.Thought) { ChoiceBubble choiceBubble = Instantiate(staticSpeechChoicePrefab).GetComponent <ChoiceBubble>(); choiceBubble.SetDialogueBubbleType(type); choiceBubble.Instantiate(choiceCount); choiceBubble.gameObject.SetActive(false); return(choiceBubble); }
public static GameObject CreateBubble(DialogueBubbleType dialogBubbleType, Transform parent) { GameObject bubble = Instantiate(Resources.Load("bubbleDialog", typeof(GameObject))) as GameObject; if (dialogBubbleType == DialogueBubbleType.Think) { bubble.GetComponent <Bubble>().UseThinkBubble(); } bubble.transform.position = parent.position; bubble.transform.localScale = parent.localScale; bubble.GetComponent <Bubble>().parentTransform = parent; bubble.GetComponent <Bubble>().parentOriginPosition = parent.position; return(bubble); }
// Kinda hacked together choice system internal void DisplayChoices(ChoiceLine line, Vector3 speakerPosition, DialogueBubbleType type = DialogueBubbleType.Thought) { ready = false; List <ChoiceLineContent> choices = line.dialogueChoices; int lineNumber = choices[0].lineNumber; ChoiceBubble choiceBubble = DialogueUIController.GenerateChoiceBubblePrefab(choices.Count(), type); for (int i = 0; i < choices.Count; i++) { ChoiceLineContent content = choices[i]; choiceBubble.choicePanels[i].SetChoicePanelContent(content); } dialogueBubbles.Add(choiceBubble); DeployBubble(choiceBubble, speakerPosition); choiceBubble.UpdateOption(line.GetOptionIndex()); StartCoroutine(toggleChoices(line, choiceBubble)); StartCoroutine(animateLogs(lineNumber)); }
//Displays the a speech bubble according to its text and position in the overall dialogue public void DisplaySpeechBubble(SpeakingLineContent speakingLineContent, Vector3 speakerPosition, DialogueBubbleType type = DialogueBubbleType.Speech) { ready = false; int lineNumber = speakingLineContent.lineNumber; // *(offscreen dialogue we will need to handle seperately) SpeechBubble speechBubble = DialogueUIController.GenerateSpeechBubblePrefab(type); speechBubble.SetDialogueBubbleContent(speakingLineContent); dialogueBubbles.Add(speechBubble); DeployBubble(speechBubble, speakerPosition); StartCoroutine(animateLogs(lineNumber)); }
public void SetDialogueBubbleType(DialogueBubbleType type) { bubbleType = type; bubbleFrame.material = bubbleTypeMaterials[(int)bubbleType]; }