private void Open_ThirdBattleEntry(CUIEvent uiEvt) { this.m_selectMapID = uiEvt.m_eventParams.tagUInt; this.m_selectMapRes = GameDataMgr.uinionBattleLevelDatabin.GetDataByKey(this.m_selectMapID); GameDataMgr.matchTimeInfoDict.TryGetValue(GameDataMgr.GetDoubleKey(5, this.m_selectMapID), out this.m_selectTimeInfo); switch (uiEvt.m_eventParams.tag) { case 0: case 1: if (uiEvt.m_eventParams.commonBool) { CUIFormScript script = Singleton <CUIManager> .GetInstance().OpenForm(UNION_ENTRY_THIRD_PATH, false, true); this.initThirdFormWidget(); SendAwartPoolReq(this.m_selectMapID); break; } Singleton <CUIManager> .instance.OpenTips("Union_Battle_Tips15", true, 1f, null, new object[0]); return; case 2: Singleton <CUIManager> .instance.OpenTips("Union_Battle_Tips3", true, 1f, null, new object[0]); break; } }
public CMallMysteryProduct GetProduct(uint itemType, uint itemID) { CMallMysteryProduct product = new CMallMysteryProduct(); if (this.m_ProductDic.TryGetValue(GameDataMgr.GetDoubleKey(itemType, itemID), out product)) { return(product); } return(null); }
private void OnBuyItem(CUIEvent uiEvent) { enPayType tag = (enPayType)uiEvent.m_eventParams.tag; uint payValue = uiEvent.m_eventParams.commonUInt32Param1; string goodName = string.Empty; COM_ITEM_TYPE com_item_type = COM_ITEM_TYPE.COM_OBJTYPE_NULL; uint uniSkinId = 0; long key = 0L; if (uiEvent.m_eventParams.heroSkinParam.skinId != 0) { com_item_type = COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN; uniSkinId = CSkinInfo.GetSkinCfgId(uiEvent.m_eventParams.heroSkinParam.heroId, uiEvent.m_eventParams.heroSkinParam.skinId); ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(uniSkinId); DebugHelper.Assert(heroSkin != null, string.Format("找不到皮肤{0}的配置信息", uniSkinId)); if (heroSkin == null) { return; } goodName = StringHelper.UTF8BytesToString(ref heroSkin.szSkinName); } else if (uiEvent.m_eventParams.heroId != 0) { com_item_type = COM_ITEM_TYPE.COM_OBJTYPE_HERO; uniSkinId = uiEvent.m_eventParams.heroId; ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(uniSkinId); DebugHelper.Assert(dataByKey != null, string.Format("找不到英雄{0}的配置信息", uniSkinId)); if (dataByKey == null) { return; } goodName = StringHelper.UTF8BytesToString(ref dataByKey.szName); } else { DebugHelper.Assert(false, "神秘商店购买不支持该物品类型"); return; } key = GameDataMgr.GetDoubleKey((uint)com_item_type, uniSkinId); CMallMysteryProduct product = new CMallMysteryProduct(); if (!this.m_ProductDic.TryGetValue(key, out product)) { DebugHelper.Assert(false, string.Format("神秘商店找不到该物品{0}/{1}", Enum.GetName(typeof(COM_ITEM_TYPE), com_item_type), uniSkinId)); } else { CUIEvent uIEvent = Singleton <CUIEventManager> .GetInstance().GetUIEvent(); uIEvent.m_eventID = enUIEventID.Mall_Mystery_On_Confirm_Buy_Item; uIEvent.m_eventParams.tag = (int)product.ID; CMallSystem.TryToPay(enPayPurpose.Buy, goodName, tag, payValue, uIEvent.m_eventID, ref uIEvent.m_eventParams, enUIEventID.None, false, true); } }
private void initThirdFormWidget() { CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(UNION_ENTRY_THIRD_PATH); if (form != null) { if (this.m_selectMapRes != null) { Text component = form.GetWidget(0).GetComponent <Text>(); Text text2 = form.GetWidget(3).GetComponent <Text>(); GameObject gameObject = form.GetWidget(4).transform.FindChild("itemCell").gameObject; Text text3 = form.GetWidget(5).transform.FindChild("ScoreTxt").GetComponent <Text>(); Text text4 = form.GetWidget(6).transform.FindChild("ScoreTxt").GetComponent <Text>(); Text text5 = form.transform.FindChild("panelGroup1/Text").GetComponent <Text>(); component.text = this.m_selectMapRes.stLevelCommonInfo.szName; text5.text = this.m_selectMapRes.szMatchName; ResCommReward resCommonReward = this.GetResCommonReward(this.m_selectMapRes.dwWinAwardID); if (resCommonReward != null) { ResRewardDetail detail = resCommonReward.astRewardInfo[0]; CUseable itemUseable = CUseableManager.CreateUsableByServerType((RES_REWARDS_TYPE)detail.dwRewardType, detail.iCnt, detail.dwRewardID); CUICommonSystem.SetItemCell(form, gameObject, itemUseable, true, false); text3.text = resCommonReward.astRewardInfo[1].iCnt.ToString(); text4.text = resCommonReward.astRewardInfo[2].iCnt.ToString(); } } if (this.m_personInfo != null) { Text text6 = form.GetWidget(1).transform.FindChild("ScoreTxt").GetComponent <Text>(); GameObject widget = form.GetWidget(2); Text text7 = form.GetWidget(2).transform.FindChild("ScoreTxt").GetComponent <Text>(); COMDT_MATCHPOINT mapPersonMatchPoint = this.GetMapPersonMatchPoint(); if (mapPersonMatchPoint != null) { text6.text = mapPersonMatchPoint.dwDayPoint.ToString(); text7.text = mapPersonMatchPoint.dwSeasonPoint.ToString(); } if ((this.m_selectMapRes != null) && (this.m_selectMapRes.dwSeasonRankID == 0)) { widget.CustomSetActive(false); } } ResRewardMatchTimeInfo info = null; GameDataMgr.matchTimeInfoDict.TryGetValue(GameDataMgr.GetDoubleKey(5, this.m_selectMapID), out info); if (info != null) { form.GetWidget(3).GetComponent <Text>().text = info.szTimeTips; } CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .instance.GetMasterRoleInfo(); if (masterRoleInfo != null) { CUseableContainer useableContainer = masterRoleInfo.GetUseableContainer(enCONTAINER_TYPE.ITEM); if (this.m_selectMapRes != null) { int useableStackCount = useableContainer.GetUseableStackCount(COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP, this.m_selectMapRes.dwConsumPayItemID); int bCount = useableContainer.GetUseableStackCount(COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP, this.m_selectMapRes.dwConsumFreeItemID); CUseable useable2 = CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP, this.m_selectMapRes.dwConsumPayItemID, useableStackCount); CUseable useable3 = CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP, this.m_selectMapRes.dwConsumFreeItemID, bCount); GameObject obj4 = form.GetWidget(7); GameObject itemCell = obj4.transform.Find("item1/itemCell").gameObject; Text text9 = obj4.transform.Find("item1/itemCell/lblIconCount").GetComponent <Text>(); GameObject obj6 = obj4.transform.Find("item2/itemCell").gameObject; Text text10 = obj4.transform.Find("item2/itemCell/lblIconCount").GetComponent <Text>(); CUICommonSystem.SetItemCell(form, itemCell, useable2, true, false); CUICommonSystem.SetItemCell(form, obj6, useable3, true, false); text9.text = "x" + useableStackCount.ToString(); text10.text = "x" + bCount.ToString(); text9.gameObject.CustomSetActive(true); text10.gameObject.CustomSetActive(true); CUICommonSystem.SetHostHeadItemCell(obj4.transform.FindChild("HeadItemCell").gameObject); GameObject obj8 = form.GetWidget(9); GameObject obj9 = obj8.transform.Find("itemCell").gameObject; Text text11 = obj8.transform.Find("lblCount").GetComponent <Text>(); CUICommonSystem.SetItemCell(form, obj9, useable2, false, false); text11.text = "x" + this.m_selectMapRes.dwCousumItemNum.ToString(); } } } }
public static stPayInfoSet GetPayInfoSetOfGood(COM_ITEM_TYPE itemType, uint itemID) { CMallMysteryShop instance = Singleton <CMallMysteryShop> .GetInstance(); stPayInfoSet set = new stPayInfoSet(2); long doubleKey = GameDataMgr.GetDoubleKey((uint)itemType, itemID); CMallMysteryProduct product = new CMallMysteryProduct(); if (!instance.m_ProductDic.TryGetValue(doubleKey, out product)) { return(set); } uint index = (instance.Discount / 10) - 1; stPayInfo info = new stPayInfo(); switch (product.ItemType) { case COM_ITEM_TYPE.COM_OBJTYPE_HERO: { ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(itemID); DebugHelper.Assert(dataByKey != null, "神秘商店配置的英雄ID有错,英雄表里不存在"); if (dataByKey != null) { info.m_payType = CMallSystem.ResBuyTypeToPayType(product.Cfg.bMoneyType); switch (info.m_payType) { case enPayType.GoldCoin: info.m_oriValue = (uint)dataByKey.dwBuyCoin; goto Label_01A7; case enPayType.DianQuan: info.m_oriValue = (uint)dataByKey.dwBuyCoupons; goto Label_01A7; case enPayType.Diamond: case enPayType.DiamondAndDianQuan: info.m_oriValue = (uint)dataByKey.dwBuyDiamond; goto Label_01A7; } break; } return(set); } case COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN: { ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(itemID); DebugHelper.Assert(heroSkin != null, "神秘商店配置的皮肤ID有错,皮肤表里不存在"); if (heroSkin != null) { info.m_payType = CMallSystem.ResBuyTypeToPayType(product.Cfg.bMoneyType); switch (info.m_payType) { case enPayType.DianQuan: info.m_oriValue = heroSkin.dwBuyCoupons; goto Label_01A7; case enPayType.Diamond: case enPayType.DiamondAndDianQuan: info.m_oriValue = heroSkin.dwBuyDiamond; goto Label_01A7; } break; } return(set); } } Label_01A7: if (info.m_oriValue == 0) { info.m_oriValue = (uint)product.Cfg.RouZheKou[product.Cfg.RouZheKou.Length - 1]; } if ((index < 0) || (index >= product.Cfg.RouZheKou.Length)) { info.m_payValue = info.m_oriValue; info.m_discountForDisplay = 0x2710; } else if (instance.IsRandomDiscount) { info.m_payValue = (uint)product.Cfg.RouZheKou[index]; info.m_discountForDisplay = instance.Discount * 100; } else { info.m_payValue = (uint)product.Cfg.iConfirmZheKou; info.m_discountForDisplay = instance.Discount * 100; } set.m_payInfos[set.m_payInfoCount] = info; set.m_payInfoCount++; return(set); }
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; } } } }
public void RefreshAwakeTaskForm() { CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(s_heroAwakeTaskFormPath); if (form != null) { Image component = form.transform.Find("Panel/PanelLeft/HeroCell/Hero").GetComponent <Image>(); Text text = form.transform.Find("Panel/PanelLeft/lblTitle").GetComponent <Text>(); Transform transform = form.transform.Find("Panel/PanelLeft/lblState"); Text text2 = form.transform.Find("Panel/PanelLeft/lblContent").GetComponent <Text>(); Button btn = form.transform.Find("Panel/PanelLeft/btnReciveTask").GetComponent <Button>(); Transform transform2 = form.transform.Find("Panel/PanelLeft/panelType1"); Text text3 = transform2.Find("lblTaskDesc").GetComponent <Text>(); Transform transform3 = transform2.Find("itemInfo/itemCell"); Text text4 = transform2.Find("itemInfo/lblName").GetComponent <Text>(); Text text5 = transform2.Find("itemInfo/lblProce").GetComponent <Text>(); Button button2 = transform2.Find("itemInfo/btnReciveTask").GetComponent <Button>(); Button button3 = transform2.Find("getInfo/btnReciveTask").GetComponent <Button>(); Transform transform4 = form.transform.Find("Panel/PanelLeft/panelType2"); Text text6 = transform4.Find("taskInfo/lblTaskDesc").GetComponent <Text>(); Text text7 = transform4.Find("taskInfo/lblProce").GetComponent <Text>(); GameObject prefab = CUIUtility.GetSpritePrefeb(CUIUtility.s_Sprite_Dynamic_BustHero_Dir + StringHelper.UTF8BytesToString(ref this.m_heroInfo.cfgInfo.szImagePath), true, true); component.SetSprite(prefab); ResHeroWakeInfo dataByKey = GameDataMgr.heroAwakDatabin.GetDataByKey(GameDataMgr.GetDoubleKey(this.m_heroInfo.cfgInfo.dwCfgID, this.m_heroInfo.m_awakeStepID)); if (dataByKey != null) { text.text = StringHelper.UTF8BytesToString(ref dataByKey.szWakeTitle); text2.text = StringHelper.UTF8BytesToString(ref dataByKey.szWakeDesc); CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if (masterRoleInfo != null) { if (dataByKey.bOptType == 1) { transform2.gameObject.CustomSetActive(true); transform4.gameObject.CustomSetActive(false); CUseable itemUseable = CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP, (uint)dataByKey.OptParam[1], 0); int useableStackCount = masterRoleInfo.GetUseableContainer(enCONTAINER_TYPE.ITEM).GetUseableStackCount(itemUseable.m_type, itemUseable.m_baseID); stUIEventParams eventParams = new stUIEventParams { iconUseable = itemUseable }; itemUseable.m_stackCount = dataByKey.OptParam[2]; string[] args = new string[] { itemUseable.m_stackCount.ToString(), itemUseable.m_name }; text3.text = Singleton <CTextManager> .instance.GetText("HeroAwake_Tips4", args); text4.text = itemUseable.m_name; CUICommonSystem.SetItemCell(form, transform3.gameObject, itemUseable, true, false); if (useableStackCount >= itemUseable.m_stackCount) { button2.gameObject.CustomSetActive(false); transform.gameObject.CustomSetActive(true); CUICommonSystem.SetButtonEnable(btn, true, true, true); text5.text = string.Format("{0}/{1}", useableStackCount, itemUseable.m_stackCount); } else { button2.gameObject.CustomSetActive(true); transform.gameObject.CustomSetActive(false); CUICommonSystem.SetButtonEnable(btn, false, false, true); text5.text = string.Format("<color=red>{0}</color>/{1}", useableStackCount, itemUseable.m_stackCount); CUIEventScript script2 = button2.GetComponent <CUIEventScript>(); if (script2 != null) { script2.SetUIEvent(enUIEventType.Click, enUIEventID.HeroInfo_Material_Direct_Buy, eventParams); } } CUIEventScript script3 = button3.GetComponent <CUIEventScript>(); if (script3 != null) { script3.SetUIEvent(enUIEventType.Click, enUIEventID.Tips_ItemSourceInfoOpen, eventParams); } } else { transform2.gameObject.CustomSetActive(false); transform4.gameObject.CustomSetActive(true); int num2 = dataByKey.OptParam[0]; CTask task = Singleton <CTaskSys> .instance.model.GetTask((uint)num2); if (task == null) { task = TaskUT.Create_Task((uint)num2); if (task == null) { return; } task.SetState(CTask.State.None); } if (task != null) { text6.text = UT.Bytes2String(task.m_resTask.szTaskDesc); string str = " "; for (int i = 0; i < task.m_prerequisiteInfo.Length; i++) { if (task.m_prerequisiteInfo[i].m_valueTarget > 0) { string str2; if (!this.m_heroInfo.m_isStepFinish) { str2 = str; object[] objArray1 = new object[] { str2, task.m_prerequisiteInfo[i].m_value, "/", task.m_prerequisiteInfo[i].m_valueTarget, " " }; str = string.Concat(objArray1); } else { str2 = str; object[] objArray2 = new object[] { str2, task.m_prerequisiteInfo[i].m_valueTarget, "/", task.m_prerequisiteInfo[i].m_valueTarget, " " }; str = string.Concat(objArray2); } break; } } text7.text = str; } if (this.m_heroInfo.m_isStepFinish || (task.m_taskState == 3)) { transform.gameObject.CustomSetActive(true); CUICommonSystem.SetButtonEnable(btn, true, true, true); } else { transform.gameObject.CustomSetActive(false); CUICommonSystem.SetButtonEnable(btn, false, false, true); } } } } } }