using UnityEngine; using System.Collections; using System.Collections.Generic; using System.Xml; public class ShopManager { public Dictionary dataDict; public Dictionary codeDict; private ShopData vipData; private List coinList; public ShopManager() { dataDict = new Dictionary(); codeDict = new Dictionary (); coinList = new List(); InitByXML("XML/Config/"+Language.GetCurrentLanguage()+"/shop_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 GetCoinDataList() { return coinList; } public ShopData GetDataByCode(string code) { ShopData data = null; codeDict.TryGetValue (code, out data); return data; } public void Pay(string code) { ShopData shopData = GetDataByCode(code); if(shopData != null) { // Umeng.GA.Pay((double)shopData.price, Umeng.GA.PaySource.AppStore, shopData.code, 1, (double)shopData.price); } } }