Пример #1
0
    public void ParseCareerAwardLibConfig()
    {
        string text = ResourceLoadManager.Instance.GetConfigText(name3);

        if (text == null)
        {
            Debug.LogError("LoadConfig failed: " + name3);
            return;
        }
        careerAwardLibConfig.Clear();

        //读取以及处理XML文本的类
        XmlDocument xmlDoc = CommonFunction.LoadXmlConfig(GlobalConst.DIR_XML_CareerAWARDLIB, text);
        //解析xml的过程
        XmlNodeList nodeList = xmlDoc.SelectSingleNode("Data").ChildNodes;

        foreach (XmlElement land in nodeList)
        {
            XmlNode comment = land.SelectSingleNode(GlobalConst.CONFIG_SWITCH_COLUMN);
            if (comment != null && comment.InnerText == GlobalConst.CONFIG_SWITCH)
            {
                continue;
            }
            CareerAwardLibConfig config = new CareerAwardLibConfig();
            foreach (XmlElement xel in land)
            {
                uint value;
                if (xel.Name == "id")
                {
                    uint.TryParse(xel.InnerText, out value);
                    config.id = value;
                }
                else if (xel.Name == "loop_times")
                {
                    uint.TryParse(xel.InnerText, out value);
                    config.loop_times = value;
                }
                else if (xel.Name == "multiple_type")
                {
                    uint.TryParse(xel.InnerText, out value);
                    config.multiple_type = (AwardMultipleType)value;
                }
                else if (xel.Name == "multiple_value")
                {
                    uint.TryParse(xel.InnerText, out value);
                    config.multiple_value = value;
                }
                else if (xel.Name.Contains("award_pack"))
                {
                    uint.TryParse(xel.InnerText, out value);
                    if (value != 0)
                    {
                        config.award_pack.Add(value);
                    }
                }
            }
            careerAwardLibConfig[config.id] = config;
        }
    }
Пример #2
0
 public static List <AwardConfig> GetGoodsList(uint libID, int times)
 {
     if (careerAwardLibConfig.ContainsKey(libID))
     {
         CareerAwardLibConfig libConf = careerAwardLibConfig[libID];
         times = (times - 1) % libConf.award_pack.Count;
         if (times < libConf.award_pack.Count)
         {
             uint packID = libConf.award_pack[times];
             return(GetAwardPackConfig(packID).awards);
         }
     }
     return(null);
 }