protected override void OnRequest(request_mall_buy request, object userdata) { if (userdata is MallBuyItemAction) { MallBuyItemAction param = userdata as MallBuyItemAction; request.mallid = param.ResId; request.subid = param.SubIdx; } }
void BuyMallItem(int resId, int subId) { MallTableItem item = Module.MallTable[resId] as MallTableItem; if (item == null) { return; } PlayerDataModule pdm = ModuleManager.Instance.FindModule <PlayerDataModule>(); //有钱没; MallItemInfo info = item.mallItems[subId]; ProceedsType pt = (ProceedsType)item.processType; if (pdm.GetProceeds(pt) < info.processNow) { //PromptUIManager.Instance.AddNewPrompt(ShopModule.GetBuyMoneyNotEnougthStr(pt)); PopTipManager.Instance.AddNewTip(StringHelper.StringWithColor(FontColor.Red, ShopModule.GetBuyMoneyNotEnougthStr(pt))); return; } //次数够了没; switch (mModule.GetLimitTypeByID(resId)) { case MallLimitType.ERROR: GameDebug.LogError("数据错误"); return; case MallLimitType.NONE: break; case MallLimitType.DAY: case MallLimitType.FOREVER: if (mModule.GetPlayerBuyTimes(resId) >= item.limitTimes) { //PromptUIManager.Instance.AddNewPrompt(StringHelper.GetString("buy_no_time")); PopTipManager.Instance.AddNewTip(StringHelper.StringWithColor(FontColor.Red, StringHelper.GetString("buy_no_time"))); return; } break; } MallBuyItemAction param = new MallBuyItemAction(); param.ResId = resId; param.SubIdx = subId; Net.Instance.DoAction((int)Message.MESSAGE_ID.ID_MSG_MALL_BUY, param); }