public void InitData() { DateTime time = new DateTime(0x7f6, 1, 0x12); if (!this.m_Inited) { DateTime time2 = Utility.ToUtcTime2Local((long)CRoleInfo.GetCurrentUTCTime()); DictionaryView <uint, ResAkaliShopCtrl> .Enumerator enumerator = GameDataMgr.mysteryShopCtlDict.GetEnumerator(); DateTime time3 = time; bool flag = false; bool flag2 = false; while (enumerator.MoveNext()) { KeyValuePair <uint, ResAkaliShopCtrl> current = enumerator.Current; ResAkaliShopCtrl ctrl = current.Value; DateTime time4 = Utility.StringToDateTime(Utility.UTF8Convert(ctrl.szOpenTime), DateTime.MinValue); DateTime time5 = Utility.StringToDateTime(Utility.UTF8Convert(ctrl.szCloseTime), DateTime.MinValue); if ((time2.CompareTo(time4) >= 0) && (time2.CompareTo(time5) <= 0)) { this.m_ShopID = ctrl.dwShopID; this.m_Products.Clear(); this.m_ProductDic.Clear(); this.m_StartTime = time4; this.m_EndTime = time5; this.m_LimitBuyCnt = ctrl.dwTotalBuyNumLimit; this.m_BoughtCnt = 0; switch (((RES_AKALISHOPZHEKOU_TYPE)ctrl.bZheKouType)) { case RES_AKALISHOPZHEKOU_TYPE.RES_AKALISHOPZHEKOU_CONFIRM: this.m_IsRandomDiscount = false; this.m_Discount = (uint)ctrl.iConfirmZheKou; this.m_HasGotDiscount = true; break; case RES_AKALISHOPZHEKOU_TYPE.RES_AKALISHOPZHEKOU_RANDOM: this.m_IsRandomDiscount = true; this.m_Discount = 100; this.m_HasGotDiscount = false; break; } DictionaryView <uint, ResAkaliShopGoods> .Enumerator enumerator2 = GameDataMgr.mysteryShopProductDict.GetEnumerator(); while (enumerator2.MoveNext()) { ResHeroCfgInfo dataByKey; ResHeroSkin heroSkin; ResHeroCfgInfo info2; long num; KeyValuePair <uint, ResAkaliShopGoods> pair2 = enumerator2.Current; ResAkaliShopGoods goodsCfg = pair2.Value; if (goodsCfg.dwShopID != ctrl.dwShopID) { continue; } CMallMysteryProduct item = new CMallMysteryProduct(goodsCfg); switch (item.ItemType) { case COM_ITEM_TYPE.COM_OBJTYPE_HERO: { dataByKey = GameDataMgr.heroDatabin.GetDataByKey(item.ItemID); if (dataByKey != null) { break; } continue; } case COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN: { heroSkin = CSkinInfo.GetHeroSkin(item.ItemID); if (heroSkin != null) { goto Label_0201; } continue; } default: goto Label_0254; } if (GameDataMgr.IsHeroAvailable(dataByKey.dwCfgID)) { this.m_Products.Add(item); } goto Label_0266; Label_0201: info2 = GameDataMgr.heroDatabin.GetDataByKey(heroSkin.dwHeroID); if (info2 == null) { continue; } if (GameDataMgr.IsSkinAvailable(heroSkin.dwID) && GameDataMgr.IsHeroAvailable(info2.dwCfgID)) { this.m_Products.Add(item); } goto Label_0266; Label_0254: this.m_Products.Add(item); Label_0266: num = GameDataMgr.GetDoubleKey((uint)item.ItemType, item.ItemID); if (!this.m_ProductDic.ContainsKey(num)) { this.m_ProductDic.Add(num, item); } } if (this.m_Products.Count == 0) { DebugHelper.Assert(false, "神秘商店配置了开启时段,但商店里没物品可卖"); } else { flag = true; } continue; } if ((time4.CompareTo(time2) > 0) && (time4.CompareTo(time3) < 0)) { time3 = time4; } } TimeSpan span = (TimeSpan)(time3 - time2); Singleton <CTimerManager> .GetInstance().RemoveTimerSafely(ref this.m_NextRefreshTimerSeq); long num2 = (long)(span.TotalSeconds * 1000.0); if ((num2 > 0L) && (num2 < 0x7fffffffL)) { this.m_NextRefreshTimerSeq = Singleton <CTimerManager> .GetInstance().AddTimer((int)num2, 1, new CTimer.OnTimeUpHandler(this.RefreshShop)); flag2 = true; } TimeSpan span2 = (TimeSpan)(this.m_EndTime - time2); Singleton <CTimerManager> .GetInstance().RemoveTimerSafely(ref this.m_EndTimerSeq); long num3 = ((int)span2.TotalSeconds) * 0x3e8; if ((num3 > 0L) && (num3 < 0x7fffffffL)) { this.m_EndTimerSeq = Singleton <CTimerManager> .GetInstance().AddTimer((int)num3, 1, new CTimer.OnTimeUpHandler(this.CloseShop)); } if (flag || flag2) { this.m_Inited = true; } } }
private bool RefreshData() { this.m_HotSaleListView.Clear(); this.m_NewArrivalListView.Clear(); DictionaryView <uint, ResBoutiqueConf> .Enumerator enumerator = GameDataMgr.boutiqueDict.GetEnumerator(); int currentUTCTime = CRoleInfo.GetCurrentUTCTime(); while (enumerator.MoveNext()) { KeyValuePair <uint, ResBoutiqueConf> current = enumerator.get_Current(); ResBoutiqueConf value = current.get_Value(); if ((ulong)value.dwOnTimeGen <= (ulong)((long)currentUTCTime) && (ulong)value.dwOffTimeGen >= (ulong)((long)currentUTCTime)) { RES_BOUTIQUE_TYPE bBoutiqueType = value.bBoutiqueType; ListView <ResBoutiqueConf> listView = null; RES_BOUTIQUE_TYPE rES_BOUTIQUE_TYPE = bBoutiqueType; if (rES_BOUTIQUE_TYPE != 1) { if (rES_BOUTIQUE_TYPE == 2) { listView = this.m_HotSaleListView; } } else { listView = this.m_NewArrivalListView; } switch (value.wItemType) { case 2: case 5: { CMallFactoryShopController.ShopProduct product = Singleton <CMallFactoryShopController> .GetInstance().GetProduct(value.dwItemID); if (product != null && product.IsOnSale == 1 && listView != null) { listView.Add(value); } break; } case 4: { ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(value.dwItemID); if (dataByKey != null) { if (GameDataMgr.IsHeroAvailable(dataByKey.dwCfgID) && listView != null) { listView.Add(value); } } break; } case 7: { ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(value.dwItemID); if (heroSkin != null) { ResHeroCfgInfo dataByKey2 = GameDataMgr.heroDatabin.GetDataByKey(heroSkin.dwHeroID); if (dataByKey2 != null) { if (GameDataMgr.IsSkinAvailable(heroSkin.dwID) && GameDataMgr.IsHeroAvailable(dataByKey2.dwCfgID) && listView != null) { listView.Add(value); } } } break; } } } } return(true); }