private void LoadNPCSpeakData(string pathName, Dictionary <int, NPCSpeakData> DataDic) { string path = "Config" + "/" + "NPC"; string text = ResourcesManager.Instance.LoadConfig(path, pathName).text; XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(text); XmlNode node = xmlDoc.SelectSingleNode("NPCConfig"); XmlNodeList nodeList = node.ChildNodes; foreach (XmlNode item in nodeList) { XmlNode id = item.SelectSingleNode("id"); XmlNode main = item.SelectSingleNode("Main"); XmlNode SpeakCout = item.SelectSingleNode("SpeakCout"); XmlNode Speak = item.SelectSingleNode("Speak"); NPCSpeakData data = new NPCSpeakData(); foreach (XmlNode pair in Speak) { data.storyData.SpeakList.Add(pair.InnerText); } foreach (XmlNode pair in main) { data.MainList.Add(pair.InnerText); } data.Id = CommonHelper.Str2Int(id.InnerText); data.SpeakCount = CommonHelper.Str2Int(SpeakCout.InnerText); DataDic.Add(data.Id, data); } }
void KongWuEnterEventOneSpeak0() { GUIManager.HideView("InputPanel"); NPCSpeakData data = GetDataByID(2, 0); TalkManager.Instance.ShowTalkPanel(data.storyData, 0); }
void MarisaEnterEventOneSpeak23() { GUIManager.HideView("InputPanel"); NPCSpeakData data = GetDataByID(0, 0); TalkManager.Instance.ShowTalkPanel(data.storyData, 23); }
/// <summary> /// 第一个参数代表NPC字典编号,第二个参数代表NPC的 /// </summary> /// <param name="dicIndex"></param> /// <param name="id"></param> /// <returns></returns> NPCSpeakData GetDataByID(int dicIndex, int id) { Dictionary <int, NPCSpeakData> speakDic = GetNPCDicById(dicIndex); NPCSpeakData data = null; if (!speakDic.TryGetValue(id, out data)) { Debug.LogError("NPCSpeakManager data has error"); } return(data); }
protected override void OnShow() { NPCSpeakDic = NPCSpeakManager.Instance.GetNPCDicById(NPCId); inputPanel.transform.localPosition = new Vector3(38, 198, 0); isChange = false; foreach (KeyValuePair <int, NPCSpeakData> item in NPCSpeakDic) { if (item.Key == eventId) { m_NPCSpeakData = item.Value; } } }
void InitHnader() { NPCSpeakData data = GetDataByID(0, 0); data.OnEnterDownDic.Add(0, MarisaEnterEventOneSpeak0); data.OnEnterDownDic.Add(1, MarisaEnterEventOneSpeak1); data.OnEnterDownDic.Add(2, MarisaEnterEventOneSpeak1); data.OnEnterDownDic.Add(3, MarisaEnterEventOneSpeak2); data.OnEnterDownDic.Add(4, MarisaEnterEventOneSpeak2); data.OnEnterDownDic.Add(5, MarisaEnterEventOneSpeak2); data.OnEnterDownDic.Add(6, MarisaEnterEventOneSpeak2); data.OnEnterDownDic.Add(7, MarisaEnterEventOneSpeak3); data.OnEnterDownDic.Add(8, MarisaEnterEventOneSpeak3); data.OnEnterDownDic.Add(9, MarisaEnterEventOneSpeak6); data.OnEnterDownDic.Add(10, MarisaEnterEventOneSpeak4); data.OnEnterDownDic.Add(11, MarisaEnterEventOneSpeak4); data.OnEnterDownDic.Add(12, MarisaEnterEventOneSpeak4); data.OnEnterDownDic.Add(13, MarisaEnterEventOneSpeak7); data.OnEnterDownDic.Add(14, MarisaEnterEventOneSpeak7); data.OnEnterDownDic.Add(15, MarisaEnterEventOneSpeak8); data.OnEnterDownDic.Add(16, MarisaEnterEventOneSpeak9); data.OnEnterDownDic.Add(17, MarisaEnterEventOneSpeak9); data.OnEnterDownDic.Add(18, MarisaEnterEventOneSpeak12); data.OnEnterDownDic.Add(19, MarisaEnterEventOneSpeak11); data.OnEnterDownDic.Add(20, MarisaEnterEventOneSpeak10); data.OnEnterDownDic.Add(21, MarisaEnterEventOneSpeak12); data.OnEnterDownDic.Add(22, MarisaEnterEventOneSpeak13); data.OnEnterDownDic.Add(23, MarisaEnterEventOneSpeak13); data.OnEnterDownDic.Add(24, MarisaEnterEventOneSpeak13); data.OnEnterDownDic.Add(25, MarisaEnterEventOneSpeak14); data.OnEnterDownDic.Add(26, MarisaEnterEventOneSpeak15); data.OnEnterDownDic.Add(27, MarisaEnterEventOneSpeak16); data.OnEnterDownDic.Add(28, MarisaEnterEventOneSpeak16); data.OnEnterDownDic.Add(29, MarisaEnterEventOneSpeak17); data.OnEnterDownDic.Add(30, MarisaEnterEventOneSpeak18); data.OnEnterDownDic.Add(31, MarisaEnterEventOneSpeak19); data.OnEnterDownDic.Add(32, MarisaEnterEventOneSpeak19); data.OnEnterDownDic.Add(33, MarisaEnterEventOneSpeak20); data.OnEnterDownDic.Add(34, MarisaEnterEventOneSpeak21); data.OnEnterDownDic.Add(35, MarisaEnterEventOneSpeak22); data.OnEnterDownDic.Add(36, MarisaEnterEventOneSpeak22); data.OnEnterDownDic.Add(37, MarisaEnterEventOneSpeak23); data.storyData.StoryHanderDic.Add(0, MarisaTalkChapterOne0); data.storyData.StoryHanderDic.Add(1, MarisaTalkChapterOne1); data.storyData.StoryHanderDic.Add(2, MarisaTalkChapterOne2); data.storyData.StoryHanderDic.Add(3, MarisaTalkChapterOne3); data.storyData.StoryHanderDic.Add(4, MarisaTalkChapterOne4); data.storyData.StoryHanderDic.Add(5, MarisaTalkChapterOne5); data.storyData.StoryHanderDic.Add(6, MarisaTalkChapterOne6); data.storyData.StoryHanderDic.Add(7, MarisaTalkChapterOne7); data.storyData.StoryHanderDic.Add(8, MarisaTalkChapterOne8); data.storyData.StoryHanderDic.Add(9, MarisaTalkChapterOne9); data.storyData.StoryHanderDic.Add(10, MarisaTalkChapterOne10); data.storyData.StoryHanderDic.Add(11, MarisaTalkChapterOne11); data.storyData.StoryHanderDic.Add(12, MarisaTalkChapterOne12); data.storyData.StoryHanderDic.Add(13, MarisaTalkChapterOne13); data.storyData.StoryHanderDic.Add(14, MarisaTalkChapterOne14); data.storyData.StoryHanderDic.Add(15, MarisaTalkChapterOne15); data.storyData.StoryHanderDic.Add(16, MarisaTalkChapterOne16); data.storyData.StoryHanderDic.Add(17, MarisaTalkChapterOne17); data.storyData.StoryHanderDic.Add(18, MarisaTalkChapterOne18); data.storyData.StoryHanderDic.Add(19, MarisaTalkChapterOne19); data.storyData.StoryHanderDic.Add(20, MarisaTalkChapterOne20); data.storyData.StoryHanderDic.Add(21, MarisaTalkChapterOne21); data.storyData.StoryHanderDic.Add(22, MarisaTalkChapterOne22); data.storyData.StoryHanderDic.Add(23, MarisaTalkChapterOne23); NPCSpeakData data1 = GetDataByID(2, 0); data1.OnEnterDownDic.Add(0, KongWuEnterEventOneSpeak0); //data1.storyData.StoryHanderDic.Add(0, KongWuTalkChapterOne0); }