using UnityEngine; using System.Collections; using System.Collections.Generic; using System.Xml; using LitJson; public class HaloManager { private Dictionary dataDict; private List dataList; private HaloData defaultData; private int startEquipedId; private int currentEquipedId; public HaloManager() { dataDict = new Dictionary(); InitByXML("XML/Config/All/halo_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 0) Equip(itemId, equiped); Bought(itemId); } if (currentEquipedId == 0) Equip (defaultData.id, 1); } public void RequestDataList(CallBackUtil.SimpleCallBack callBack) { if(dataList == null) Session.GetInstance().GetNetworkManager().ShopList(BuyUtil.ItemType.Halo, callBack); else callBack(); } public List GetDataList() { return dataList; } public void SetDataList(JsonData json) { this.dataList = new List(); dataList.Add (defaultData); for(int i=0; i("Prefabs/Halo/"+data.model); GameObject haloObj = GameObject.Instantiate(prefab); haloObj.AddComponent(); return haloObj; } }