コード例 #1
0
    public BuyGameTimesConfig GetChargeCost(uint times)
    {
        BuyGameTimesConfig cost = new BuyGameTimesConfig();

        if (!_charge_cost.TryGetValue(times, out cost))
        {
            Debug.Log("PVP charge cost config for times " + times + "not found");
        }
        return(cost);
    }
コード例 #2
0
    private void ReadChargeCost()
    {
        string text = ResourceLoadManager.Instance.GetConfigText(name2);

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

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

        foreach (XmlElement xe in nodelist)
        {
            XmlNode comment = xe.SelectSingleNode(GlobalConst.CONFIG_SWITCH_COLUMN);
            if (comment != null && comment.InnerText == GlobalConst.CONFIG_SWITCH)
            {
                continue;
            }
            uint times = 0;
            uint value = 0;
            BuyGameTimesConfig cost = new BuyGameTimesConfig();
            foreach (XmlElement xel in xe)
            {
                if (xel.Name == "times")
                {
                    uint.TryParse(xel.InnerText, out times);
                }
                else if (xel.Name == "consume_type")
                {
                    uint.TryParse(xel.InnerText, out value);
                    cost.consume_type = value;
                }
                else if (xel.Name == "consume")
                {
                    uint.TryParse(xel.InnerText, out value);
                    cost.consume = value;
                }
            }
            if (!_charge_cost.ContainsKey(times))
            {
                _charge_cost.Add(times, cost);
            }
            else
            {
                Debug.LogWarning("PVP point charge cost config for times " + times + "already existed.");
            }
        }
    }
コード例 #3
0
    //读取关卡重置配置
    public void ParseSectionResetConfig()
    {
        string text = ResourceLoadManager.Instance.GetConfigText(name7);

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

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

        foreach (XmlElement land in nodeList)
        {
            uint times = 0;
            BuyGameTimesConfig data = new BuyGameTimesConfig();
            foreach (XmlElement xel in land)
            {
                uint value;
                if (xel.Name == "reset_times")
                {
                    uint.TryParse(xel.InnerText, out value);
                    times = value;
                }
                else if (xel.Name == "consume_type")
                {
                    uint.TryParse(xel.InnerText, out value);
                    data.consume_type = value;
                }
                else if (xel.Name == "consume")
                {
                    uint.TryParse(xel.InnerText, out value);
                    data.consume = value;
                }
            }
            if (!sectionResetConfig.ContainsKey(times))
            {
                sectionResetConfig.Add(times, data);
            }
        }
    }