public bool Load(string path, AssetBundle nonLocalizedBundle, AssetBundle localizedBundle, string locale) { string str = string.Concat(new string[] { path, locale, "/CurrencyContainer_", locale, ".txt" }); if (this.m_records.Count > 0) { Debug.Log(string.Concat("Already loaded static db ", str)); return(false); } TextAsset textAsset = localizedBundle.LoadAsset <TextAsset>(str); if (textAsset == null) { Debug.Log(string.Concat("Unable to load static db ", str)); return(false); } string str1 = textAsset.ToString(); int num = 0; int num1 = 0; do { num = str1.IndexOf('\n', num1); if (num < 0) { continue; } string str2 = str1.Substring(num1, num - num1 + 1).Trim(); CurrencyContainerRec currencyContainerRec = new CurrencyContainerRec(); currencyContainerRec.Deserialize(str2); this.m_records.Add(currencyContainerRec.ID, currencyContainerRec); num1 = num + 1; }while (num > 0); return(true); }
public static Sprite LoadCurrencyContainerIcon(int currencyType, int quantity) { CurrencyContainerRec currencyContainerRec = CurrencyContainerDB.CheckAndGetValidCurrencyContainer(currencyType, quantity); if (currencyContainerRec == null) { return(GeneralHelpers.LoadCurrencyIcon(currencyType)); } return(GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, currencyContainerRec.ContainerIconID)); }
public static CurrencyContainerRec CheckAndGetValidCurrencyContainer(int currencyType, int quantity) { CurrencyContainerRec currencyContainerRec; using (IEnumerator <CurrencyContainerRec> enumerator = StaticDB.currencyContainerDB.GetRecordsByParentID(currencyType).GetEnumerator()) { while (enumerator.MoveNext()) { CurrencyContainerRec current = enumerator.Current; if (!CurrencyContainerDB.IsCurrencyContainerValid(quantity, current.MinAmount, current.MaxAmount)) { continue; } currencyContainerRec = current; return(currencyContainerRec); } return(null); } return(currencyContainerRec); }