修复一些bug

This commit is contained in:
xiekaidong 2023-09-04 18:21:17 +08:00
parent ec33c7b7df
commit b47d779cfc
5 changed files with 23 additions and 7 deletions

View File

@ -22,6 +22,7 @@ end
function FourteenDayManager:rspTaskReward(result) function FourteenDayManager:rspTaskReward(result)
if result.err_code == GConst.ERROR_STR.SUCCESS then if result.err_code == GConst.ERROR_STR.SUCCESS then
DataManager.FourteenDayData:onReceivedTaskReward(result.reqData.id) DataManager.FourteenDayData:onReceivedTaskReward(result.reqData.id)
GFunc.showRewardBox(result.rewards)
end end
end end
@ -41,13 +42,15 @@ function FourteenDayManager:rspBountyReward(result)
end end
-- 请求兑换奖励 -- 请求兑换奖励
function FourteenDayManager:reqExchangeReward(id) function FourteenDayManager:reqExchangeReward(id, count)
self:sendMessage(ProtoMsgType.FromMsgEnum.FourteenBountyExchangeAwardReq, {id = id}, {}, self.rspExchangeReward, BIReport.ITEM_GET_TYPE.ACT_FOURTEEN_DAY_EXCHANGE) self:sendMessage(ProtoMsgType.FromMsgEnum.FourteenBountyExchangeAwardReq, {id = id, count = count or 0}, {}, self.rspExchangeReward, BIReport.ITEM_GET_TYPE.ACT_FOURTEEN_DAY_EXCHANGE)
end end
function FourteenDayManager:rspExchangeReward(result) function FourteenDayManager:rspExchangeReward(result)
if result.err_code == GConst.ERROR_STR.SUCCESS then if result.err_code == GConst.ERROR_STR.SUCCESS then
DataManager.FourteenDayData:onReceivedExchangeReward(result.reqData.id) if result.reqData.count then
DataManager.FourteenDayData:onReceivedExchangeReward(result.reqData.id, result.reqData.count)
end
GFunc.showRewardBox(result.rewards) GFunc.showRewardBox(result.rewards)
end end

View File

@ -12,7 +12,12 @@ function FourteenDayExchangeCell:init()
self:addClickListener(function() self:addClickListener(function()
if DataManager.FourteenDayData:canExchange(self.id) then if DataManager.FourteenDayData:canExchange(self.id) then
ModuleManager.FourteenDayManager:reqExchangeReward(self.id) local cost = DataManager.FourteenDayData:getExchangeCost(self.id)
local remainCount = DataManager.FourteenDayData:getExchangeRemainTime(self.id)
local reward = DataManager.FourteenDayData:getExchangeReward(self.id)
ModuleManager.CommonManager:showExchangeUI(1, remainCount, reward, cost, function(count)
ModuleManager.FourteenDayManager:reqExchangeReward(self.id, count)
end)
end end
end) end)
end end

View File

@ -34,6 +34,9 @@ function FourteenDayTaskCell:refresh(id)
local minScore = DataManager.ArenaData:getSeasonGradingMinScore() local minScore = DataManager.ArenaData:getSeasonGradingMinScore()
total = total - minScore total = total - minScore
cur = cur - minScore cur = cur - minScore
if cur < 0 then
cur = 0
end
end end
self.imgTask:setSprite(GConst.ATLAS_PATH.ICON_TASK, tostring(DataManager.FourteenDayData:getTaskIcon(self.taskId))) self.imgTask:setSprite(GConst.ATLAS_PATH.ICON_TASK, tostring(DataManager.FourteenDayData:getTaskIcon(self.taskId)))
self.txDesc:setText(DataManager.FourteenDayData:getTaskDesc(self.taskId)) self.txDesc:setText(DataManager.FourteenDayData:getTaskDesc(self.taskId))

View File

@ -506,6 +506,10 @@ function FourteenDayData:getExchangeCostNum(id)
return GFunc.getRewardNum(self:getExchangeCfg()[id].cost) return GFunc.getRewardNum(self:getExchangeCfg()[id].cost)
end end
function FourteenDayData:getExchangeCost(id)
return self:getExchangeCfg()[id].cost
end
-- 获取兑换的奖励道具 -- 获取兑换的奖励道具
function FourteenDayData:getExchangeReward(id) function FourteenDayData:getExchangeReward(id)
return self:getExchangeCfg()[id].reward return self:getExchangeCfg()[id].reward
@ -521,12 +525,13 @@ function FourteenDayData:onShowExchangeView()
end end
-- 兑换奖励领取成功 -- 兑换奖励领取成功
function FourteenDayData:onReceivedExchangeReward(id) function FourteenDayData:onReceivedExchangeReward(id, count)
count = count or 1
if self.exchangeStatus[id] == nil then if self.exchangeStatus[id] == nil then
self.exchangeStatus[id] = 0 self.exchangeStatus[id] = 0
end end
self.exchangeStatus[id] = self.exchangeStatus[id] + 1 self.exchangeStatus[id] = self.exchangeStatus[id] + count
self:setDirty() self:setDirty()
end end

View File

@ -720,7 +720,7 @@ function ArenaData:onBattleResultReceived(settlement, result)
if self:getGradingIdFromScore(beforeMaxGrading) ~= self:getGradingIdFromScore(self.maxScore) then if self:getGradingIdFromScore(beforeMaxGrading) ~= self:getGradingIdFromScore(self.maxScore) then
DataManager.HeroData:checkIfCanShowHeroUnlockDan(self:getFormartMaxGrading()) DataManager.HeroData:checkIfCanShowHeroUnlockDan(self:getFormartMaxGrading())
end end
if beforeMaxGrading > self.maxScore then if beforeMaxGrading < self.maxScore then
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_ARENA_GRADING, self.maxScore - beforeMaxGrading) ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_ARENA_GRADING, self.maxScore - beforeMaxGrading)
end end