提示逻辑补全
This commit is contained in:
parent
7a87210ae3
commit
d473cbc537
@ -21,7 +21,7 @@ end
|
|||||||
|
|
||||||
-- 开始挑战
|
-- 开始挑战
|
||||||
function DailyChallengeManager:startChallenge()
|
function DailyChallengeManager:startChallenge()
|
||||||
Logger.logHighlight("开始每日挑战")
|
Logger.logHighlight("每日挑战 开始挑战...")
|
||||||
-- 判断次数
|
-- 判断次数
|
||||||
if not DataManager.DailyChallengeData:isEnoughChallengeTime() then
|
if not DataManager.DailyChallengeData:isEnoughChallengeTime() then
|
||||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_1))
|
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_1))
|
||||||
@ -45,17 +45,6 @@ function DailyChallengeManager:startChallenge()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local cost = DataManager.DailyChallengeData:getChallengeHpCost()
|
|
||||||
local vitCostNum = 0
|
|
||||||
if cost then
|
|
||||||
vitCostNum = GFunc.getRewardNum(cost)
|
|
||||||
end
|
|
||||||
if vitCostNum > DataManager.BagData.ItemData:getVit() then -- 体力不足
|
|
||||||
GFunc.showItemNotEnough(GConst.ItemConst.ITEM_ID_VIT)
|
|
||||||
ModuleManager.CommerceManager:showBuyVitUI()
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local parmas = {}
|
local parmas = {}
|
||||||
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterDailyChallengeStartReq, parmas, {}, self.rspStartChallenge, BIReport.ITEM_GET_TYPE.DAILY_CHALLENGE)
|
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterDailyChallengeStartReq, parmas, {}, self.rspStartChallenge, BIReport.ITEM_GET_TYPE.DAILY_CHALLENGE)
|
||||||
end
|
end
|
||||||
@ -69,6 +58,7 @@ end
|
|||||||
|
|
||||||
-- 挑战结束
|
-- 挑战结束
|
||||||
function DailyChallengeManager:endChallenge(chapterId, combatReport, taskProgress, heroInfo, lastBossRound)
|
function DailyChallengeManager:endChallenge(chapterId, combatReport, taskProgress, heroInfo, lastBossRound)
|
||||||
|
Logger.logHighlight("每日挑战 挑战完成...")
|
||||||
local parmas = {
|
local parmas = {
|
||||||
win = combatReport.victory,
|
win = combatReport.victory,
|
||||||
chapter_id = chapterId,
|
chapter_id = chapterId,
|
||||||
@ -81,7 +71,7 @@ function DailyChallengeManager:endChallenge(chapterId, combatReport, taskProgres
|
|||||||
parmas[fieldName] = value
|
parmas[fieldName] = value
|
||||||
end
|
end
|
||||||
|
|
||||||
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterSettlementReq, parmas, {}, self.endChallengeFinish, BIReport.ITEM_GET_TYPE.DAILY_CHALLENGE_END)
|
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterDailyChallengeSettlementReq, parmas, {}, self.endChallengeFinish, BIReport.ITEM_GET_TYPE.DAILY_CHALLENGE_END)
|
||||||
end
|
end
|
||||||
|
|
||||||
function DailyChallengeManager:endChallengeFinish(result)
|
function DailyChallengeManager:endChallengeFinish(result)
|
||||||
@ -96,13 +86,12 @@ function DailyChallengeManager:endChallengeFinish(result)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function DailyChallengeManager:onDayChange()
|
function DailyChallengeManager:onDayChange()
|
||||||
|
Logger.logHighlight("每日挑战 跨天...")
|
||||||
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterDailyChallengeResetReq, nil, {}, self.rspDayChange, BIReport.ITEM_GET_TYPE.DAILY_CHALLENGE_RESET)
|
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterDailyChallengeResetReq, nil, {}, self.rspDayChange, BIReport.ITEM_GET_TYPE.DAILY_CHALLENGE_RESET)
|
||||||
end
|
end
|
||||||
|
|
||||||
function DailyChallengeManager:rspDayChange(result)
|
function DailyChallengeManager:rspDayChange(result)
|
||||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
|
||||||
DataManager.DailyChallengeData:init(result.daily_challenge)
|
DataManager.DailyChallengeData:init(result.daily_challenge)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取波次(战斗)奖励
|
-- 获取波次(战斗)奖励
|
||||||
|
|||||||
@ -17,6 +17,11 @@ TipsManager.ALIGN_TYPE = {
|
|||||||
RIGHT_BOTTOM = 13
|
RIGHT_BOTTOM = 13
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TipsManager.REWARDS_TIPS_TYPE = {
|
||||||
|
COMMON = "reward_node",
|
||||||
|
TASK = "reward2_node",
|
||||||
|
}
|
||||||
|
|
||||||
function TipsManager:showHelpTips(params)
|
function TipsManager:showHelpTips(params)
|
||||||
params = params or {}
|
params = params or {}
|
||||||
UIManager:showUI("app/ui/tips/help_tips", params)
|
UIManager:showUI("app/ui/tips/help_tips", params)
|
||||||
@ -57,7 +62,7 @@ function TipsManager:showItemTips(id, tarPrefabObj, alignType)
|
|||||||
UIManager:showUI("app/ui/tips/item_tips", params)
|
UIManager:showUI("app/ui/tips/item_tips", params)
|
||||||
end
|
end
|
||||||
|
|
||||||
function TipsManager:showRewardsTips(rewards, customTitleStr, tarPrefabObj, callback, alignType)
|
function TipsManager:showRewardsTips(rewards, customTitleStr, tarPrefabObj, callback, alignType, showBlackBg, typeNode)
|
||||||
local params = {
|
local params = {
|
||||||
rewards = rewards,
|
rewards = rewards,
|
||||||
customTitleStr = customTitleStr,
|
customTitleStr = customTitleStr,
|
||||||
@ -69,6 +74,8 @@ function TipsManager:showRewardsTips(rewards, customTitleStr, tarPrefabObj, call
|
|||||||
local tarCornerScreenPos, location = self:getCornerScreenPosition(tarPrefabObj, alignType)
|
local tarCornerScreenPos, location = self:getCornerScreenPosition(tarPrefabObj, alignType)
|
||||||
params.tarCornerScreenPos = tarCornerScreenPos
|
params.tarCornerScreenPos = tarCornerScreenPos
|
||||||
params.location = location
|
params.location = location
|
||||||
|
params.showBlackBg = showBlackBg == nil or showBlackBg
|
||||||
|
params.typeNode = typeNode or TipsManager.REWARDS_TIPS_TYPE.COMMON
|
||||||
end
|
end
|
||||||
UIManager:showUI("app/ui/tips/rewards_tips", params)
|
UIManager:showUI("app/ui/tips/rewards_tips", params)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -5,24 +5,23 @@ end
|
|||||||
|
|
||||||
function DailyChallengeComp:init()
|
function DailyChallengeComp:init()
|
||||||
self.uiMap = self:getBaseObject():genAllChildren()
|
self.uiMap = self:getBaseObject():genAllChildren()
|
||||||
self:ininShow()
|
self:refreshShow()
|
||||||
end
|
end
|
||||||
|
|
||||||
function DailyChallengeComp:ininShow()
|
function DailyChallengeComp:refreshShow()
|
||||||
self:initTxt()
|
self:refreshTxt()
|
||||||
self:initTask()
|
self:refreshTask()
|
||||||
self:initBuff()
|
self:refreshBuff()
|
||||||
self:initBoss()
|
self:refreshBoss()
|
||||||
self:refreshTips()
|
self:refreshCountdown()
|
||||||
self:initShowCountdown()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function DailyChallengeComp:initTxt()
|
function DailyChallengeComp:refreshTxt()
|
||||||
self.uiMap["daily_challenge_comp.title.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE))
|
self.uiMap["daily_challenge_comp.title.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE))
|
||||||
self.uiMap["daily_challenge_comp.record_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.CHAPTER_DESC_1, DataManager.DailyChallengeData:getTotalFightCount()))
|
self.uiMap["daily_challenge_comp.record_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.CHAPTER_DESC_1, DataManager.DailyChallengeData:getTotalFightCount()))
|
||||||
end
|
end
|
||||||
|
|
||||||
function DailyChallengeComp:initTask()
|
function DailyChallengeComp:refreshTask()
|
||||||
if self.tasks == nil or #self.tasks < 3 then
|
if self.tasks == nil or #self.tasks < 3 then
|
||||||
self.tasks = GFunc.getTable()
|
self.tasks = GFunc.getTable()
|
||||||
table.insert(self.tasks, self.uiMap["daily_challenge_comp.challenge.task.icon_task1"])
|
table.insert(self.tasks, self.uiMap["daily_challenge_comp.challenge.task.icon_task1"])
|
||||||
@ -30,6 +29,7 @@ function DailyChallengeComp:initTask()
|
|||||||
table.insert(self.tasks, self.uiMap["daily_challenge_comp.challenge.task.icon_task3"])
|
table.insert(self.tasks, self.uiMap["daily_challenge_comp.challenge.task.icon_task3"])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local tasksData = DataManager.DailyChallengeData:getTasks()
|
||||||
for i = 1, #self.tasks do
|
for i = 1, #self.tasks do
|
||||||
if not DataManager.DailyChallengeData:isTaskFinish(i) then
|
if not DataManager.DailyChallengeData:isTaskFinish(i) then
|
||||||
-- 任务未完成
|
-- 任务未完成
|
||||||
@ -39,81 +39,57 @@ function DailyChallengeComp:initTask()
|
|||||||
self.tasks[i]:setSprite(GConst.ATLAS_PATH.DAILY_CHALLENGE, "daily_task_2")
|
self.tasks[i]:setSprite(GConst.ATLAS_PATH.DAILY_CHALLENGE, "daily_task_2")
|
||||||
end
|
end
|
||||||
self.tasks[i]:addClickListener(function()
|
self.tasks[i]:addClickListener(function()
|
||||||
self:refreshTips(self.tasks[i], 1, 1)-- todo 临时id
|
local rewards = DataManager.DailyChallengeData:getTaskRewards(tasksData[i].task_id)
|
||||||
|
local desc = DataManager.DailyChallengeData:getTaskDesc(tasksData[i].task_id)
|
||||||
|
ModuleManager.TipsManager:showRewardsTips(rewards, desc, self.tasks[i], nil, nil, false, ModuleManager.TipsManager.REWARDS_TIPS_TYPE.TASK)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function DailyChallengeComp:initBuff()
|
function DailyChallengeComp:refreshBuff()
|
||||||
local buffObj = self.uiMap["daily_challenge_comp.challenge.buffs.buff.btn_buff"]
|
local buffObj = self.uiMap["daily_challenge_comp.challenge.buffs.buff.btn_buff"]
|
||||||
|
local buffIds = DataManager.DailyChallengeData:getTodayBuffIds()
|
||||||
buffObj:addClickListener(function()
|
buffObj:addClickListener(function()
|
||||||
self:refreshTips(buffObj, 0, 1)-- todo 临时id
|
ModuleManager.TipsManager:showDescTips(DataManager.DailyChallengeData:getBuffDesc(buffIds[1]), buffObj)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local debuffObj = self.uiMap["daily_challenge_comp.challenge.buffs.debuff.btn_debuff"]
|
local debuffObj = self.uiMap["daily_challenge_comp.challenge.buffs.debuff.btn_debuff"]
|
||||||
debuffObj:addClickListener(function()
|
debuffObj:addClickListener(function()
|
||||||
self:refreshTips(debuffObj, 0, 11)-- todo 临时id
|
ModuleManager.TipsManager:showDescTips(DataManager.DailyChallengeData:getBuffDesc(buffIds[2]), debuffObj)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function DailyChallengeComp:initBoss()
|
function DailyChallengeComp:refreshBoss()
|
||||||
SpineManager:loadHeroAsync(DataManager.DailyChallengeData:getFinalBossId(), self.uiMap["daily_challenge_comp.boss.spine_node"], function(spineObject)
|
local curBossId = DataManager.DailyChallengeData:getFinalBossModelId()
|
||||||
-- todo 有问题
|
if self.bossId == curBossId then
|
||||||
spineObject:setDefaultMix(0)
|
|
||||||
spineObject:playAnimation(GConst.BattleConst.SPINE_ANIMATION_NAME.IDLE, true, false)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 刷新提示(提示对象,提示类型0为buff,1为任务,buffid或者任务id)
|
|
||||||
function DailyChallengeComp:refreshTips(obj, tipsType, id)
|
|
||||||
self.uiMap["daily_challenge_comp.tips"]:setActive(false)
|
|
||||||
self.uiMap["daily_challenge_comp.tips.tips_buff"]:setActive(false)
|
|
||||||
self.uiMap["daily_challenge_comp.tips.tips_task"]:setActive(false)
|
|
||||||
if obj == nil or tipsType == nil or id == nil then
|
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
if self.spineBoss then
|
||||||
local pos = obj:getAnchoredPosition()
|
self.spineBoss:onDestroy()
|
||||||
if tipsType == 0 then
|
self.spineBoss = nil
|
||||||
-- 展示buff提示
|
self.bossId = nil
|
||||||
self.uiMap["daily_challenge_comp.tips"]:setActive(true)
|
|
||||||
self.uiMap["daily_challenge_comp.tips.tips_buff"]:setActive(true)
|
|
||||||
self.uiMap["daily_challenge_comp.tips.tips_buff.buff_tips_tx"]:setText(DataManager.DailyChallengeData:getBuffTips(id))
|
|
||||||
|
|
||||||
self.uiMap["daily_challenge_comp.tips.tips_buff"]:setAnchoredPosition(pos.x, pos.y + 100)
|
|
||||||
|
|
||||||
elseif tipsType == 1 then
|
|
||||||
-- 展示任务提示
|
|
||||||
self.uiMap["daily_challenge_comp.tips"]:setActive(true)
|
|
||||||
self.uiMap["daily_challenge_comp.tips.tips_task"]:setActive(true)
|
|
||||||
self.uiMap["daily_challenge_comp.tips.tips_task.task_tips_tx"]:setText(DataManager.DailyChallengeData:getTaskTips(id))
|
|
||||||
|
|
||||||
if not self.rewardCell then
|
|
||||||
self.rewardCell = CellManager:addCellComp(self.uiMap["daily_challenge_comp.tips.tips_task.reward.reward_cell"], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
|
|
||||||
end
|
end
|
||||||
local reward = DataManager.DailyChallengeData:getTaskReward("todo id")
|
self.bossId = curBossId
|
||||||
if reward and reward[1] then
|
SpineManager:loadHeroAsync(self.bossId, self.uiMap["daily_challenge_comp.boss.spine_node"], function(spineObject)
|
||||||
self.rewardCell:refreshByConfig(reward[1])
|
self.spineBoss = spineObject
|
||||||
end
|
self.spineBoss:setDefaultMix(0)
|
||||||
|
self.spineBoss:playAnimation(GConst.BattleConst.SPINE_ANIMATION_NAME.IDLE, true, false)
|
||||||
self.uiMap["daily_challenge_comp.tips.tips_task"]:setAnchoredPosition(pos.x, pos.y + 100)
|
|
||||||
end
|
|
||||||
|
|
||||||
self.uiMap["daily_challenge_comp.tips.mask"]:addClickListener(function()
|
|
||||||
self.uiMap["daily_challenge_comp.tips"]:setActive(false)
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function DailyChallengeComp:initShowCountdown()
|
function DailyChallengeComp:refreshCountdown()
|
||||||
-- self.sid = self:scheduleGlobal(function()
|
self.countdownTx = self.uiMap["daily_challenge_comp.countdown.time_tx"]
|
||||||
-- self:updateTime()
|
if not self.countdownSid then
|
||||||
-- end, 1)
|
self.countdownSid = self.countdownTx:scheduleGlobal(function()
|
||||||
|
self:updateTime()
|
||||||
|
end, 1)
|
||||||
|
end
|
||||||
self:updateTime()
|
self:updateTime()
|
||||||
end
|
end
|
||||||
|
|
||||||
function DailyChallengeComp:updateTime()
|
function DailyChallengeComp:updateTime()
|
||||||
local remainTime = DataManager.DailyChallengeData:getTodaySurplusTime()
|
local remainTime = DataManager.DailyChallengeData:getTodaySurplusTime()
|
||||||
self.uiMap["daily_challenge_comp.countdown.time_tx"]:setText(GFunc.getTimeStrWithHMS(remainTime))
|
self.countdownTx:setText(GFunc.getTimeStrWithHMS(remainTime))
|
||||||
end
|
end
|
||||||
|
|
||||||
return DailyChallengeComp
|
return DailyChallengeComp
|
||||||
@ -6,20 +6,26 @@ local MODULE_DATA = {
|
|||||||
[1] = {
|
[1] = {
|
||||||
["type"] = GConst.MainCityConst.BOTTOM_MODULE_KEY.DAILY_CHALLENGE,
|
["type"] = GConst.MainCityConst.BOTTOM_MODULE_KEY.DAILY_CHALLENGE,
|
||||||
["title"] = "每日挑战",-- 标题
|
["title"] = "每日挑战",-- 标题
|
||||||
["atlas"] = GConst.ATLAS_PATH.ICON_ITEM,-- 图集路径
|
["atlas"] = GConst.ATLAS_PATH.MAIN,-- 图集路径
|
||||||
["icon"] = "1",-- 图片名
|
["icon"] = "main_dec_1",-- 图片名
|
||||||
["numFunc"] = function()-- 挑战按钮显示数值
|
["numFunc"] = function()-- 挑战按钮显示数值
|
||||||
return DataManager.DailyChallengeData:getChallengeHpCost()
|
return DataManager.DailyChallengeData:getChallengeHpCost()
|
||||||
end,
|
end,
|
||||||
["clickFunc"] = function()-- 点击回调
|
["clickFunc"] = function()-- 点击回调
|
||||||
ModuleManager.DailyChallengeManager:startChallenge()
|
ModuleManager.DailyChallengeManager:startChallenge()
|
||||||
end
|
end,
|
||||||
|
["redDot"] = function()-- 显示红点
|
||||||
|
return DataManager.DailyChallengeData:isMeetChallenge()
|
||||||
|
end,
|
||||||
|
["fightNum"] = function()-- 显示今日剩余次数
|
||||||
|
return DataManager.DailyChallengeData:getTodayRemainLimitCount()
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
[2] = {
|
[2] = {
|
||||||
["type"] = GConst.MainCityConst.BOTTOM_MODULE_KEY.CHAPTER,
|
["type"] = GConst.MainCityConst.BOTTOM_MODULE_KEY.CHAPTER,
|
||||||
["title"] = "主线章节",
|
["title"] = "主线章节",
|
||||||
["atlas"] = GConst.ATLAS_PATH.ICON_ITEM,
|
["atlas"] = GConst.ATLAS_PATH.COMMON,
|
||||||
["icon"] = "2",
|
["icon"] = "common_dec_1",
|
||||||
["numFunc"] = function()
|
["numFunc"] = function()
|
||||||
return DataManager.ChapterData:getFightCost()
|
return DataManager.ChapterData:getFightCost()
|
||||||
end,
|
end,
|
||||||
@ -94,40 +100,59 @@ function MainComp:refreshFightBtn()
|
|||||||
end
|
end
|
||||||
|
|
||||||
self.uiMap["main_comp.fight_btn"]:addClickListener(module["clickFunc"])
|
self.uiMap["main_comp.fight_btn"]:addClickListener(module["clickFunc"])
|
||||||
|
|
||||||
|
if module["fightNum"] ~= nil then
|
||||||
|
self.uiMap["main_comp.fight_btn.num_tx"]:setActive(true)
|
||||||
|
self.uiMap["main_comp.fight_btn.num_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.TODAY_REMAIN_TIMES, module["fightNum"]()))
|
||||||
|
else
|
||||||
|
self.uiMap["main_comp.fight_btn.num_tx"]:setActive(false)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function MainComp:refreshLeftBtn()
|
function MainComp:refreshLeftBtn()
|
||||||
local module = MODULE_DATA[self:getCurLeftModuleIdx()]
|
local module = MODULE_DATA[self:getCurLeftModuleIdx()]
|
||||||
|
local leftBtn = self.uiMap["main_comp.left_btn"]
|
||||||
if module == nil then
|
if module == nil then
|
||||||
self.uiMap["main_comp.left_btn"]:setActive(false)
|
leftBtn:setActive(false)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
self.uiMap["main_comp.left_btn"]:setActive(true)
|
leftBtn:setActive(true)
|
||||||
self.uiMap["main_comp.left_btn.desc"]:setText(module["title"])
|
self.uiMap["main_comp.left_btn.desc"]:setText(module["title"])
|
||||||
self.uiMap["main_comp.left_btn.icon"]:setSprite(module["atlas"],module["icon"])
|
self.uiMap["main_comp.left_btn.icon"]:setSprite(module["atlas"],module["icon"])
|
||||||
self.uiMap["main_comp.left_btn"]:addClickListener(function()
|
leftBtn:addClickListener(function()
|
||||||
self.curModuleType = module["type"]
|
self.curModuleType = module["type"]
|
||||||
self:refreshBtns()
|
self:refreshBtns()
|
||||||
self:refreshModuleComp()
|
self:refreshModuleComp()
|
||||||
end)
|
end)
|
||||||
|
if module["redDot"] ~= nil and module["redDot"]() then
|
||||||
|
leftBtn:addRedPoint(65, 35, 0.6)
|
||||||
|
else
|
||||||
|
leftBtn:removeRedPoint()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function MainComp:refreshRightBtn()
|
function MainComp:refreshRightBtn()
|
||||||
local module = MODULE_DATA[self:getCurRightModuleIdx()]
|
local module = MODULE_DATA[self:getCurRightModuleIdx()]
|
||||||
|
local rightBtn = self.uiMap["main_comp.right_btn"]
|
||||||
if module == nil then
|
if module == nil then
|
||||||
self.uiMap["main_comp.right_btn"]:setActive(false)
|
rightBtn:setActive(false)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
self.uiMap["main_comp.right_btn"]:setActive(true)
|
rightBtn:setActive(true)
|
||||||
self.uiMap["main_comp.right_btn.desc"]:setText(module["title"])
|
self.uiMap["main_comp.right_btn.desc"]:setText(module["title"])
|
||||||
self.uiMap["main_comp.right_btn.icon"]:setSprite(module["atlas"],module["icon"])
|
self.uiMap["main_comp.right_btn.icon"]:setSprite(module["atlas"],module["icon"])
|
||||||
self.uiMap["main_comp.right_btn"]:addClickListener(function()
|
rightBtn:addClickListener(function()
|
||||||
self.curModuleType = module["type"]
|
self.curModuleType = module["type"]
|
||||||
self:refreshBtns()
|
self:refreshBtns()
|
||||||
self:refreshModuleComp()
|
self:refreshModuleComp()
|
||||||
end)
|
end)
|
||||||
|
if module["redDot"] ~= nil and module["redDot"]() then
|
||||||
|
rightBtn:addRedPoint(-65, 35, 0.6)
|
||||||
|
else
|
||||||
|
rightBtn:removeRedPoint()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function MainComp:getCurLeftModuleIdx()
|
function MainComp:getCurLeftModuleIdx()
|
||||||
@ -172,6 +197,10 @@ function MainComp:refreshChapter(force)
|
|||||||
self.chapterComp:refreshChapter(force)
|
self.chapterComp:refreshChapter(force)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function MainComp:refreshChallenge()
|
||||||
|
self.dailyChallengeComp:refreshShow()
|
||||||
|
end
|
||||||
|
|
||||||
function MainComp:refreshStageFormaion()
|
function MainComp:refreshStageFormaion()
|
||||||
local formation = DataManager.FormationData:getStageFormation()
|
local formation = DataManager.FormationData:getStageFormation()
|
||||||
for i, heroCell in ipairs(self.heroCells) do
|
for i, heroCell in ipairs(self.heroCells) do
|
||||||
|
|||||||
@ -193,6 +193,14 @@ function MainCityUI:_bind()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
self:bind(DataManager.DailyChallengeData, "isDirty", function()
|
||||||
|
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN then
|
||||||
|
if self.subComps[self.selectedIndex] then
|
||||||
|
self.subComps[self.selectedIndex]:refreshChallenge()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function MainCityUI:initBottomUI()
|
function MainCityUI:initBottomUI()
|
||||||
|
|||||||
@ -15,6 +15,12 @@ end
|
|||||||
function RewardsTips:init()
|
function RewardsTips:init()
|
||||||
local uiMap = self.root:genAllChildren()
|
local uiMap = self.root:genAllChildren()
|
||||||
self.bg = uiMap["rewards_tips.bg"]
|
self.bg = uiMap["rewards_tips.bg"]
|
||||||
|
self.bgBlack = uiMap["rewards_tips.bg_black"]
|
||||||
|
|
||||||
|
uiMap["rewards_tips.bg.reward_node"]:setActive(false)
|
||||||
|
uiMap["rewards_tips.bg.reward2_node"]:setActive(false)
|
||||||
|
if self.params.typeNode == ModuleManager.TipsManager.REWARDS_TIPS_TYPE.COMMON then
|
||||||
|
self.tipsNode = uiMap["rewards_tips.bg.reward_node"]
|
||||||
self.descTx = uiMap["rewards_tips.reward_node.desc"]
|
self.descTx = uiMap["rewards_tips.reward_node.desc"]
|
||||||
self.rewardNode = uiMap["rewards_tips.reward_node.reward_layout"]
|
self.rewardNode = uiMap["rewards_tips.reward_node.reward_layout"]
|
||||||
if not self.rewardCells then
|
if not self.rewardCells then
|
||||||
@ -23,6 +29,17 @@ function RewardsTips:init()
|
|||||||
self.rewardCells[i] = CellManager:addCellComp(uiMap["rewards_tips.bg.reward_node.reward_layout.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
|
self.rewardCells[i] = CellManager:addCellComp(uiMap["rewards_tips.bg.reward_node.reward_layout.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
elseif self.params.typeNode == ModuleManager.TipsManager.REWARDS_TIPS_TYPE.TASK then
|
||||||
|
self.tipsNode = uiMap["rewards_tips.bg.reward2_node"]
|
||||||
|
self.descTx = uiMap["rewards_tips.bg.reward2_node.desc"]
|
||||||
|
self.rewardNode = uiMap["rewards_tips.bg.reward2_node.reward_layout"]
|
||||||
|
if not self.rewardCells then
|
||||||
|
self.rewardCells = {}
|
||||||
|
for i = 1, 3 do
|
||||||
|
self.rewardCells[i] = CellManager:addCellComp(uiMap["rewards_tips.bg.reward2_node.reward_layout.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function RewardsTips:onLoadRootComplete()
|
function RewardsTips:onLoadRootComplete()
|
||||||
@ -39,6 +56,8 @@ function RewardsTips:onRefresh()
|
|||||||
self:closeUI()
|
self:closeUI()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
self.tipsNode:setActive(true)
|
||||||
|
self.bgBlack:setActive(self.params.showBlackBg)
|
||||||
self.descTx:setText(self.params.customTitleStr or I18N:getGlobalText(I18N.GlobalConst.REWARD_PREVIEW_DESC))
|
self.descTx:setText(self.params.customTitleStr or I18N:getGlobalText(I18N.GlobalConst.REWARD_PREVIEW_DESC))
|
||||||
if self.params.rewards then
|
if self.params.rewards then
|
||||||
for i, cell in ipairs(self.rewardCells) do
|
for i, cell in ipairs(self.rewardCells) do
|
||||||
|
|||||||
@ -5,6 +5,10 @@ local FIXED_HERO_TASK = {[2] = true, [7] = true}
|
|||||||
local MATCH_TYPE_TASK = {[5] = true, [8] = true}
|
local MATCH_TYPE_TASK = {[5] = true, [8] = true}
|
||||||
local NEED_PROGRESS_TASK = {[3] = true, [4] = true, [5] = true, [7] = true, [8] = true}
|
local NEED_PROGRESS_TASK = {[3] = true, [4] = true, [5] = true, [7] = true, [8] = true}
|
||||||
|
|
||||||
|
function DailyChallengeData:ctor()
|
||||||
|
self.data.isDirty = false
|
||||||
|
end
|
||||||
|
|
||||||
function DailyChallengeData:init(data)
|
function DailyChallengeData:init(data)
|
||||||
data = data or {}
|
data = data or {}
|
||||||
data = { -- 临时数据
|
data = { -- 临时数据
|
||||||
@ -43,12 +47,10 @@ function DailyChallengeData:init(data)
|
|||||||
self.buffIds = data.buff_id or {}
|
self.buffIds = data.buff_id or {}
|
||||||
self.totalFightCount = data.totalFightCount or 0
|
self.totalFightCount = data.totalFightCount or 0
|
||||||
self.todayFightCount = data.today_challenge_count or 0
|
self.todayFightCount = data.today_challenge_count or 0
|
||||||
|
self:setDirty()
|
||||||
|
|
||||||
if not data then
|
Logger.logHighlight("每日挑战 更新数据...")
|
||||||
return
|
Logger.printTable(data)
|
||||||
end
|
|
||||||
|
|
||||||
self.taskIds = {1,2,3}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function DailyChallengeData:clear()
|
function DailyChallengeData:clear()
|
||||||
@ -58,6 +60,11 @@ function DailyChallengeData:isOpen()
|
|||||||
return ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.DAILY_CHALLENGE, true)
|
return ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.DAILY_CHALLENGE, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function DailyChallengeData:setDirty()
|
||||||
|
self.data.isDirty = not self.data.isDirty
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- 是否满足挑战条件
|
-- 是否满足挑战条件
|
||||||
function DailyChallengeData:isMeetChallenge()
|
function DailyChallengeData:isMeetChallenge()
|
||||||
return self:isOpen() and self:isEnoughChallengeTime() and self:isEnoughHp()
|
return self:isOpen() and self:isEnoughChallengeTime() and self:isEnoughHp()
|
||||||
@ -92,22 +99,8 @@ function DailyChallengeData:getChallengeHpCost()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- 获取今日挑战场景配置
|
-- 获取今日挑战场景配置
|
||||||
function DailyChallengeData:getTodayConfig()
|
function DailyChallengeData:getMapConfig()
|
||||||
-- body
|
return ConfigManager:getConfig("chapter_daily_challenge")[self.fixedChapterId]
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取今日挑战任务id列表
|
|
||||||
function DailyChallengeData:getTaskIds()
|
|
||||||
return self.taskIds
|
|
||||||
end
|
|
||||||
|
|
||||||
-- 获取任务奖励
|
|
||||||
function DailyChallengeData:getTaskReward(id)
|
|
||||||
local task = self.taskIds[id]
|
|
||||||
if task == nil then
|
|
||||||
return GConst.EMPTY_STRING
|
|
||||||
end
|
|
||||||
return self:getTaskCfg()[task.taskId].reward
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function DailyChallengeData:getBuffTips(id)
|
function DailyChallengeData:getBuffTips(id)
|
||||||
@ -131,9 +124,13 @@ function DailyChallengeData:getTodayPassNum()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- 获取今日增益、负面buff
|
-- 获取今日增益、负面buff
|
||||||
function DailyChallengeData:getTodayBuff()
|
function DailyChallengeData:getTodayBuffIds()
|
||||||
return self.buffIds
|
return self.buffIds
|
||||||
-- return ConfigManager:getConfig("buff_daily_challenge")[self.buffIds[1]], ConfigManager:getConfig("buff_daily_challenge")[self.buffIds[2]]
|
end
|
||||||
|
|
||||||
|
-- 获取buff描述
|
||||||
|
function DailyChallengeData:getBuffDesc(buffId)
|
||||||
|
return I18N:getText("buff_daily_challenge", buffId, "desc")
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取今日剩余时间
|
-- 获取今日剩余时间
|
||||||
@ -145,9 +142,10 @@ function DailyChallengeData:getTodaySurplusTime()
|
|||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 获取最终boss id
|
-- 获取最终boss 模型 id
|
||||||
function DailyChallengeData:getFinalBossId()
|
function DailyChallengeData:getFinalBossModelId()
|
||||||
return "m10001"
|
local mapCfg = self:getMapConfig()
|
||||||
|
return ConfigManager:getConfig("monster")[mapCfg.monster[#mapCfg.monster]].model_id
|
||||||
end
|
end
|
||||||
|
|
||||||
-- 任务是否完成
|
-- 任务是否完成
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user