public DialogueData FetchDialogueData(string inKey) { DialogueData Data = new DialogueData(); DialogueHandle Handle = this.FindDialogueHandle(inKey); this.ParseDialogueFile(Data, Handle); return(Data); }
private DialogueHandle ParseDialogueKey(string inKey) { //FALL TOTEM 1 // FALL|TOTEM|001 DialogueHandle handle = new DialogueHandle(); handle.dialogueKey = inKey; handle.directory += inKey.Replace("|", "/").ToLower(); return(handle); }
public DialogueHandle LoadNPCDialogue(HumanCharacter npc) { if (npc == null) { return(null); } XmlDocument xmlDoc = new XmlDocument(); string path = Application.dataPath + "/GameData/Dialogue/"; string dialogueID = npc.CharacterID; if (!File.Exists(path + dialogueID + ".xml")) { dialogueID = npc.SquadID; if (!File.Exists(path + dialogueID + ".xml")) { dialogueID = npc.Faction.ToString(); if (!File.Exists(path + dialogueID + ".xml")) { dialogueID = "Default"; } } } string file = File.ReadAllText(path + dialogueID + ".xml"); try { xmlDoc.LoadXml(file); } catch (XmlException) { return(null); } CurrentDialogXML = xmlDoc; string introText = ""; string nextNode = ""; DialogueHandle handle = new DialogueHandle(); if (GetDialogueIntro(out introText, out nextNode)) { handle.NextNode = nextNode; handle.IntroText = introText; return(handle); } return(null); }
private void ParseDialogueFile(DialogueData inData, DialogueHandle inHandle) { ///Use Unity's Text Assets. inData.handle = inHandle; Actors LineSpeaker = 0; TextAsset x = Resources.Load(inHandle.directory) as TextAsset; using (StringReader reader = new StringReader(x.text)) { string line = reader.ReadLine(); while (line != null) { inData.AddDialogueLine(ParseDialogueLine(line, LineSpeaker)); line = reader.ReadLine(); } } }
public override void Show() { NGUITools.SetActive(this.gameObject, true); this.IsActive = true; if (_entries == null) { _entries = new Stack <DialogueEntry>(); } if (_options == null) { _options = new List <DialogueOptionEntry>(); } if (_topics == null) { _topics = new List <TopicEntry>(); } InputEventHandler.Instance.State = UserInputState.Dialogue; HumanCharacter npc = (HumanCharacter)GameManager.Inst.PlayerControl.SelectedPC.MyAI.BlackBoard.InteractTarget; DialogueHandle handle = GameManager.Inst.DBManager.DBHandlerDialogue.LoadNPCDialogue(npc); if (handle == null) { return; } ClearDialogue(); ClearTopics(); LoadIntro(handle.IntroText); _currentNodeID = handle.NextNode; _rootNode = handle.NextNode; Time.timeScale = 0; RefreshDialogue(_currentNodeID, true); }
public DialogueHandle LoadNPCDialogue(HumanCharacter npc) { XmlDocument xmlDoc = new XmlDocument(); string path = Application.dataPath + "/GameData/Dialogue/"; string file = File.ReadAllText(path + "BaldMan.xml"); xmlDoc.LoadXml(file); CurrentDialogXML = xmlDoc; string introText = ""; string nextNode = ""; DialogueHandle handle = new DialogueHandle(); if(GetDialogueIntro(out introText, out nextNode)) { handle.NextNode = nextNode; handle.IntroText = introText; return handle; } return null; }