Beispiel #1
0
 public static bool ReLoad()
 {
     try
     {
         Dictionary <int, ShopItemInfo> dictionary = ShopMgr.LoadFromDatabase();
         if (dictionary.Count > 0)
         {
             Interlocked.Exchange <Dictionary <int, ShopItemInfo> >(ref ShopMgr.m_shop, dictionary);
         }
         return(true);
     }
     catch (Exception exception)
     {
         ShopMgr.log.Error("ShopInfoMgr", exception);
     }
     return(false);
 }
Beispiel #2
0
        public static bool ReLoad()
        {
            bool result;

            try
            {
                Dictionary <int, ShopItemInfo> tempShop        = ShopMgr.LoadFromDatabase();
                Dictionary <int, int>          tempMaxLimit    = new Dictionary <int, int>();
                Dictionary <int, List <int> >  tempNoticeInfos = new Dictionary <int, List <int> >();
                foreach (int key in tempShop.Keys)
                {
                    if (!tempMaxLimit.ContainsKey(key))
                    {
                        tempMaxLimit.Add(key, tempShop[key].LimitCount);
                    }
                    if (!tempNoticeInfos.ContainsKey(key) && tempShop[key].LimitCount != -1)
                    {
                        tempNoticeInfos.Add(key, ShopMgr.InitNotice());
                    }
                }
                if (tempShop.Count > 0)
                {
                    Interlocked.Exchange <Dictionary <int, ShopItemInfo> >(ref ShopMgr.m_shop, tempShop);
                    Interlocked.Exchange <Dictionary <int, int> >(ref ShopMgr.m_LimitCount, tempMaxLimit);
                    Interlocked.Exchange <Dictionary <int, List <int> > >(ref ShopMgr.m_isNoticeInfos, tempNoticeInfos);
                }
                result = true;
                return(result);
            }
            catch (Exception e)
            {
                ShopMgr.log.Error("ShopInfoMgr", e);
            }
            result = false;
            return(result);
        }