/// <summary> /// 得到并展示下一条对话信息 /// </summary> public void DisplayNextDialogInfo() { DialogSide diaSide = DialogSide.None; string strDialogPerson; string strDialogContent; bool boolResult = DialogDataMgr.GetInstance().GetNextDialogInfoRecoder(1, out diaSide, out strDialogPerson, out strDialogContent); if (boolResult) { switch (diaSide) { case DialogSide.None: break; case DialogSide.HeroSide: Txt_Side.text = "英雄"; break; case DialogSide.NPCSide: Txt_Side.text = "NPC"; break; default: break; } Txt_Person.text = strDialogPerson; Txt_Content.text = strDialogContent; } else { Txt_Content.text = "没有输出数据了"; } Log.SyncLogArrayToFile(); }
// Start is called before the first frame update IEnumerator Start() { //yield return new WaitForSeconds(GlobalParameter.INTERVAL_TIME_1); #region testing codes //test xml mgr //find file and load file Log.ClearLogFileAndBufferData(); XMLDialogsDataAnalysisMgr.GetInstance().SetXMLPathAndRootNodeName(KernalParameter.GetDialogConfigXMLPath(), KernalParameter.GetDialogConfigXMLRootNodeName()); //get data from file yield return(new WaitForSeconds(0.5f)); List <DialogDataFormat> lIDialogsDataArray = XMLDialogsDataAnalysisMgr.GetInstance().GetAllXMLDatas(); bool result = DialogDataMgr.GetInstance().LoadAllDialogData(lIDialogsDataArray); if (!result) { Log.Write(GetType() + "/Start()/LoadFiled"); } GlobalParaMgr.NextScenesName = ScenesEnum.MajorCity; StartCoroutine("LoadingScenesProgress"); #endregion //StartCoroutine("LoadingScenesProgress"); }
/// <summary> /// 公共方法:显示下一条对话,返回真表示对话结束 /// </summary> /// <param name="diaType"></param> /// <param name="SectionNum"></param> /// <returns> /// true: 对话结束 /// </returns> public bool DisplayNextDialog(DialogType diaType, int SectionNum) { bool isDialogEnd = false; //会话是否结束 DialogSide diaSide = DialogSide.None; //正在说话的一方 string strPerson; //讲述者 string strContent; //对话内容 //切换(选择)对话类型 ChangeDialogType(diaType); //得到会话信息(数据) bool flag = DialogDataMgr.GetInstance().GetNextDialogInfoRecoder(SectionNum, out diaSide, out strPerson, out strContent); if (flag) { //显示对话信息 DisplayDialogInfo(diaType, diaSide, strPerson, strContent); } else { //对话结束(没有对话信息了) isDialogEnd = true; } return(isDialogEnd); }
/// <summary> /// 预处理第一关卡 /// </summary> /// <returns></returns> IEnumerator ScenePreProgressing_Level1() { yield return(new WaitForSeconds(0.1f)); //参数赋值 DialogDataAnalysisMgr.GetInstance().SetXMLPathAndRooNodeName(KernelParameter.GetDialogConfigPath(), KernelParameter.GetDialogConfigRootNodeName()); //等待参数设置完毕(要比DialogDataAnalysisMgr的延迟方法慢) yield return(new WaitForSeconds(0.7f)); //很重要 //得到XML中所有的数据 List <DialogDataFormat> DialogsDataArray = DialogDataAnalysisMgr.GetInstance().GetAllXmlDataArray(); // 测试给“对话数据管理器”加载数据 bool boolResult = DialogDataMgr.GetInstance().LoadAllDialogData(DialogsDataArray); if (!boolResult) { Log.Write(GetType() + "/Start()/对话数据管理器加载数据失败", Log.Level.High); } }
/// <summary> /// preload level one /// </summary> /// <returns></returns> IEnumerator ScenesPreProgressing_LeveOne() { yield return(new WaitForSeconds(GlobalParameter.INTERVAL_TIME_0DOT1)); Log.ClearLogFileAndBufferData(); XMLDialogsDataAnalysisMgr.GetInstance().SetXMLPathAndRootNodeName(KernalParameter.GetDialogConfigXMLPath(), KernalParameter.GetDialogConfigXMLRootNodeName()); //get data from file yield return(new WaitForSeconds(0.5f)); List <DialogDataFormat> lIDialogsDataArray = XMLDialogsDataAnalysisMgr.GetInstance().GetAllXMLDatas(); bool result = DialogDataMgr.GetInstance().LoadAllDialogData(lIDialogsDataArray); if (!result) { Log.Write(GetType() + "/Start()/LoadFiled", Log.Level.High); } }
public void DisplayerNextDialogInfo() { DialogSide dialogSide = DialogSide.None; string strDialogPersonName; string strDialogPersonContent; bool result = DialogDataMgr.GetInstance().GetNextDialogInfoRecoder(2, out dialogSide, out strDialogPersonName, out strDialogPersonContent); if (result) { switch (dialogSide) { case DialogSide.None: break; case DialogSide.PlayerSide: TxtSide.text = "player"; break; case DialogSide.NPCSide: TxtSide.text = "npc"; break; default: break; } TxtPersonName.text = strDialogPersonName; TxtPersonContent.text = strDialogPersonContent; } else { TxtPersonName.text = "no output"; TxtPersonContent.text = "no output"; } Log.SyncLogArrayToFile(); }
/// <summary> /// show next dialog /// </summary> /// <param name="diaType">dialog type</param> /// <param name="dialogSectionNum">dialog section number</param> /// <returns></returns> public bool DisplayNextDialog(DialogType diaType, int dialogSectionNum) { bool isDialogEnd = false; DialogSide dialogSide = DialogSide.None; //he who talks(player or npc) string strPersonName; //person name string strDialogContent; //dialog info //change dialog type ChangeDialogType(diaType); //get dialog info data bool boolFlag = DialogDataMgr.GetInstance().GetNextDialogInfoRecoder(dialogSectionNum, out dialogSide, out strPersonName, out strDialogContent); if (boolFlag) { DisplayDialogInfo(diaType, dialogSide, strPersonName, strDialogContent); } else { isDialogEnd = true; } return(isDialogEnd); }
IEnumerator Start() { #region 测试内容(Log系统) /* 启用Log日志系统 */ //面向接口编程 IConfigManager configMgr = new ConfigManager(KernelParameter.GetLogPath(), KernelParameter.GetLogRootNodeName()); //string strLogPath = configMgr.AppSetting["LogPath"]; //string strLogState = configMgr.AppSetting["LogState"]; //string strLogMaxCapacity = configMgr.AppSetting["LogMaxCapacity"]; //string strLogCacheNumber = configMgr.AppSetting["LogCacheNumber"]; //print("LogPath:" + strLogPath); //print("LogState:" + strLogState); //print("LogMaxCapacity:" + strLogMaxCapacity); //print("LogCacheNumber:" + strLogCacheNumber); //测试Log.cs类(让构造函数运行起来) //Log.Write("我的企业日志系统开始运行了,第一次测试"); #endregion #region 测试内容(XML解析) ///* 测试XML解析程序 */ ////或许可以封装为一个方法,提供参数:对话XML文件地址,根节点名 ////输出参数:对话数据格式类列表 //参数赋值 DialogDataAnalysisMgr.GetInstance().SetXMLPathAndRooNodeName(KernelParameter.GetDialogConfigPath(), KernelParameter.GetDialogConfigRootNodeName()); //等待参数设置完毕(要比DialogDataAnalysisMgr的延迟方法慢) yield return(new WaitForSeconds(0.5f)); //很重要 //得到XML中所有的数据 List <DialogDataFormat> DialogsDataArray = DialogDataAnalysisMgr.GetInstance().GetAllXmlDataArray(); //foreach (DialogDataFormat data in DialogsDataArray) { // Log.Write(""); //空一行 // Log.Write("SectionNum: " + data.DiaSectionNum); // Log.Write("SectionName: " + data.DiaSectionName); // Log.Write("Index: " + data.DiaIndex); // Log.Write("Side: " + data.DiaSide); // Log.Write("Person: " + data.DiaPerson); // Log.Write("Content:" + data.DiaContent); //} //Log.SyncLogArrayToFile(); // 测试给“对话数据管理器”加载数据 bool boolResult = DialogDataMgr.GetInstance().LoadAllDialogData(DialogsDataArray); if (!boolResult) { Log.Write(GetType() + "/Start()/对话数据管理器加载数据失败"); } //###调试进入指定关卡(在这里改变调试关卡)### GlobalParaMgr.NextSceneName = SceneEnum.MajorCity; #endregion yield return(new WaitForSeconds(1f)); StartCoroutine("LoadingSceneProgress"); }