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); }
private bool CheckNameChangeCardCount() { int nameChangeHaveItemCount = this.GetNameChangeHaveItemCount(this.m_curChangeType); int nameChangeCostItemCount = this.GetNameChangeCostItemCount(this.m_curChangeType); if (nameChangeHaveItemCount < nameChangeCostItemCount) { if (CSysDynamicBlock.bLobbyEntryBlocked) { string text = Singleton <CTextManager> .GetInstance().GetText("NameChange_ErrorItemNotEnough"); Singleton <CUIManager> .GetInstance().OpenMessageBox(text, false); } else { uint nameChangeCardShopProductKey = this.GetNameChangeCardShopProductKey(this.m_curChangeType); CMallFactoryShopController.ShopProduct product = Singleton <CMallFactoryShopController> .GetInstance().GetProduct(nameChangeCardShopProductKey); if (product == null) { DebugHelper.Assert(false, "错误的特卖商品ID"); return(false); } ResPropInfo dataByKey = GameDataMgr.itemDatabin.GetDataByKey(product.ID); if (dataByKey == null) { DebugHelper.Assert(false, "错误的商品ID"); return(false); } CUseable cUseable = CUseableManager.CreateUseable(product.Type, 0uL, product.ID, (int)product.LimitCount, 0); uint num = product.ConvertWithRealDiscount(cUseable.GetBuyPrice(product.CoinType)); int num2 = nameChangeCostItemCount - nameChangeHaveItemCount; string text2 = Singleton <CTextManager> .GetInstance().GetText("NameChange_GuideToMall", new string[] { num2.ToString(), dataByKey.szName, ((long)num2 * (long)((ulong)num)).ToString() }); stUIEventParams par = default(stUIEventParams); par.tag = num2; Singleton <CUIManager> .GetInstance().OpenMessageBoxWithCancel(text2, enUIEventID.NameChange_GuideToMall, enUIEventID.None, par, false); } return(false); } return(true); }
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]); } } }