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));
        }
Exemple #2
0
 public static CurrencyContainerRec CheckAndGetValidCurrencyContainer(int currencyType, int quantity)
 {
     foreach (CurrencyContainerRec currencyContainerRec in StaticDB.currencyContainerDB.GetRecordsByParentID(currencyType))
     {
         if (CurrencyContainerDB.IsCurrencyContainerValid(quantity, currencyContainerRec.MinAmount, currencyContainerRec.MaxAmount))
         {
             return(currencyContainerRec);
         }
     }
     return(null);
 }
        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);
        }