Пример #1
0
        private void InitMapCfg()
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(@"F:\Unity\ARPG\Assets\Plugins\Editor\RawConfig\map.xml");
            XmlNode root = doc.SelectSingleNode("root");

            foreach (XmlElement item in root.ChildNodes)
            {
                if (item.GetAttributeNode("ID") == null)
                {
                    continue;
                }
                int    id  = int.Parse(item.GetAttributeNode("ID").InnerText);
                MapCfg cfg = new MapCfg();
                cfg.ID = id;
                foreach (XmlElement ele in item.ChildNodes)
                {
                    string value = ele.InnerText;
                    switch (ele.Name)
                    {
                    case "taskName":
                        cfg.power = int.Parse(value);
                        break;
                    }
                }
                mapCfgDic.Add(id, cfg);
            }
        }
Пример #2
0
        public MapCfg GetMapCfg(int id)
        {
            MapCfg cfg = null;

            if (mapCfgDic.TryGetValue(id, out cfg))
            {
                return(cfg);
            }
            NETCommon.Log("获取 TaskRewardCfg 失败,ID:" + id);
            return(null);
        }