ConfigReader(十八)—— ReadGuideObjShowTaskConfig
来源:互联网 发布:淘宝在哪抢购秒杀 编辑:程序博客网 时间:2024/06/13 19:00
目录为:Assets/Scripts/ConfigReader/目录下
ReadGuideObjShowTaskConfig.cs
新手教程相关
对应配置文件为:
Assets/Resources/Config/gameobjectshow.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><gameobjctshow xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <info id="1001"> <pathtype>1</pathtype> <path>VirtualPanel</path> <startshow>1</startshow> <endshow>1</endshow> </info></gameobjctshow>
ReadGuideObjShowTaskConfig.cs
using System;using UnityEngine;using System.Xml;using System.Collections.Generic;//新手教程相关//对应的要读取的配置文件:Assets/Resources/Config/gameobjectshow.xmlpublic class ReadGuideObjShowTaskConfig{ XmlDocument xmlDoc = null; //构造函数 public ReadGuideObjShowTaskConfig(string xmlFilePath) { ResourceUnit xmlfileUnit = ResourcesManager.Instance.loadImmediate (xmlFilePath, ResourceType.ASSET); TextAsset xmlfile = xmlfileUnit.Asset as TextAsset; if (!xmlfile) { Debug.LogError(" error infos: 没有找到指定的xml文件:"+xmlFilePath); } xmlDoc = new XmlDocument (); xmlDoc.LoadXml (xmlfile.text); XmlNodeList infoNodeList = xmlDoc.SelectSingleNode ("gameobjectshow").ChildNodes; for (int i = 0; i < infoNodeList.Count; i++) { if ((infoNodeList[i] as XmlElement).GetAttributeNode("id") == null) { continue; } string typeName = (infoNodeList [i] as XmlElement).GetAttributeNode ("id").InnerText; //在Guide那部分定义 CGameObjectShowTask showInfo = new CGameObjectShowTask (); showInfo.TaskId = Convert.ToInt32 (typeName); showInfo.TaskType = GuideTaskType.ObjShowTask; foreach (XmlElement xEle in infoNodeList[i].ChildNodes) { switch (xEle.Name) { case "pathtype": showInfo.PathType = (UIPathType)Convert.ToInt32 (xEle.InnerText); break; case "path": showInfo.Path = Convert.ToString (xEle.InnerText); break; case "startshow": showInfo.StartShow = Convert.ToInt32 (xEle.InnerText); break; case "endshow": showInfo.EndShow = Convert.ToInt32 (xEle.InnerText); break; } } CTaskBase.objShowTaskDic.Add (showInfo.TaskId, showInfo); } }}
阅读全文
0 0
- ConfigReader(十八)—— ReadGuideObjShowTaskConfig
- ConfigReader(二十八)—— ReadHeroConfig
- ConfigReader(六十)—— ConfigReader
- Commom(十)—— ConfigReader
- ConfigReader(一)—— MapConfig
- ConfigReader(二)—— MapLoadConfig
- ConfigReader(三)—— ReadAdvancedGuideConfig
- ConfigReader(四)—— ReadBuffConfig
- ConfigReader(五)—— ReadBuySkinConfig
- ConfigReader(六)—— ReadCombineConfig
- ConfigReader(七)—— ReadDailyBonusConfig
- ConfigReader(八)—— ReadDailyTaskConfig
- ConfigReader(九)—— ReadGuideAbsorbTaskConfig
- ConfigReader(十)—— ReadGuideBornNpcTaskConfig
- ConfigReader(十一)—— ReadGuideCameraTaskConfig
- ConfigReader(十二)—— ReadGuideClickButtonTaskConfig
- ConfigReader(十三)—— ReadGuideFlashTaskConfig
- ConfigReader(十四)—— ReadGuideHelpConfig
- 作业
- 关于linux驱动触摸屏滑鼠问题的解决
- linux_ubuntu 14版本iNode安装——超简单成功版!!!
- 抽屉侧拉的activity方法
- String , StringBuffer , StringBuilder
- ConfigReader(十八)—— ReadGuideObjShowTaskConfig
- 常用的正则表达式
- 【c基础练习】c语言实现配置文件解析
- Material Design八个强大功能的控件
- unity中动画与触发事件的分解
- MapReduce流程
- 史上最全的架构师图谱
- 代理模式
- java中的访问权限控制