Ejemplo n.º 1
0
    public void ReadConfig()
    {
        if (isLoadFinish == false)
        {
            return;
        }
        isLoadFinish = false;
        lock (LockObject) { GameSystem.Instance.readConfigCnt += 1; }
        Debug.Log("Config reading " + name);
        string text = ResourceLoadManager.Instance.GetConfigText(name);

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

        skillUpList.Clear();

        XmlDocument xmlDoc   = CommonFunction.LoadXmlConfig(GlobalConst.DIR_XML_SKILL_UPGRADE, text);
        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;
            }
            SkillUp data = new SkillUp();
            foreach (XmlElement xel in xe)
            {
                if (xel.Name == "id")
                {
                    int.TryParse(xel.InnerText, out data.id);
                }
                if (xel.Name == "level")
                {
                    int.TryParse(xel.InnerText, out data.level);
                }
                else if (xel.Name == "consume")
                {
                    string[] array = xel.InnerText.Split('&');
                    foreach (string items in array)
                    {
                        string[] item = items.Split(':');
                        if (item.Length == 2)
                        {
                            uint id;
                            uint value;
                            uint.TryParse(item[0], out id);
                            uint.TryParse(item[1], out value);
                            data.consume.Add(id, value);
                        }
                    }
                }
                else if (xel.Name == "addn_attr")
                {
                    string[] array = xel.InnerText.Split('&');
                    foreach (string items in array)
                    {
                        string[] item = items.Split(':');
                        if (item.Length == 2)
                        {
                            uint id;
                            uint value;
                            uint.TryParse(item[0], out id);
                            uint.TryParse(item[1], out value);
                            data.addn_attr.Add(id, value);
                        }
                    }
                }
            }

            skillUpList.Add(data);
        }
    }
Ejemplo n.º 2
0
 private void SkillUpSubscription_Matched(object sender, SkillUp e)
 {
     OnSkillUp?.Invoke(sender, e);
 }