local IdleManager = class("IdleManager", BaseModule) function IdleManager:showIdleDropUI(params) self:getIdleShowRewrad() UIManager:showUI("app/ui/idle/idle_drop_ui", params) end function IdleManager:showIdleQuickDropUI(params) UIManager:showUI("app/ui/idle/idle_quick_drop_ui", params) end function IdleManager:getIdleShowRewrad() self:sendMessage(ProtoMsgType.FromMsgEnum.IdleInfoReq, {}, self.onGetIdleShowRewrad, BIReport.ITEM_GET_TYPE.NONE) end function IdleManager:onGetIdleShowRewrad(result) if result.err_code == GConst.ERROR_STR.SUCCESS then DataManager.IdleData:onGetIdleShowRewrad(result) end end function IdleManager:getIdleRewrad() self:sendMessage(ProtoMsgType.FromMsgEnum.IdleRewardReq, {}, self.onGetIdleRewrad, BIReport.ITEM_GET_TYPE.IDLE_DROP) end function IdleManager:onGetIdleRewrad(result) if result.err_code == GConst.ERROR_STR.SUCCESS then if result.rewards and next(result.rewards) then GFunc.showRewardBox(result.rewards) end DataManager.IdleData:onGetIdleRewrad(result.claim_at) end end function IdleManager:getIdleQuickRewrad(isAd) if isAd then SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.IDLE_QUICK_DROP, function () local args = { ad = true } self:sendMessage(ProtoMsgType.FromMsgEnum.IdleQuickReq, args, self.onGetIdleQuickRewrad, BIReport.ITEM_GET_TYPE.IDLE_QUICK_DROP) end) else local cost = DataManager.IdleData:getQuickIdleCost()[1] local costId = GFunc.getRewardId(cost) local costNum = GFunc.getRewardNum(cost) if not GFunc.checkCost(costId, costNum, true) then if costId == GConst.ItemConst.ITEM_ID_VIT then ModuleManager.CommerceManager:showBuyVitUI() end return end local args = { ad = false } self:sendMessage(ProtoMsgType.FromMsgEnum.IdleQuickReq, args, self.onGetIdleQuickRewrad, BIReport.ITEM_GET_TYPE.IDLE_QUICK_DROP) end end function IdleManager:onGetIdleQuickRewrad(result) if result.err_code == GConst.ERROR_STR.SUCCESS then if result.rewards then GFunc.showRewardBox(result.rewards) end DataManager.IdleData:onGetIdleQuickRewrad(result) end end return IdleManager