using UnityEngine; using System.Collections; using System.Collections.Generic; using System.Xml; public class CraftManager { private Dictionary dataDict; private List dataList; public CraftManager() { dataDict = new Dictionary(); dataList = new List(); InitByXML("XML/Config/All/craft_config"); } public void InitByXML(string path) { TextAsset textAsset = (TextAsset)Resources.Load(path); XmlDocument xml = new XmlDocument(); xml.LoadXml(textAsset.text); XmlNode mapNode = xml.SelectSingleNode("data"); XmlNodeList nodeList = mapNode.SelectNodes("item"); for(int i=0; i GetDataList() { return dataList; } public int GetRandomCraftId(Player player) { int index = Random.Range(0, dataList.Count); return dataList[index].id; } }