48 lines
1.6 KiB
Lua
48 lines
1.6 KiB
Lua
local FundLevelManager = class("FundLevelManager", BaseModule)
|
|
|
|
function FundLevelManager:getReward(stage)
|
|
if not DataManager.FundLevelData:canGetRewards(stage) then
|
|
return
|
|
end
|
|
self:sendMessage(ProtoMsgType.FromMsgEnum.LevelFundClaimedReq, {id = 0, grade = 0, stage = stage}, self.onGetReward, BIReport.ITEM_GET_TYPE.ACT_LEVEL_FUND_REWARD)
|
|
end
|
|
|
|
function FundLevelManager:onGetReward(result)
|
|
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
|
|
return
|
|
end
|
|
|
|
local currStage = result.reqData.stage
|
|
local minId = DataManager.FundLevelData:getMinUnclaimedRewardIndex(currStage)
|
|
local maxId = DataManager.FundLevelData:getMaxUnclaimedRewardIndex(currStage)
|
|
minId = DataManager.FundLevelData:getConfigIdByIndex(currStage, minId)
|
|
maxId = DataManager.FundLevelData:getConfigIdByIndex(currStage, maxId)
|
|
local cur = DataManager.FundLevelData:getMaxUnclaimedId()
|
|
GFunc.showRewardBox(result.rewards)
|
|
DataManager.FundLevelData:initData(result.info)
|
|
BIReport:postGrowFund(currStage, minId, maxId, cur, result.rewards)
|
|
end
|
|
|
|
function FundLevelManager:onBuyLevelGift(id)
|
|
PayManager:purchasePackage(id, PayManager.PURCHARSE_TYPE.ACT_GIFT)
|
|
end
|
|
|
|
--region 上报
|
|
local EVENT_GROW_FUND = "client_grow_fund" -- 成长基金
|
|
|
|
BIReport.ITEM_GET_TYPE.ACT_LEVEL_FUND_REWARD = "act_level_fund_reward"
|
|
|
|
function BIReport:postGrowFund(stage, minId, maxId, curLv, rewards)
|
|
local args = {
|
|
opt_type = "Reward",
|
|
fund_stage = stage,
|
|
min_id = minId,
|
|
max_id = maxId,
|
|
cur_lv = curLv,
|
|
reward_str = rewards and GFunc.getRewardsStr(rewards) or nil,
|
|
}
|
|
self:report(EVENT_GROW_FUND, args)
|
|
end
|
|
--endregion
|
|
|
|
return FundLevelManager |