public CMallItem(CMallFactoryShopController.ShopProduct product, IconType iconType = 1) { this.m_type = ItemType.Item; this.m_iconType = iconType; if (product != null) { this.m_useable = CUseableManager.CreateUseable(product.Type, 0L, product.ID, (int)product.LimitCount, 0); this.m_product = product; this.m_firstName = this.m_useable.m_name; this.m_secondName = null; this.m_iconPath = this.m_useable.GetIconPath(); RES_SHOPBUY_COINTYPE coinType = product.CoinType; enPayType type = CMallSystem.ResBuyTypeToPayType((int)coinType); uint discount = product.Discount; uint buyPrice = this.m_useable.GetBuyPrice(coinType); uint num3 = (buyPrice * product.Discount) / 100; this.m_payInfoSet = new stPayInfoSet(1); this.m_payInfoSet.m_payInfoCount = 1; this.m_payInfoSet.m_payInfos[0].m_discountForDisplay = product.Discount; this.m_payInfoSet.m_payInfos[0].m_oriValue = buyPrice; this.m_payInfoSet.m_payInfos[0].m_payType = type; this.m_payInfoSet.m_payInfos[0].m_payValue = num3; } else { this.m_useable = null; this.m_firstName = null; this.m_secondName = null; this.m_useable = null; this.m_iconPath = null; this.m_payInfoSet = new stPayInfoSet(); } }
public void BuyShopProduct(ShopProduct shopProduct, uint count, bool needConfirm, CUIEvent uiEvent = null) { CUseable useable = CUseableManager.CreateUseable(shopProduct.Type, shopProduct.ID, 0); enPayType payType = CMallSystem.ResBuyTypeToPayType((int)shopProduct.CoinType); uint payValue = 0; if ((shopProduct != null) && shopProduct.m_bChangeGiftPrice) { payValue = shopProduct.m_newGiftPrice * count; } else { payValue = shopProduct.ConvertWithRealDiscount(useable.GetBuyPrice(shopProduct.CoinType) * count); } if (uiEvent == null) { uiEvent = Singleton <CUIEventManager> .GetInstance().GetUIEvent(); uiEvent.m_eventID = enUIEventID.Mall_Product_Confirm_Buy; uiEvent.m_eventParams.tag = (int)shopProduct.Key; uiEvent.m_eventParams.commonUInt32Param1 = count; } else { uiEvent.m_eventParams.commonUInt32Param1 = count; } CMallSystem.TryToPay(enPayPurpose.Buy, string.Format("{0}{1}", useable.m_name, (count <= 1) ? string.Empty : ("x" + count)), payType, payValue, uiEvent.m_eventID, ref uiEvent.m_eventParams, enUIEventID.None, needConfirm, true, false); }
public CMallItem(CMallFactoryShopController.ShopProduct product, CMallItem.IconType iconType = CMallItem.IconType.Small) { this.m_type = CMallItem.ItemType.Item; this.m_iconType = iconType; if (product != null) { this.m_useable = CUseableManager.CreateUseable(product.Type, 0uL, product.ID, (int)product.LimitCount, 0); this.m_product = product; this.m_firstName = this.m_useable.m_name; this.m_secondName = null; this.m_iconPath = this.m_useable.GetIconPath(); RES_SHOPBUY_COINTYPE coinType = product.CoinType; enPayType payType = CMallSystem.ResBuyTypeToPayType(coinType); uint buyPrice = this.m_useable.GetBuyPrice(coinType); uint payValue = product.ConvertWithRealDiscount(buyPrice); this.m_payInfoSet = new stPayInfoSet(1); this.m_payInfoSet.m_payInfoCount = 1; this.m_payInfoSet.m_payInfos[0].m_discountForDisplay = product.DiscountForShow; this.m_payInfoSet.m_payInfos[0].m_oriValue = buyPrice; this.m_payInfoSet.m_payInfos[0].m_payType = payType; this.m_payInfoSet.m_payInfos[0].m_payValue = payValue; } else { this.m_useable = null; this.m_firstName = null; this.m_secondName = null; this.m_useable = null; this.m_iconPath = null; this.m_payInfoSet = default(stPayInfoSet); } }
private void InitFromView(CUIFormScript formScript) { SLevelContext curLvelContext = Singleton <BattleLogic> .GetInstance().GetCurLvelContext(); this.InitBuffItem(formScript, curLvelContext); this.m_relivePayType = CMallSystem.ResBuyTypeToPayType((int)curLvelContext.m_reviveInfo[curLvelContext.m_levelDifficulty].astReviveCost[3 - PVEReviveHeros.m_iRemainReviveNum].bCostType); this.m_relivePayValue = curLvelContext.m_reviveInfo[curLvelContext.m_levelDifficulty].astReviveCost[3 - PVEReviveHeros.m_iRemainReviveNum].dwCostPrice; string text = string.Format(Singleton <CTextManager> .GetInstance().GetText("ReliveMessage"), Singleton <CTextManager> .GetInstance().GetText(CMallSystem.s_payTypeNameKeys[(int)this.m_relivePayType])); GameObject widget = formScript.GetWidget(0); if (widget != null) { Text component = widget.GetComponent <Text>(); if (component != null) { component.text = text; } } GameObject widget2 = formScript.GetWidget(1); if (widget2 != null) { Image component2 = widget2.GetComponent <Image>(); if (component2 != null) { component2.SetSprite(CMallSystem.GetPayTypeIconPath(this.m_relivePayType), formScript, true, false, false, false); } } GameObject widget3 = formScript.GetWidget(2); if (widget3 != null) { Text component3 = widget3.GetComponent <Text>(); if (component3 != null) { component3.text = this.m_relivePayValue.ToString(); } } GameObject gameObject = this.m_form.transform.Find("buffInfoPanel").gameObject; if (gameObject == null) { return; } GameObject gameObject2 = gameObject.transform.Find("ReviveText/NumText").gameObject; if (gameObject2 == null) { return; } gameObject2.GetComponent <Text>().text = PVEReviveHeros.m_iRemainReviveNum.ToString(); CUITimerScript component4 = gameObject.transform.Find("Timer").GetComponent <CUITimerScript>(); byte reviveTimeMax = curLvelContext.m_reviveTimeMax; component4.SetTotalTime((float)reviveTimeMax); }
private void Talent_Buy_BtnSellClick(CUIEvent uiEvent) { enPayType payType = CMallSystem.ResBuyTypeToPayType(uiEvent.m_eventParams.tag); uint tagUInt = uiEvent.m_eventParams.tagUInt; string[] args = new string[] { uiEvent.m_eventParams.tagStr }; string text = Singleton <CTextManager> .instance.GetText("Talent_Buy_5", args); CMallSystem.TryToPay(enPayPurpose.Buy, text, payType, tagUInt, enUIEventID.Talent_Buy_ConfirmClick, ref uiEvent.m_eventParams, enUIEventID.None, true, true); }
private void InitFromView(CUIFormScript formScript) { SLevelContext curLvelContext = Singleton <BattleLogic> .GetInstance().GetCurLvelContext(); ResLevelCfgInfo dataByKey = GameDataMgr.levelDatabin.GetDataByKey(curLvelContext.iLevelID); this.InitBuffItem(formScript, curLvelContext, dataByKey); this.m_relivePayType = CMallSystem.ResBuyTypeToPayType(dataByKey.astReviveInfo[curLvelContext.difficulty].astReviveCost[3 - m_iRemainReviveNum].bCostType); this.m_relivePayValue = dataByKey.astReviveInfo[curLvelContext.difficulty].astReviveCost[3 - m_iRemainReviveNum].dwCostPrice; string str = string.Format(Singleton <CTextManager> .GetInstance().GetText("ReliveMessage"), Singleton <CTextManager> .GetInstance().GetText(CMallSystem.s_payTypeNameKeys[(int)this.m_relivePayType])); GameObject widget = formScript.GetWidget(0); if (widget != null) { Text component = widget.GetComponent <Text>(); if (component != null) { component.text = str; } } GameObject obj3 = formScript.GetWidget(1); if (obj3 != null) { Image image = obj3.GetComponent <Image>(); if (image != null) { image.SetSprite(CMallSystem.GetPayTypeIconPath(this.m_relivePayType), formScript, true, false, false); } } GameObject obj4 = formScript.GetWidget(2); if (obj4 != null) { Text text2 = obj4.GetComponent <Text>(); if (text2 != null) { text2.text = this.m_relivePayValue.ToString(); } } GameObject gameObject = this.m_form.transform.Find("buffInfoPanel").gameObject; if (gameObject != null) { GameObject obj6 = gameObject.transform.Find("ReviveText/NumText").gameObject; if (obj6 != null) { obj6.GetComponent <Text>().text = m_iRemainReviveNum.ToString(); CUITimerScript script = gameObject.transform.Find("Timer").GetComponent <CUITimerScript>(); byte bReviveTimeMax = dataByKey.bReviveTimeMax; script.SetTotalTime((float)bReviveTimeMax); } } }
private void OnBuyPickDialogConfirm(CUIEvent uiEvent, uint count) { int bCount = (int)count; uint tagUInt = uiEvent.m_eventParams.tagUInt; int tag = uiEvent.m_eventParams.tag; CUseable useable = CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP, tagUInt, bCount); if (useable != null) { int num4 = (int)(useable.GetBuyPrice((RES_SHOPBUY_COINTYPE)tag) * bCount); enPayType payType = CMallSystem.ResBuyTypeToPayType(tag); stUIEventParams confirmEventParams = new stUIEventParams { tag = bCount }; string[] args = new string[] { bCount.ToString(), useable.m_name }; CMallSystem.TryToPay(enPayPurpose.Buy, Singleton <CTextManager> .GetInstance().GetText("Union_Battle_Tips5", args), payType, (uint)num4, enUIEventID.Union_Battle_ConfirmBuyItem, ref confirmEventParams, enUIEventID.None, true, true); } }
private void OnClickStartMatch(CUIEvent uiEvt) { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .instance.GetMasterRoleInfo(); if (masterRoleInfo != null) { CUseableContainer useableContainer = masterRoleInfo.GetUseableContainer(enCONTAINER_TYPE.ITEM); if (CUICommonSystem.IsMatchOpened(RES_BATTLE_MAP_TYPE.RES_BATTLE_MAP_TYPE_REWARDMATCH, this.m_selectMapID)) { int num = useableContainer.GetUseableStackCount(COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP, this.m_selectMapRes.dwConsumPayItemID) + useableContainer.GetUseableStackCount(COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP, this.m_selectMapRes.dwConsumFreeItemID); int dwCousumItemNum = (int)this.m_selectMapRes.dwCousumItemNum; if (num >= dwCousumItemNum) { this.SendBeginMatchReq(); } else { int bCount = dwCousumItemNum - num; CUseable useable = CUseableManager.CreateUseable(COM_ITEM_TYPE.COM_OBJTYPE_ITEMPROP, this.m_selectMapRes.dwConsumPayItemID, bCount); if (useable != null) { int num4 = (int)(useable.GetBuyPrice((RES_SHOPBUY_COINTYPE)this.m_selectMapRes.bCoinType) * bCount); enPayType payType = CMallSystem.ResBuyTypeToPayType(this.m_selectMapRes.bCoinType); stUIEventParams confirmEventParams = new stUIEventParams { tag = bCount }; string[] args = new string[] { bCount.ToString(), useable.m_name }; CMallSystem.TryToPay(enPayPurpose.Buy, Singleton <CTextManager> .GetInstance().GetText("Union_Battle_Tips5", args), payType, (uint)num4, enUIEventID.Union_Battle_ConfirmBuyItem, ref confirmEventParams, enUIEventID.None, true, true); } } } else { Singleton <CUIManager> .instance.OpenTips("Union_Battle_Tips4", true, 1f, null, new object[0]); } } }
public void OpenBuy(CUIFormScript form, Transform srcTrans) { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); DebugHelper.Assert(masterRoleInfo != null, "master roleInfo is null"); if (masterRoleInfo != null) { switch (this.m_ItemType) { case COM_ITEM_TYPE.COM_OBJTYPE_HERO: { ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(this.m_itemID); DebugHelper.Assert(dataByKey != null, "神秘商店配置的英雄ID有错,英雄表里不存在"); if (dataByKey != null) { if (masterRoleInfo.IsHaveHero(dataByKey.dwCfgID, false)) { stUIEventParams par = new stUIEventParams(); par.openHeroFormPar.heroId = dataByKey.dwCfgID; Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.HeroInfo_OpenForm, par); return; } stPayInfoSet lowestPayInfoSetOfGood = CMallSystem.GetLowestPayInfoSetOfGood(dataByKey, CMallSystem.ResBuyTypeToPayType(this.Cfg.bMoneyType)); CHeroSkinBuyManager.OpenBuyHeroForm(form, dataByKey.dwCfgID, lowestPayInfoSetOfGood, enUIEventID.Mall_Mystery_On_Buy_Item); break; } return; } case COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN: { ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(this.m_itemID); DebugHelper.Assert(heroSkin != null, "神秘商店配置的皮肤ID有错,皮肤表里不存在"); if (heroSkin != null) { ResHeroCfgInfo info3 = GameDataMgr.heroDatabin.GetDataByKey(heroSkin.dwHeroID); DebugHelper.Assert(info3 != null, "神秘商店配置的皮肤ID有错,皮肤对应的英雄不存在"); if (info3 == null) { return; } if (masterRoleInfo.IsHaveHeroSkin(heroSkin.dwHeroID, heroSkin.dwSkinID, false)) { stUIEventParams params2 = new stUIEventParams(); params2.openHeroFormPar.heroId = heroSkin.dwHeroID; params2.openHeroFormPar.skinId = heroSkin.dwSkinID; params2.openHeroFormPar.openSrc = enHeroFormOpenSrc.SkinBuyClick; Singleton <CUIEventManager> .GetInstance().DispatchUIEvent(enUIEventID.HeroInfo_OpenForm, params2); return; } if (masterRoleInfo.IsCanBuySkinButNotHaveHero(heroSkin.dwHeroID, heroSkin.dwSkinID)) { stUIEventParams params3 = new stUIEventParams { heroId = heroSkin.dwHeroID }; Singleton <CUIManager> .GetInstance().OpenMessageBoxWithCancel(string.Format("暂未拥有英雄{0},是否购买", StringHelper.UTF8BytesToString(ref info3.szName)), enUIEventID.Mall_Mystery_On_Buy_Hero_Not_Own, enUIEventID.None, params3, false); return; } stPayInfoSet payInfoSet = CMallSystem.GetLowestPayInfoSetOfGood(heroSkin, CMallSystem.ResBuyTypeToPayType(this.Cfg.bMoneyType)); CHeroSkinBuyManager.OpenBuyHeroSkinForm(heroSkin.dwHeroID, heroSkin.dwSkinID, true, payInfoSet, enUIEventID.Mall_Mystery_On_Buy_Item); break; } return; } } } }
public void UpdateView(CUIEvent uiEvent) { CUIFormScript srcFormScript = uiEvent.m_srcFormScript; GameObject srcWidget = uiEvent.m_srcWidget; if ((srcFormScript != null) && (srcWidget != null)) { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); DebugHelper.Assert(masterRoleInfo != null, "master roleInfo is null"); if (masterRoleInfo != null) { GameObject p = Utility.FindChild(srcWidget, "heroItem"); if (p == null) { DebugHelper.Assert(p != null, "hero item is null"); } else { Text componetInChild = Utility.GetComponetInChild <Text>(p, "heroDataPanel/heroNamePanel/heroNameText"); GameObject obj4 = Utility.FindChild(p, "heroDataPanel/heroNamePanel/heroSkinText"); if (obj4 != null) { Text component = obj4.GetComponent <Text>(); GameObject obj5 = Utility.FindChild(p, "tag"); if (obj5 != null) { GameObject obj6 = Utility.FindChild(p, "profession"); if (obj6 != null) { GameObject obj7 = Utility.FindChild(srcWidget, "imgExperienceMark"); if (obj7 != null) { GameObject obj8 = Utility.FindChild(p, "skinLabelImage"); if (obj8 != null) { GameObject obj9 = Utility.FindChild(p, "heroDataPanel/heroPricePanel"); if (obj9 != null) { obj9.CustomSetActive(false); GameObject obj10 = Utility.FindChild(srcWidget, "ButtonGroup/BuyBtn"); if (obj10 != null) { obj10.CustomSetActive(false); Text text3 = Utility.GetComponetInChild <Text>(obj10, "Text"); Button button = obj10.GetComponent <Button>(); if (button != null) { CUIEventScript script2 = obj10.GetComponent <CUIEventScript>(); if (script2 != null) { script2.enabled = false; button.enabled = false; GameObject obj11 = Utility.FindChild(srcWidget, "ButtonGroup/LinkBtn"); if (obj11 != null) { obj11.CustomSetActive(false); Text text4 = Utility.GetComponetInChild <Text>(obj11, "Text"); Button button2 = obj11.GetComponent <Button>(); if (button2 != null) { CUIEventScript script3 = obj11.GetComponent <CUIEventScript>(); if (script3 != null) { script3.enabled = false; button2.enabled = false; switch (this.m_ItemType) { case COM_ITEM_TYPE.COM_OBJTYPE_HERO: { ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(this.m_itemID); DebugHelper.Assert(dataByKey != null, "神秘商店配置的英雄ID有错,英雄表里不存在"); if (dataByKey != null) { CUICommonSystem.SetHeroItemImage(uiEvent.m_srcFormScript, p, StringHelper.UTF8BytesToString(ref dataByKey.szImagePath), enHeroHeadType.enBust, false); obj6.CustomSetActive(true); CUICommonSystem.SetHeroJob(srcFormScript, obj6, (enHeroJobType)dataByKey.bJob); obj8.CustomSetActive(false); obj4.CustomSetActive(false); if (componetInChild != null) { componetInChild.text = StringHelper.UTF8BytesToString(ref dataByKey.szName); } if (masterRoleInfo.IsHaveHero(dataByKey.dwCfgID, false)) { obj10.CustomSetActive(true); text3.text = Singleton <CTextManager> .GetInstance().GetText("Mall_Hero_State_Own"); obj5.CustomSetActive(false); obj7.CustomSetActive(false); } else { obj7.CustomSetActive(masterRoleInfo.IsValidExperienceHero(dataByKey.dwCfgID)); stPayInfoSet lowestPayInfoSetOfGood = CMallSystem.GetLowestPayInfoSetOfGood(dataByKey, CMallSystem.ResBuyTypeToPayType(this.Cfg.bMoneyType)); if (lowestPayInfoSetOfGood.m_payInfoCount == 0) { obj11.CustomSetActive(true); text4.text = StringHelper.UTF8BytesToString(ref dataByKey.szObtWay); if (dataByKey.bObtWayType > 0) { script3.enabled = true; button2.enabled = true; stUIEventParams eventParams = new stUIEventParams { tag = dataByKey.bObtWayType }; script3.SetUIEvent(enUIEventType.Click, enUIEventID.Mall_Jump_Form, eventParams); } else { script3.enabled = false; button2.enabled = false; } } else { obj9.CustomSetActive(true); obj10.CustomSetActive(true); text3.text = Singleton <CTextManager> .GetInstance().GetText("Mall_Buy"); script2.enabled = true; button.enabled = true; this.UpdateItemPricePnl(srcFormScript, obj9.transform, obj5.transform, ref lowestPayInfoSetOfGood); stUIEventParams params2 = new stUIEventParams { tag = uiEvent.m_srcWidgetIndexInBelongedList }; script2.SetUIEvent(enUIEventType.Click, enUIEventID.Mall_Mystery_On_Open_Buy_Form, params2); } } break; } return; } case COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN: { ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(this.m_itemID); DebugHelper.Assert(heroSkin != null, "神秘商店配置的皮肤ID有错,皮肤表里不存在"); if (heroSkin != null) { ResHeroCfgInfo info3 = GameDataMgr.heroDatabin.GetDataByKey(heroSkin.dwHeroID); DebugHelper.Assert(info3 != null, "神秘商店配置的皮肤ID有错,皮肤对应的英雄不存在"); if (info3 == null) { return; } CUICommonSystem.SetHeroItemImage(uiEvent.m_srcFormScript, p.gameObject, heroSkin.szSkinPicID, enHeroHeadType.enBust, false); obj6.CustomSetActive(false); CUICommonSystem.SetHeroSkinLabelPic(uiEvent.m_srcFormScript, obj8, heroSkin.dwHeroID, heroSkin.dwSkinID); obj4.CustomSetActive(true); if (componetInChild != null) { componetInChild.text = StringHelper.UTF8BytesToString(ref info3.szName); } if (component != null) { component.text = StringHelper.UTF8BytesToString(ref heroSkin.szSkinName); } if (masterRoleInfo.IsHaveHeroSkin(heroSkin.dwHeroID, heroSkin.dwSkinID, false)) { obj10.CustomSetActive(true); text3.text = Singleton <CTextManager> .GetInstance().GetText("Mall_Skin_State_Own"); obj5.CustomSetActive(false); obj7.CustomSetActive(false); } else { obj7.CustomSetActive(masterRoleInfo.IsValidExperienceSkin(heroSkin.dwHeroID, heroSkin.dwSkinID)); obj9.CustomSetActive(true); stPayInfoSet payInfoSet = CMallSystem.GetLowestPayInfoSetOfGood(heroSkin, CMallSystem.ResBuyTypeToPayType(this.Cfg.bMoneyType)); if (payInfoSet.m_payInfoCount == 0) { obj11.CustomSetActive(true); text4.text = StringHelper.UTF8BytesToString(ref heroSkin.szGetPath); } else { obj11.CustomSetActive(false); this.UpdateItemPricePnl(srcFormScript, obj9.transform, obj5.transform, ref payInfoSet); } if (masterRoleInfo.IsCanBuySkinButNotHaveHero(heroSkin.dwHeroID, heroSkin.dwSkinID)) { obj10.CustomSetActive(true); script2.enabled = true; text3.text = Singleton <CTextManager> .GetInstance().GetText("Mall_Skin_State_Buy_hero"); button.enabled = true; stUIEventParams params3 = new stUIEventParams(); params3.openHeroFormPar.heroId = heroSkin.dwHeroID; params3.openHeroFormPar.skinId = heroSkin.dwSkinID; params3.openHeroFormPar.openSrc = enHeroFormOpenSrc.SkinBuyClick; script2.SetUIEvent(enUIEventType.Click, enUIEventID.HeroInfo_OpenForm, params3); if (payInfoSet.m_payInfoCount > 0) { this.UpdateItemPricePnl(srcFormScript, obj9.transform, obj5.transform, ref payInfoSet); } } else { obj11.CustomSetActive(false); obj10.CustomSetActive(true); text3.text = Singleton <CTextManager> .GetInstance().GetText("Mall_Buy"); script2.enabled = true; button.enabled = true; stUIEventParams params4 = new stUIEventParams { tag = uiEvent.m_srcWidgetIndexInBelongedList }; script2.SetUIEvent(enUIEventType.Click, enUIEventID.Mall_Mystery_On_Open_Buy_Form, params4); } } break; } return; } } } } } } } } } } } } } } } } } }
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); }
private void OnBuyHeroNotOwn(CUIEvent uiEvent) { uint heroId = uiEvent.m_eventParams.heroId; DebugHelper.Assert(heroId != 0, "未拥有的英雄ID不能为0"); if (heroId != 0) { ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(heroId); DebugHelper.Assert(dataByKey != null, "神秘商店配置的英雄ID有错,英雄表里不存在"); if (dataByKey != null) { CMallMysteryProduct product = this.GetProduct(4, heroId); if (product != null) { stPayInfoSet lowestPayInfoSetOfGood = CMallSystem.GetLowestPayInfoSetOfGood(dataByKey, CMallSystem.ResBuyTypeToPayType(product.Cfg.bMoneyType)); CHeroSkinBuyManager.OpenBuyHeroForm(uiEvent.m_srcFormScript, heroId, lowestPayInfoSetOfGood, enUIEventID.Mall_Mystery_On_Buy_Item); } else { CHeroSkinBuyManager.OpenBuyHeroForm(uiEvent.m_srcFormScript, heroId, new stPayInfoSet(), enUIEventID.None); } } } }
public void RefreshForm(int effectIndex = -1) { CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(s_talentBuyFormPath); if (form != null) { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); if (masterRoleInfo != null) { CHeroInfo heroInfo = masterRoleInfo.GetHeroInfo(this.m_heroID, false); HeroTalentViewInfo heroTalentViewInfo = TalentView.GetHeroTalentViewInfo(this.m_heroID); if (heroTalentViewInfo != null) { CUIListScript[] scriptArray = new CUIListScript[] { form.gameObject.transform.Find("Panel/PanelLeft/List1").GetComponent <CUIListScript>(), form.gameObject.transform.Find("Panel/PanelLeft/List2").GetComponent <CUIListScript>(), form.gameObject.transform.Find("Panel/PanelLeft/List3").GetComponent <CUIListScript>(), form.gameObject.transform.Find("Panel/PanelLeft/List4").GetComponent <CUIListScript>(), form.gameObject.transform.Find("Panel/PanelLeft/List5").GetComponent <CUIListScript>() }; for (int i = 0; i < 5; i++) { CUIListScript script2 = scriptArray[i]; HeroTalentLevelInfo info4 = heroTalentViewInfo.m_heroTalentLevelInfoList[i]; ResTalentLib lib = info4.m_tarlentLibList[info4.m_tarlentLibList.Count - 1]; Button component = script2.transform.Find("BtnBuyCoin").GetComponent <Button>(); Text text = script2.transform.Find("lblTips").GetComponent <Text>(); Text text2 = text.transform.Find("Text").GetComponent <Text>(); Image image = text.transform.Find("Image").GetComponent <Image>(); component.gameObject.CustomSetActive(false); text2.gameObject.CustomSetActive(false); image.gameObject.CustomSetActive(false); if (!TalentView.IsHaveTalentBuyFunc(this.m_heroID)) { text.text = Singleton <CTextManager> .instance.GetText("Talent_Buy_3"); } else if ((heroInfo == null) && (i == 0)) { text.text = Singleton <CTextManager> .instance.GetText("Skin_NeedToBuyAHero"); } else if (TalentView.IsBuyTalent(this.m_heroID, i)) { text.text = Singleton <CTextManager> .instance.GetText("Talent_Buy_2"); } else if ((i > 0) && !TalentView.IsBuyTalent(this.m_heroID, i - 1)) { int num2 = heroTalentViewInfo.m_heroTalentLevelInfoList[i - 1].m_tarlentLibList.Count - 1; string str = StringHelper.UTF8BytesToString(ref heroTalentViewInfo.m_heroTalentLevelInfoList[i - 1].m_tarlentLibList[num2].szName); string[] args = new string[] { str }; text.text = Singleton <CTextManager> .instance.GetText("Talent_Buy_4", args); } else { if (heroInfo == null) { continue; } string str2 = StringHelper.UTF8BytesToString(ref CHeroInfo.GetHeroProficiency(heroInfo.cfgInfo.bJob, heroInfo.m_ProficiencyLV).szTitle); string str3 = StringHelper.UTF8BytesToString(ref CHeroInfo.GetHeroProficiency(heroInfo.cfgInfo.bJob, info4.m_levelDetail.bLvl3UnlockLvl).szTitle); if (heroInfo.m_ProficiencyLV < info4.m_levelDetail.bLvl3UnlockLvl) { component.gameObject.CustomSetActive(true); stUIEventParams eventParams = new stUIEventParams { tag = info4.m_levelDetail.bLvl3LockCostType, tagUInt = info4.m_levelDetail.dwLvl3LockCostPrice, tag2 = i, tagStr = StringHelper.UTF8BytesToString(ref lib.szName) }; CMallSystem.SetPayButton(form, (RectTransform)component.transform, CMallSystem.ResBuyTypeToPayType(info4.m_levelDetail.bLvl3LockCostType), info4.m_levelDetail.dwLvl3LockCostPrice, enUIEventID.Talent_Buy_BtnSellClick, ref eventParams); string[] textArray2 = new string[] { str3 }; text.text = Singleton <CTextManager> .instance.GetText("Talent_Buy_7", textArray2); text2.gameObject.CustomSetActive(true); image.gameObject.CustomSetActive(true); CMallSystem.SetPayButton(form, (RectTransform)text.transform, CMallSystem.ResBuyTypeToPayType(info4.m_levelDetail.bLvl3UnLockCostType), info4.m_levelDetail.dwLvl3UnLockCostPrice, enUIEventID.None, ref eventParams); } else { component.gameObject.CustomSetActive(true); stUIEventParams params2 = new stUIEventParams { tag = info4.m_levelDetail.bLvl3UnLockCostType, tagUInt = info4.m_levelDetail.dwLvl3UnLockCostPrice, tag2 = i, tagStr = StringHelper.UTF8BytesToString(ref lib.szName) }; CMallSystem.SetPayButton(form, (RectTransform)component.transform, CMallSystem.ResBuyTypeToPayType(info4.m_levelDetail.bLvl3UnLockCostType), info4.m_levelDetail.dwLvl3UnLockCostPrice, enUIEventID.Talent_Buy_BtnSellClick, ref params2); string[] textArray3 = new string[] { str2 }; text.text = Singleton <CTextManager> .instance.GetText("Talent_Buy_8", textArray3); } } script2.SetElementAmount(info4.m_tarlentLibList.Count); for (int j = 0; j < info4.m_tarlentLibList.Count; j++) { GameObject gameObject = script2.GetElemenet(j).gameObject.transform.Find("talentCell").gameObject; Image image2 = gameObject.transform.Find("imgIcon").GetComponent <Image>(); Image image3 = gameObject.transform.Find("lock").GetComponent <Image>(); Text text3 = gameObject.transform.Find("lblName").GetComponent <Text>(); CanvasGroup group = gameObject.GetComponent <CanvasGroup>(); CUIEventScript script3 = gameObject.GetComponent <CUIEventScript>(); ResTalentLib lib2 = info4.m_tarlentLibList[j]; if (lib2 == null) { return; } image2.SetSprite(CUIUtility.s_Sprite_Dynamic_Talent_Dir + lib2.dwIcon, form, true, false, false); image2.color = CUIUtility.s_Color_White; text3.text = StringHelper.UTF8BytesToString(ref lib2.szName); stTalentEventParams params3 = new stTalentEventParams { talentLevelIndex = (byte)i, talentInfo = info4.m_tarlentLibList[j], isCanLearn = false }; if (TalentView.IsNeedBuy(i, j) && !TalentView.IsBuyTalent(this.m_heroID, i)) { params3.isHaveTalent = false; image3.gameObject.CustomSetActive(true); image2.color = CUIUtility.s_Color_GrayShader; } else { params3.isHaveTalent = true; image3.gameObject.CustomSetActive(false); image2.color = CUIUtility.s_Color_White; if ((effectIndex == i) && (j == (info4.m_tarlentLibList.Count - 1))) { CUICommonSystem.PlayAnimator(gameObject, "UnLock_Anim"); } } string strContent = StringHelper.UTF8BytesToString(ref lib2.szDesc); CUICommonSystem.SetCommonTipsEvent(form, gameObject, strContent, enUseableTipsPos.enTop); } } } } } }