目录为:Assets/Scripts/ConfigReader/目录下
ReadSkillPassiveConfig.cs
对应配置文件:
Assets/Resources/Config/SkillCfg_passitive.xml
这个配置文件也很大,部分如下:
using System;
using UnityEngine;
using System.Xml;
using System.Collections.Generic;
//对应配置文件:Assets/Resources/Config/SkillCfg_passitive.xml
//这个配置文件也很大
public class ReadSkillPassiveConfig
{
XmlDocument xmlDoc = null;
//构造函数
public ReadSkillPassiveConfig(string xmlFilePath)
{
ResourceUnit xmlfileUnit = ResourcesManager.Instance.loadImmediate (xmlFilePath, ResourceType.ASSET);
TextAsset xmlfile = xmlfileUnit.Asset as TextAsset;
if (!xmlfile)
{
return;
}
xmlDoc = new XmlDocument ();
xmlDoc.LoadXml (xmlfile.text);
XmlNodeList infoNodeList = xmlDoc.SelectSingleNode ("SkillCfg_passive").ChildNodes;
for (int i = 0; i < infoNodeList.Count; i++)
{
if ((infoNodeList[i] as XmlElement).GetAttributeNode("un32ID") == null)
{
continue;
}
string typeName = (infoNodeList [i] as XmlElement).GetAttributeNode ("un32ID").InnerText;
SkillPassiveConfigInfo passiveInfo = new SkillPassiveConfigInfo ();
passiveInfo.id = (uint)Convert.ToUInt32 (typeName);
foreach (XmlElement xEle in infoNodeList[i].ChildNodes)
{
switch (xEle.Name)
{
case "szName":
passiveInfo.name = Convert.ToString (xEle.InnerText);
break;
case "SkillIcon":
passiveInfo.icon = Convert.ToString (xEle.InnerText);
break;
case "n32ReleaseAction":
passiveInfo.action = Convert.ToString (xEle.InnerText);
break;
case "n32ReleaseSound":
passiveInfo.sound = Convert.ToString (xEle.InnerText);
break;
case "ReleaseEffect":
passiveInfo.effect = Convert.ToString (xEle.InnerText);
break;
case "StartEffect":
passiveInfo.startEffect = Convert.ToString (xEle.InnerText);
break;
case "info":
passiveInfo.info = Convert.ToString (xEle.InnerText);
break;
case "n32CoolDown":
passiveInfo.coolTime = Convert.ToInt32 (xEle.InnerText);
break;
case "n32UseMP":
passiveInfo.MP = Convert.ToInt32 (xEle.InnerText);
break;
case "bIsShowColdDown":
passiveInfo.isShowCoolTime = Convert.ToBoolean (Convert.ToInt32 (xEle.InnerText));
break;
}
}
ConfigReader.skillPassiveInfoDic.Add (passiveInfo.id, passiveInfo);
}
}
}
/*
<info un32ID="11103801">
<szName>唯一被动-透骨</szName>
<eEffectiveAttackWay>0</eEffectiveAttackWay>
<eReleaseWay>0</eReleaseWay>
<n32UpgradeLevel>1</n32UpgradeLevel>
<n32UseMP>0</n32UseMP>
<n32UseHP>0</n32UseHP>
<n32UseCP>0</n32UseCP>
<n32ReleaseAction>0</n32ReleaseAction>
<n32ReleaseSound>0</n32ReleaseSound>
<ReleaseEffect>0</ReleaseEffect>
<StartEffect>0</StartEffect>
<n32CoolDown>0</n32CoolDown>
<bIsShowColdDown>0</bIsShowColdDown>
<eTriggerWay>0</eTriggerWay>
<n32TriggerRate>1000</n32TriggerRate>
<n32TriggerInterval>1</n32TriggerInterval>
<bIfTriggerByBuilding>0</bIfTriggerByBuilding>
<bIfTriggerByHero>1</bIfTriggerByHero>
<bIfTriggerByMonster>0</bIfTriggerByMonster>
<eTargetType>1</eTargetType>
<bIfRemoveWhenDie>1</bIfRemoveWhenDie>
<SkillIcon>0</SkillIcon>
<info>0</info>
<StartEventID>160309</StartEventID>
<EventID>0</EventID>
<EndEventID>0</EndEventID>
<PassitiveEventID>0</PassitiveEventID>
</info>
*/
public class SkillPassiveConfigInfo: System.Object
{
public uint id;
public string name;
public string icon;
public string action;
public string effect;
public string sound;
public string startEffect;
public string info;
public int coolTime;
public bool isShowCoolTime;
public int Mp;
}