Example #1
0
        internal int GetNum(int id)
        {
            int ret;

            GoodsBuyData.TryGetValue(id, out ret);
            return(ret);
        }
Example #2
0
        internal void BuyGoods(int id)
        {
            int val;

            if (GoodsBuyData.TryGetValue(id, out val))
            {
                GoodsBuyData[id] = val + 1;
            }
            else
            {
                GoodsBuyData.TryAdd(id, 1);
            }
        }
Example #3
0
        internal void AddGoodData(int goodId, int number)
        {
            int val;

            if (GoodsBuyData.TryGetValue(goodId, out val))
            {
                GoodsBuyData[goodId] = val + number;
            }
            else
            {
                GoodsBuyData.TryAdd(goodId, number);
            }
        }
Example #4
0
 internal GeneralOperationResult CheckOKBuy(int id, StoreConfig sc, int exchangecurrency, out int currency)
 {
     currency = 0;
     if (sc != null)
     {
         if (sc.m_HaveDayLimit)
         {
             int val;
             if (GoodsBuyData.TryGetValue(id, out val))
             {
                 if (sc.m_DayLimit > val)
                 {
                     if (sc.m_Price.Count > val)
                     {
                         if (exchangecurrency >= sc.m_Price[val])
                         {
                             currency = sc.m_Price[val];
                             return(GeneralOperationResult.LC_Succeed);
                         }
                         else
                         {
                             return(GeneralOperationResult.LC_Failure_CostError);
                         }
                     }
                     else
                     {
                         return(GeneralOperationResult.LC_Failure_LevelError);
                     }
                 }
                 else
                 {
                     return(GeneralOperationResult.LC_Failure_Overflow);
                 }
             }
             else
             {
                 if (exchangecurrency >= sc.m_Price[0])
                 {
                     currency = sc.m_Price[0];
                     return(GeneralOperationResult.LC_Succeed);
                 }
                 else
                 {
                     return(GeneralOperationResult.LC_Failure_CostError);
                 }
             }
         }
         else
         {
             if (exchangecurrency >= sc.m_Price[0])
             {
                 currency = sc.m_Price[0];
                 return(GeneralOperationResult.LC_Succeed);
             }
             else
             {
                 return(GeneralOperationResult.LC_Failure_CostError);
             }
         }
     }
     else
     {
         return(GeneralOperationResult.LC_Failure_Unknown);
     }
 }