public CMallMysteryProduct() { this.m_ID = 0; this.m_itemID = 0; this.m_ItemType = COM_ITEM_TYPE.COM_OBJTYPE_NULL; this.m_BoughtCnt = 0; this.m_Cfg = null; }
public CMallMysteryProduct(ResAkaliShopGoods goodsCfg) { this.m_ID = goodsCfg.dwID; this.m_itemID = goodsCfg.dwGoodsID; this.m_ItemType = (COM_ITEM_TYPE)goodsCfg.bGoodsType; this.m_BoughtCnt = 0; this.m_Cfg = goodsCfg; }
public void InitData() { DateTime time = new DateTime(0x7f6, 1, 0x12); if (!this.m_Inited) { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if (masterRoleInfo != null) { DateTime time2 = Utility.ToUtcTime2Local((long)masterRoleInfo.getCurrentTimeSinceLogin()); 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 info3; 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_0211; } continue; } default: goto Label_025C; } if (dataByKey.bIsPlayerUse > 0) { this.m_Products.Add(item); } goto Label_026E; Label_0211: info3 = GameDataMgr.heroDatabin.GetDataByKey(heroSkin.dwHeroID); if (info3 == null) { continue; } if ((heroSkin.bIsShow > 0) && (info3.bIsPlayerUse > 0)) { this.m_Products.Add(item); } goto Label_026E; Label_025C: this.m_Products.Add(item); Label_026E: 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)) { 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)) { Singleton <CTimerManager> .GetInstance().AddTimer((int)num3, 1, new CTimer.OnTimeUpHandler(this.CloseShop)); } if (flag || flag2) { this.m_Inited = true; } } } }