local SummonManager = class("SummonManager", BaseModule) -- 商城宝箱 function SummonManager:summon(summonType, costType) if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.STORE_BOX_OPEN, true) then return end if summonType == GConst.SummonConst.SUMMON_TYPE.LV_3 and not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.STORE_BOX_3_OPEN, true) then return end local costItem, cost = DataManager.SummonData:getSummonCost(summonType) if costType == 1 then if not GFunc.checkCost(costItem.id, costItem.num, false) then return end else if not GFunc.checkCost(cost.id, cost.num, false) then return end end local params = {type = summonType, consume_type = costType} local responseData = {} self:sendMessage(ProtoMsgType.FromMsgEnum.SummonReq, params, responseData, self.summonFinish, BIReport.ITEM_GET_TYPE.SUMMON) end function SummonManager:summonFinish(result) if result.err_code == GConst.ERROR_STR.SUCCESS then DataManager.SummonData:cacheSummonRewards(result.rewards) -- 缓存一下 防止有其他地方需要使用 DataManager.SummonData:init(result.summon_info) ModuleManager.ShopManager:showBoxOpenUI({type = result.reqData.type}) end end return SummonManager