local SignManager = class("SignManager", BaseModule) -- 领取遗留奖励 function SignManager:reqSignAutoRewardsClaimed() self:sendMessage(ProtoMsgType.FromMsgEnum.SignAutoRewardsClaimedReq, {}, self.rspSignAutoRewardsClaimed, BIReport.ITEM_GET_TYPE.SIGN_BOUNTY_REWARD) end function SignManager:rspSignAutoRewardsClaimed(result) if result.err_code ~= GConst.ERROR_STR.SUCCESS then return end if result.rewards and #result.rewards > 0 then GFunc.showRewardBox(result.rewards) BIReport:postSignBountyOpt(BIReport.SIGN_WEEK_OPT_TYPE.REWARD) end end function SignManager:showSignUI(showPage, onlyShowPage, callback) local params = { showPage = showPage, onlyShowPage = onlyShowPage, callback = callback } UIManager:showUI("app/ui/sign/sign_main_ui", params) end -- 签到 function SignManager:reqSignClaimed(day, isAll) local isUnlock = DataManager.SignWeekData:isUnlockPro(day) self:sendMessage(ProtoMsgType.FromMsgEnum.SignClaimedReq, {day = day, pay = isUnlock, all = isAll}, self.rspSignClaimed, BIReport.ITEM_GET_TYPE.SIGN_BOUNTY_SIGH) end function SignManager:rspSignClaimed(result) if result.err_code ~= GConst.ERROR_STR.SUCCESS then return end GFunc.showRewardBox(result.rewards) DataManager.SignWeekData:initData(result.info) BIReport:postSignBountyOpt(BIReport.SIGN_WEEK_OPT_TYPE.SIGN) end -- 补签 function SignManager:reqSignReCheckin(day) self:sendMessage(ProtoMsgType.FromMsgEnum.SignReCheckinReq, {day = day}, self.rspSignReCheckin, BIReport.ITEM_GET_TYPE.SIGN_BOUNTY_RESIGH) end function SignManager:rspSignReCheckin(result) if result.err_code ~= GConst.ERROR_STR.SUCCESS then return end GFunc.showRewardBox(result.rewards) DataManager.SignWeekData:initData(result.info) BIReport:postSignBountyOpt(BIReport.SIGN_WEEK_OPT_TYPE.RESIGN) end function SignManager:reqMonthSign(day) self:sendMessage(ProtoMsgType.FromMsgEnum.Sign30ClaimReq, {day = day}, self.rspMonthSign, BIReport.ITEM_GET_TYPE.SIGN_MONTH) end function SignManager:rspMonthSign(result) if result.err_code ~= GConst.ERROR_STR.SUCCESS then return end BIReport:postSignBountyOpt(BIReport.SIGN_MONTH_OPT_TYPE.SIGN) GFunc.showRewardBox(result.rewards) DataManager.SignMonthData:setSignSucceed() end function SignManager:reqMonthSignAgain() self:sendMessage(ProtoMsgType.FromMsgEnum.Sign30ClaimReq, {again = true}, self.rspSignMonthAgain, BIReport.ITEM_GET_TYPE.SIGN_MONTH_AGAIN) end function SignManager:rspSignMonthAgain(result) if result.err_code ~= GConst.ERROR_STR.SUCCESS then return end GFunc.showRewardBox(result.rewards) DataManager.SignMonthData:setSignAgainSucceed() BIReport:postSignBountyOpt(BIReport.SIGN_MONTH_OPT_TYPE.SIGN_AGAIN) end function SignManager:reqMonthAccumClaim(day) self:sendMessage(ProtoMsgType.FromMsgEnum.Sign30AccumClaimReq, {id = day}, self.rspMonthAccumClaim, BIReport.ITEM_GET_TYPE.SIGN_MONTH_ACCUM_CLAIM) end function SignManager:rspMonthAccumClaim(result) if result.err_code ~= GConst.ERROR_STR.SUCCESS then return end GFunc.showRewardBox(result.rewards) DataManager.SignMonthData:setAccumClaimSucceed(result.reqData.id) BIReport:postSignBountyOpt(BIReport.SIGN_MONTH_OPT_TYPE.ACCUM_CLAIM) end --region 上报 local EVENT_SIGN_BOUNTY = "client_sign_bounty"-- 签到战令 BIReport.SIGN_WEEK_OPT_TYPE = { SIGN = "Sign", RESIGN = "ReSign", REWARD = "Reward" } BIReport.SIGN_MONTH_OPT_TYPE = { SIGN = "Sign", SIGN_AGAIN = "SignAgain", ACCUM_CLAIM = "AccumClaim" } -- 七日签到战令 function BIReport:postSignBountyOpt(optType, day, rewards) local args = { opt_type = optType, day = day, reward_str = GFunc.getRewardsStr(rewards), } self:report(EVENT_SIGN_BOUNTY, args) end --endregion return SignManager