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, 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 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 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 OnBuyItem(CUIEvent uiEvent) { enPayType tag = (enPayType)uiEvent.m_eventParams.tag; uint commonUInt32Param = uiEvent.m_eventParams.commonUInt32Param1; string goodName = string.Empty; COM_ITEM_TYPE cOM_ITEM_TYPE; uint num; if (uiEvent.m_eventParams.heroSkinParam.skinId != 0u) { cOM_ITEM_TYPE = COM_ITEM_TYPE.COM_OBJTYPE_HEROSKIN; num = CSkinInfo.GetSkinCfgId(uiEvent.m_eventParams.heroSkinParam.heroId, uiEvent.m_eventParams.heroSkinParam.skinId); ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin(num); DebugHelper.Assert(heroSkin != null, string.Format("找不到皮肤{0}的配置信息", num)); if (heroSkin == null) { return; } goodName = StringHelper.UTF8BytesToString(ref heroSkin.szSkinName); } else { if (uiEvent.m_eventParams.heroId == 0u) { DebugHelper.Assert(false, "神秘商店购买不支持该物品类型"); return; } cOM_ITEM_TYPE = COM_ITEM_TYPE.COM_OBJTYPE_HERO; num = uiEvent.m_eventParams.heroId; ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(num); DebugHelper.Assert(dataByKey != null, string.Format("找不到英雄{0}的配置信息", num)); if (dataByKey == null) { return; } goodName = StringHelper.UTF8BytesToString(ref dataByKey.szName); } int productID = this.GetProductID(num); if (productID < 0) { DebugHelper.Assert(false, string.Format("神秘商店找不到该物品{0}/{1}", Enum.GetName(typeof(COM_ITEM_TYPE), cOM_ITEM_TYPE), num)); return; } CUIEvent uIEvent = Singleton <CUIEventManager> .GetInstance().GetUIEvent(); uIEvent.m_eventID = enUIEventID.Mall_Mystery_On_Confirm_Buy_Item; uIEvent.m_eventParams.tag = productID; CMallSystem.TryToPay(enPayPurpose.Buy, goodName, tag, commonUInt32Param, uIEvent.m_eventID, ref uIEvent.m_eventParams, enUIEventID.None, false, true, false); }
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]); } } }