Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.IO;
- public class DialogueParser : MonoBehaviour {
- public List<LineComponents> lines;
- public struct LineComponents
- {
- public string name;
- public string words;
- public int pose;
- public LineComponents(string getName, string getWords, int getPose)
- {
- name = getName;
- words = getWords;
- pose = getPose;
- }
- }
- public TextAsset openDialogue;
- public string[] readers;
- private DialogueDisplay dialogueDisplay;
- void Start()
- {
- dialogueDisplay = GameObject.Find("Canvas").GetComponent<DialogueDisplay>();
- lines = new List<LineComponents>();
- }
- void Update()
- {
- BuildDialogue();
- }
- void BuildDialogue()
- {
- readers = dialogueDisplay.currentString.Split('#');
- LineComponents entries = new LineComponents(readers[0], readers[1],
- int.Parse(readers[2]));
- lines.Add(entries);
- }
- //for displaying name, dialogue, and pose
- public string GetName(int lineNumber)
- {
- return lines[lineNumber].name;
- }
- public string GetWords(int lineNumber)
- {
- return lines[lineNumber].words;
- }
- /*public int GetPose(int lineNumber)
- {
- if (lineNumber < lines.Count)
- {
- return lines[lineNumber].pose;
- }
- else return 0;
- }*/
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement