每日挑战
This commit is contained in:
parent
e5e23cc06c
commit
e1d389b02d
@ -1,11 +1,6 @@
|
||||
local daily_challenge_level = {
|
||||
[1]={
|
||||
["max_chapter"]=11,
|
||||
["round_map"]={
|
||||
1,
|
||||
2,
|
||||
3
|
||||
},
|
||||
["wave_reward"]={
|
||||
{
|
||||
["type"]=1,
|
||||
@ -95,13 +90,6 @@ local daily_challenge_level = {
|
||||
},
|
||||
[2]={
|
||||
["max_chapter"]=19,
|
||||
["round_map"]={
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5
|
||||
},
|
||||
["wave_reward"]={
|
||||
{
|
||||
["type"]=1,
|
||||
@ -191,15 +179,6 @@ local daily_challenge_level = {
|
||||
},
|
||||
[3]={
|
||||
["max_chapter"]=27,
|
||||
["round_map"]={
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7
|
||||
},
|
||||
["wave_reward"]={
|
||||
{
|
||||
["type"]=1,
|
||||
@ -289,17 +268,6 @@ local daily_challenge_level = {
|
||||
},
|
||||
[4]={
|
||||
["max_chapter"]=37,
|
||||
["round_map"]={
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9
|
||||
},
|
||||
["wave_reward"]={
|
||||
{
|
||||
["type"]=1,
|
||||
@ -389,19 +357,6 @@ local daily_challenge_level = {
|
||||
},
|
||||
[5]={
|
||||
["max_chapter"]=47,
|
||||
["round_map"]={
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11
|
||||
},
|
||||
["wave_reward"]={
|
||||
{
|
||||
["type"]=1,
|
||||
@ -491,21 +446,6 @@ local daily_challenge_level = {
|
||||
},
|
||||
[6]={
|
||||
["max_chapter"]=62,
|
||||
["round_map"]={
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13
|
||||
},
|
||||
["wave_reward"]={
|
||||
{
|
||||
["type"]=1,
|
||||
@ -595,23 +535,6 @@ local daily_challenge_level = {
|
||||
},
|
||||
[7]={
|
||||
["max_chapter"]=77,
|
||||
["round_map"]={
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4,
|
||||
5,
|
||||
6,
|
||||
7,
|
||||
8,
|
||||
9,
|
||||
10,
|
||||
11,
|
||||
12,
|
||||
13,
|
||||
14,
|
||||
15
|
||||
},
|
||||
["wave_reward"]={
|
||||
{
|
||||
["type"]=1,
|
||||
|
||||
@ -4354,7 +4354,7 @@ local hero = {
|
||||
1100,
|
||||
1200
|
||||
},
|
||||
["model_id"]="p23001",
|
||||
["model_id"]="p25001",
|
||||
["icon"]="25001",
|
||||
["item_id"]=25001,
|
||||
["level_id"]=10,
|
||||
|
||||
@ -681,6 +681,13 @@ local LocalizationGlobalConst =
|
||||
HERO_DESC_22 = "HERO_DESC_22",
|
||||
HERO_DESC_23 = "HERO_DESC_23",
|
||||
BAG_DESC_1 = "BAG_DESC_1",
|
||||
DAILY_CHALLENGE_DESC_2 = "DAILY_CHALLENGE_DESC_2",
|
||||
DAILY_CHALLENGE_DESC_3 = "DAILY_CHALLENGE_DESC_3",
|
||||
DAILY_CHALLENGE_DESC_4 = "DAILY_CHALLENGE_DESC_4",
|
||||
DAILY_CHALLENGE_DESC_5 = "DAILY_CHALLENGE_DESC_5",
|
||||
DAILY_CHALLENGE_DESC_6 = "DAILY_CHALLENGE_DESC_6",
|
||||
DAILY_CHALLENGE_DESC_7 = "DAILY_CHALLENGE_DESC_7",
|
||||
DAILY_CHALLENGE_DESC_8 = "DAILY_CHALLENGE_DESC_8",
|
||||
}
|
||||
|
||||
return LocalizationGlobalConst
|
||||
@ -2361,15 +2361,11 @@ local skill = {
|
||||
},
|
||||
["shake_time"]=100,
|
||||
["shake_type"]=1,
|
||||
["sound_hit"]={
|
||||
1000001
|
||||
},
|
||||
["name_act"]="attack01",
|
||||
["name_hit"]={
|
||||
"suffer01"
|
||||
},
|
||||
["fx_self"]=300018,
|
||||
["fx_self_mirror"]=400018
|
||||
["fx_self_mirror"]=100000
|
||||
},
|
||||
[2500111]={
|
||||
["position"]=2,
|
||||
@ -2390,15 +2386,11 @@ local skill = {
|
||||
},
|
||||
["shake_time"]=100,
|
||||
["shake_type"]=1,
|
||||
["sound_hit"]={
|
||||
1000002
|
||||
},
|
||||
["name_act"]="attack02",
|
||||
["name_hit"]={
|
||||
"suffer02"
|
||||
},
|
||||
["fx_self"]=300019,
|
||||
["fx_self_mirror"]=400019
|
||||
["fx_self_mirror"]=100000
|
||||
},
|
||||
[2500112]={
|
||||
["position"]=2,
|
||||
@ -2419,15 +2411,11 @@ local skill = {
|
||||
},
|
||||
["shake_time"]=100,
|
||||
["shake_type"]=1,
|
||||
["sound_hit"]={
|
||||
1000003
|
||||
},
|
||||
["name_act"]="attack03",
|
||||
["name_hit"]={
|
||||
"suffer01"
|
||||
},
|
||||
["fx_self"]=300020,
|
||||
["fx_self_mirror"]=400020
|
||||
["fx_self_mirror"]=100000
|
||||
},
|
||||
[2500113]={
|
||||
["position"]=2,
|
||||
@ -2448,15 +2436,11 @@ local skill = {
|
||||
},
|
||||
["shake_time"]=100,
|
||||
["shake_type"]=1,
|
||||
["sound_hit"]={
|
||||
1000004
|
||||
},
|
||||
["name_act"]="attack04",
|
||||
["name_hit"]={
|
||||
"suffer02"
|
||||
},
|
||||
["fx_self"]=300021,
|
||||
["fx_self_mirror"]=400021
|
||||
["fx_self_mirror"]=100000
|
||||
},
|
||||
[2500120]={
|
||||
["energy"]=10,
|
||||
@ -2489,6 +2473,12 @@ local skill = {
|
||||
["ratio"]=10000,
|
||||
["round"]=0
|
||||
},
|
||||
{
|
||||
["type"]="hurt_yellow",
|
||||
["num"]=20000,
|
||||
["ratio"]=10000,
|
||||
["round"]=0
|
||||
},
|
||||
{
|
||||
["type"]="hurt_yellow",
|
||||
["num"]=20000,
|
||||
@ -2501,7 +2491,8 @@ local skill = {
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
4
|
||||
4,
|
||||
5
|
||||
},
|
||||
["skill_position"]={
|
||||
1,
|
||||
@ -2509,22 +2500,21 @@ local skill = {
|
||||
},
|
||||
["shake_time"]=200,
|
||||
["shake_type"]=5,
|
||||
["sound"]=12001200,
|
||||
["sound_delay"]=0.0,
|
||||
["name_act"]="skill01",
|
||||
["name_hit"]={
|
||||
"suffer01",
|
||||
"suffer01",
|
||||
"suffer02",
|
||||
"suffer03",
|
||||
"suffer03",
|
||||
"suffer03"
|
||||
},
|
||||
["fx_self"]=300022,
|
||||
["bullet_time"]={
|
||||
1167,
|
||||
3000,
|
||||
300
|
||||
},
|
||||
["fx_self_mirror"]=400022
|
||||
["fx_self_mirror"]=100000
|
||||
},
|
||||
[2500121]={
|
||||
["position"]=2,
|
||||
|
||||
@ -681,6 +681,13 @@ local localization_global =
|
||||
["HERO_DESC_22"] = "去升星",
|
||||
["HERO_DESC_23"] = "技能等级:{0}",
|
||||
["BAG_DESC_1"] = "背包",
|
||||
["DAILY_CHALLENGE_DESC_2"] = "提升难度",
|
||||
["DAILY_CHALLENGE_DESC_3"] = "通关主线{0}-{1}({2})",
|
||||
["DAILY_CHALLENGE_DESC_4"] = "难度提升将提升未领取的任务奖励和通关奖励,是否确定?",
|
||||
["DAILY_CHALLENGE_DESC_5"] = "降低难度后,未领取的任务奖励和通关奖励将降低,是否确定?",
|
||||
["DAILY_CHALLENGE_DESC_6"] = "请先领取已达成的任务奖励",
|
||||
["DAILY_CHALLENGE_DESC_7"] = "降低难度",
|
||||
["DAILY_CHALLENGE_DESC_8"] = "已达成",
|
||||
}
|
||||
|
||||
return localization_global
|
||||
@ -330,11 +330,11 @@ GConst.MESSAGE_BOX_SHOW_TODAY = {
|
||||
GConst.QUALITY_TYPE =
|
||||
{
|
||||
[1] = "#D1D1D1",
|
||||
[2] = "#A3FF94",
|
||||
[3] = "#4DFFF5",
|
||||
[4] = "#FA79FF",
|
||||
[5] = "#F3A345",
|
||||
[6] = "#F34545",
|
||||
[2] = "#5BFF5F",
|
||||
[3] = "#4ADBFF",
|
||||
[4] = "#DF70FF",
|
||||
[5] = "#FF9B59",
|
||||
[6] = "#FF5D5D",
|
||||
}
|
||||
|
||||
GConst.QUALITY_COLOR = {
|
||||
|
||||
@ -12,7 +12,8 @@ function BattleControllerDailyChallenge:getChapterConfig()
|
||||
end
|
||||
|
||||
function BattleControllerDailyChallenge:getChapterId()
|
||||
return DataManager.DailyChallengeData:getChapterDailyId()
|
||||
-- return DataManager.DailyChallengeData:getChapterDailyId()
|
||||
return DataManager.DailyChallengeData:getDiffLv()
|
||||
end
|
||||
|
||||
function BattleControllerDailyChallenge:getBuffs()
|
||||
|
||||
@ -234,4 +234,18 @@ function DailyChallengeManager:getCurTaskProgress(battleController)
|
||||
return taskCurProgress
|
||||
end
|
||||
|
||||
-- 修改难度
|
||||
function DailyChallengeManager:onChapterDailyChallengeLevelReq(level)
|
||||
local parmas = {
|
||||
level = level,
|
||||
}
|
||||
self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterDailyChallengeLevelReq, parmas, {}, self.onChapterDailyChallengeLevelRsp)
|
||||
end
|
||||
|
||||
function DailyChallengeManager:onChapterDailyChallengeLevelRsp(result)
|
||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||
DataManager.DailyChallengeData:setDiffLv(result.reqData.level)
|
||||
end
|
||||
end
|
||||
|
||||
return DailyChallengeManager
|
||||
@ -113,6 +113,8 @@ local ProtoMsgType = {
|
||||
[2017338205] = "BossRushSettlementRsp",
|
||||
[2018011867] = "TournWaveRankReq",
|
||||
[2018013700] = "TournWaveRankRsp",
|
||||
[2055679641] = "ChapterDailyChallengeLevelReq",
|
||||
[2055681474] = "ChapterDailyChallengeLevelRsp",
|
||||
[2060508030] = "ChangeAvatarFrameReq",
|
||||
[2060509863] = "ChangeAvatarFrameRsp",
|
||||
[2095612947] = "ChangeNameReq",
|
||||
@ -412,6 +414,8 @@ local ProtoMsgType = {
|
||||
BossRushSettlementRsp = 2017338205,
|
||||
TournWaveRankReq = 2018011867,
|
||||
TournWaveRankRsp = 2018013700,
|
||||
ChapterDailyChallengeLevelReq = 2055679641,
|
||||
ChapterDailyChallengeLevelRsp = 2055681474,
|
||||
ChangeAvatarFrameReq = 2060508030,
|
||||
ChangeAvatarFrameRsp = 2060509863,
|
||||
ChangeNameReq = 2095612947,
|
||||
@ -711,6 +715,8 @@ local ProtoMsgType = {
|
||||
BossRushSettlementRsp = "BossRushSettlementRsp",
|
||||
TournWaveRankReq = "TournWaveRankReq",
|
||||
TournWaveRankRsp = "TournWaveRankRsp",
|
||||
ChapterDailyChallengeLevelReq = "ChapterDailyChallengeLevelReq",
|
||||
ChapterDailyChallengeLevelRsp = "ChapterDailyChallengeLevelRsp",
|
||||
ChangeAvatarFrameReq = "ChangeAvatarFrameReq",
|
||||
ChangeAvatarFrameRsp = "ChangeAvatarFrameRsp",
|
||||
ChangeNameReq = "ChangeNameReq",
|
||||
|
||||
@ -32,6 +32,8 @@ function DailyChallengeUI:onLoadRootComplete()
|
||||
end)
|
||||
uiMap["daily_challenge_ui.title.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE))
|
||||
uiMap["daily_challenge_ui.record_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.CHAPTER_DESC_1, DataManager.DailyChallengeData:getMaxWave()))
|
||||
uiMap["daily_challenge_ui.up_diff_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_2))
|
||||
uiMap["daily_challenge_ui.down_diff_btn.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_7))
|
||||
|
||||
self.tasks = GFunc.getTable()
|
||||
table.insert(self.tasks, uiMap["daily_challenge_ui.task.icon_task1"])
|
||||
@ -57,9 +59,60 @@ function DailyChallengeUI:onLoadRootComplete()
|
||||
self.countTxNum = uiMap["daily_challenge_ui.fight_btn.tx_count"]
|
||||
-- 按钮文本
|
||||
self.txFight = uiMap["daily_challenge_ui.fight_btn.tx_desc"]
|
||||
|
||||
self.upDiffBtn = uiMap["daily_challenge_ui.up_diff_btn"]
|
||||
self.upDiffBtnDescTx = uiMap["daily_challenge_ui.up_diff_btn.desc_tx"]
|
||||
self.downDiffBtn = uiMap["daily_challenge_ui.down_diff_btn"]
|
||||
self.fightBtn:addClickListener(function ()
|
||||
ModuleManager.DailyChallengeManager:startChallenge()
|
||||
end)
|
||||
self.upDiffBtn:addClickListener(function ()
|
||||
if DataManager.DailyChallengeData:canGetReward() then
|
||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_6))
|
||||
return
|
||||
end
|
||||
local diffChapter = DataManager.DailyChallengeData:getDiffLv()
|
||||
local maxChapter = DataManager.DailyChallengeData:getMaxDiffLv()
|
||||
if diffChapter == maxChapter then
|
||||
return
|
||||
else
|
||||
local cfg = DataManager.DailyChallengeData:getDifficultyCfg(diffChapter + 1)
|
||||
local chapterId = DataManager.ChapterData:getMaxChapterId()
|
||||
if cfg.max_chapter <= chapterId then
|
||||
local params = {
|
||||
content = I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_4),
|
||||
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL,
|
||||
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
||||
cancelText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_CANCEL),
|
||||
okFunc = function()
|
||||
ModuleManager.DailyChallengeManager:onChapterDailyChallengeLevelReq(diffChapter + 1)
|
||||
end,
|
||||
}
|
||||
GFunc.showMessageBox(params)
|
||||
end
|
||||
end
|
||||
end)
|
||||
self.downDiffBtn:addClickListener(function ()
|
||||
if DataManager.DailyChallengeData:canGetReward() then
|
||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_6))
|
||||
return
|
||||
end
|
||||
local diffChapter = DataManager.DailyChallengeData:getDiffLv()
|
||||
if diffChapter == 1 then
|
||||
return
|
||||
else
|
||||
local params = {
|
||||
content = I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_5),
|
||||
boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL,
|
||||
okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK),
|
||||
cancelText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_CANCEL),
|
||||
okFunc = function()
|
||||
ModuleManager.DailyChallengeManager:onChapterDailyChallengeLevelReq(diffChapter - 1)
|
||||
end,
|
||||
}
|
||||
GFunc.showMessageBox(params)
|
||||
end
|
||||
end)
|
||||
|
||||
self:bind(DataManager.DailyChallengeData, "isDirty", function()
|
||||
self:onRefresh()
|
||||
@ -78,6 +131,7 @@ function DailyChallengeUI:onRefresh()
|
||||
self:refreshBoss()
|
||||
self:updateTime()
|
||||
self:refreshFightBtn()
|
||||
self:refreshDiffBtn()
|
||||
|
||||
if DataManager.DailyChallengeData:getIsPopTask() then
|
||||
ModuleManager.DailyChallengeManager:showBattleTaskUI()
|
||||
@ -180,4 +234,26 @@ function DailyChallengeUI:refreshFightBtn()
|
||||
end
|
||||
end
|
||||
|
||||
function DailyChallengeUI:refreshDiffBtn()
|
||||
local diffChapter = DataManager.DailyChallengeData:getDiffLv()
|
||||
local maxChapter = DataManager.DailyChallengeData:getMaxDiffLv()
|
||||
if diffChapter == maxChapter then
|
||||
self.upDiffBtn:setActive(false)
|
||||
else
|
||||
self.upDiffBtn:setActive(true)
|
||||
local cfg = DataManager.DailyChallengeData:getDifficultyCfg(diffChapter + 1)
|
||||
local chapterId = DataManager.ChapterData:getMaxChapterId()
|
||||
local chapterPage = DataManager.ChapterData:getChapterPage(diffChapter + 1)
|
||||
local chapterStage = DataManager.ChapterData:getChapterStage(diffChapter + 1)
|
||||
local str
|
||||
if cfg.max_chapter <= chapterId then
|
||||
str = I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_3, chapterPage, chapterStage, "<color=#5BFF5F>" .. I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_8) .. "</color>")
|
||||
else
|
||||
str = I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_3, chapterPage, chapterStage, "<color=#FF5D5D>" .. I18N:getGlobalText(I18N.GlobalConst.CHAPTER_WAVE_REAWRD_1) .. "</color>")
|
||||
end
|
||||
self.upDiffBtnDescTx:setText(str)
|
||||
end
|
||||
self.downDiffBtn:setActive(diffChapter > 1)
|
||||
end
|
||||
|
||||
return DailyChallengeUI
|
||||
@ -10,6 +10,7 @@ function ArenaData:clear()
|
||||
self.lastArenaGiftId = nil
|
||||
self.curArenaGiftId = nil
|
||||
self.giftExpireAt = nil
|
||||
self.inited = nil
|
||||
end
|
||||
|
||||
function ArenaData:init(data)
|
||||
@ -39,6 +40,8 @@ function ArenaData:init(data)
|
||||
DataManager.FormationData:initArena(data.attack_array_heroes, data.defend_array_heroes)
|
||||
DataManager.PlayerData:initArena(data.today_ticket_buy_count, data.today_ticket_ad_count)
|
||||
|
||||
self.inited = true
|
||||
|
||||
-- 未找到相应赛季数据
|
||||
if not self:hasServerData() then
|
||||
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_30))
|
||||
@ -461,6 +464,9 @@ end
|
||||
|
||||
-- 是否有入口红点
|
||||
function ArenaData:hasEntranceRedDot()
|
||||
if not self.inited then
|
||||
return false
|
||||
end
|
||||
if not self:isOpen() then
|
||||
return false
|
||||
end
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
local DailyChallengeData = class("DailyChallengeData", BaseData)
|
||||
local TASK_CFG = ConfigManager:getConfig("task_daily_challenge")
|
||||
local CHAPTER_DAILY_CHALLENGE_CFG = ConfigManager:getConfig("chapter_daily_challenge")
|
||||
local PER_TASK = {[6] = true}
|
||||
local FIXED_HERO_TASK = {}
|
||||
local MATCH_TYPE_TASK = {[4] = true, [6] = true}
|
||||
@ -10,80 +11,81 @@ function DailyChallengeData:ctor()
|
||||
end
|
||||
|
||||
function DailyChallengeData:init(data)
|
||||
if EDITOR_MODE then
|
||||
Logger.logHighlight("每日挑战 更新数据...")
|
||||
Logger.printTable(data)
|
||||
end
|
||||
data = data or GConst.EMPTY_TABLE
|
||||
self.maxWave = data.max_wave or 0
|
||||
self.fixedChapterId = data.today_fixed_chapter_id or 1
|
||||
self.chapterDailyId = data.rand_chapter_daily_id or 1
|
||||
self.tasks = data.tasks or GConst.EMPTY_TABLE
|
||||
self.buffIds = data.buff_id or GConst.EMPTY_TABLE
|
||||
self.totalFightCount = data.total_challenge_count or 0
|
||||
self.todayFightCount = data.today_challenge_count or 0
|
||||
self.initDay = Time:getBeginningOfServerToday()
|
||||
self.popTaskTime = LocalData:getChallengeTaskPopTime()
|
||||
self:setDirty()
|
||||
if EDITOR_MODE then
|
||||
Logger.logHighlight("每日挑战 更新数据...")
|
||||
Logger.printTable(data)
|
||||
end
|
||||
data = data or GConst.EMPTY_TABLE
|
||||
self.maxWave = data.max_wave or 0
|
||||
self.fixedChapterId = data.today_fixed_chapter_id or 1
|
||||
self.chapterDailyId = data.rand_chapter_daily_id or 1
|
||||
self.tasks = data.tasks or GConst.EMPTY_TABLE
|
||||
self.buffIds = data.buff_id or GConst.EMPTY_TABLE
|
||||
self.totalFightCount = data.total_challenge_count or 0
|
||||
self.todayFightCount = data.today_challenge_count or 0
|
||||
self.initDay = Time:getBeginningOfServerToday()
|
||||
self.popTaskTime = LocalData:getChallengeTaskPopTime()
|
||||
self.diffLv = data.level or 1
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
function DailyChallengeData:onGetedTaskReward(idx)
|
||||
if self.tasks[idx] then
|
||||
self.tasks[idx].claimed = true
|
||||
self:setDirty()
|
||||
end
|
||||
if self.tasks[idx] then
|
||||
self.tasks[idx].claimed = true
|
||||
self:setDirty()
|
||||
end
|
||||
end
|
||||
|
||||
function DailyChallengeData:clear()
|
||||
end
|
||||
|
||||
function DailyChallengeData:isOpen()
|
||||
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.DAILY_CHALLENGE, true) then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.DAILY_CHALLENGE, true) then
|
||||
return false
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
function DailyChallengeData:setDirty()
|
||||
self.data.isDirty = not self.data.isDirty
|
||||
self.data.isDirty = not self.data.isDirty
|
||||
end
|
||||
|
||||
-- 是否满足挑战条件
|
||||
function DailyChallengeData:isMeetChallenge()
|
||||
return self:isOpen() and self:isEnoughChallengeTime() and self:isEnoughHp()
|
||||
return self:isOpen() and self:isEnoughChallengeTime() and self:isEnoughHp()
|
||||
end
|
||||
|
||||
-- 次数是否足够
|
||||
function DailyChallengeData:isEnoughChallengeTime()
|
||||
return self:getTodayRemainLimitCount() > 0
|
||||
return self:getTodayRemainLimitCount() > 0
|
||||
end
|
||||
|
||||
-- 获取挑战次数消耗
|
||||
function DailyChallengeData:getChallengeTimeCost()
|
||||
return GFunc.getConstIntValue("daily_challenge_limit")
|
||||
return GFunc.getConstIntValue("daily_challenge_limit")
|
||||
end
|
||||
|
||||
-- 体力是否足够
|
||||
function DailyChallengeData:isEnoughHp()
|
||||
local const = self:getChallengeHpCost()
|
||||
local constNum = nil
|
||||
if const then
|
||||
constNum = GFunc.getRewardNum(const)
|
||||
else
|
||||
constNum = 0
|
||||
end
|
||||
return constNum <= DataManager.BagData.ItemData:getVit()
|
||||
local const = self:getChallengeHpCost()
|
||||
local constNum = nil
|
||||
if const then
|
||||
constNum = GFunc.getRewardNum(const)
|
||||
else
|
||||
constNum = 0
|
||||
end
|
||||
return constNum <= DataManager.BagData.ItemData:getVit()
|
||||
end
|
||||
|
||||
-- 获取挑战体力消耗
|
||||
function DailyChallengeData:getChallengeHpCost()
|
||||
return GFunc.getConstReward("daily_challenge_cost")
|
||||
return GFunc.getConstReward("daily_challenge_cost")
|
||||
|
||||
end
|
||||
|
||||
-- 获取今日挑战场景配置
|
||||
function DailyChallengeData:getMapConfig()
|
||||
return ConfigManager:getConfig("chapter_daily_challenge")[self:getChapterDailyId()]
|
||||
return ConfigManager:getConfig("chapter_daily_challenge")[self:getChapterDailyId()]
|
||||
end
|
||||
|
||||
function DailyChallengeData:getTaskCfg()
|
||||
@ -95,173 +97,173 @@ end
|
||||
|
||||
-- 获取今日通关次数
|
||||
function DailyChallengeData:getTodayPassNum()
|
||||
return self.todayFightCount
|
||||
return self.todayFightCount
|
||||
end
|
||||
|
||||
-- 获取今日最高记录(最大通过波次)
|
||||
function DailyChallengeData:getMaxWave()
|
||||
return self.maxWave
|
||||
return self.maxWave
|
||||
end
|
||||
|
||||
-- 获取今日增益、负面buff
|
||||
function DailyChallengeData:getTodayBuffIds()
|
||||
return self.buffIds
|
||||
return self.buffIds
|
||||
end
|
||||
|
||||
-- 获取buff描述
|
||||
function DailyChallengeData:getBuffDesc(buffId)
|
||||
return I18N:getText("buff_daily_challenge", buffId, "desc")
|
||||
return I18N:getText("buff_daily_challenge", buffId, "desc")
|
||||
end
|
||||
|
||||
-- 获取最终boss配置信息
|
||||
function DailyChallengeData:getFinalBossInfo()
|
||||
if not self:isOpen() then
|
||||
return
|
||||
end
|
||||
local mapCfg = self:getMapConfig()
|
||||
if not mapCfg then
|
||||
return
|
||||
end
|
||||
return ConfigManager:getConfig("monster")[mapCfg.monster[#mapCfg.monster]]
|
||||
if not self:isOpen() then
|
||||
return
|
||||
end
|
||||
local mapCfg = self:getMapConfig()
|
||||
if not mapCfg then
|
||||
return
|
||||
end
|
||||
return ConfigManager:getConfig("monster")[mapCfg.monster[#mapCfg.monster]]
|
||||
end
|
||||
|
||||
-- 任务是否完成
|
||||
function DailyChallengeData:isTaskFinish(index)
|
||||
if not self:isOpen() then
|
||||
return false
|
||||
end
|
||||
local cfg = self:getTaskCfgInfo(self.tasks[index].task_id)
|
||||
if not cfg then
|
||||
return false
|
||||
end
|
||||
if not self:isOpen() then
|
||||
return false
|
||||
end
|
||||
local cfg = self:getTaskCfgInfo(self.tasks[index].task_id)
|
||||
if not cfg then
|
||||
return false
|
||||
end
|
||||
|
||||
return cfg.param <= self.tasks[index].progress
|
||||
return cfg.param <= self.tasks[index].progress
|
||||
end
|
||||
|
||||
function DailyChallengeData:getTasks()
|
||||
return self.tasks
|
||||
return self.tasks
|
||||
end
|
||||
|
||||
function DailyChallengeData:getTaskById(taskId)
|
||||
for index, taskInfo in ipairs(self.tasks) do
|
||||
if taskInfo.task_id == taskId then
|
||||
return taskInfo
|
||||
end
|
||||
end
|
||||
for index, taskInfo in ipairs(self.tasks) do
|
||||
if taskInfo.task_id == taskId then
|
||||
return taskInfo
|
||||
end
|
||||
end
|
||||
|
||||
return
|
||||
return
|
||||
end
|
||||
|
||||
-- 任务奖励是否可领取
|
||||
function DailyChallengeData:canClaimTask(index)
|
||||
if not self:isOpen() then
|
||||
return false
|
||||
end
|
||||
if not self.tasks[index] then
|
||||
return false
|
||||
end
|
||||
if self.tasks[index].claimed then
|
||||
return false
|
||||
end
|
||||
if not self:isOpen() then
|
||||
return false
|
||||
end
|
||||
if not self.tasks[index] then
|
||||
return false
|
||||
end
|
||||
if self.tasks[index].claimed then
|
||||
return false
|
||||
end
|
||||
|
||||
return self:isTaskFinish(index)
|
||||
return self:isTaskFinish(index)
|
||||
end
|
||||
|
||||
function DailyChallengeData:getTaskProgresss(index)
|
||||
if not self:isOpen() then
|
||||
return 0
|
||||
end
|
||||
if not self.tasks[index] then
|
||||
return 0
|
||||
end
|
||||
return self.tasks[index].progress
|
||||
if not self:isOpen() then
|
||||
return 0
|
||||
end
|
||||
if not self.tasks[index] then
|
||||
return 0
|
||||
end
|
||||
return self.tasks[index].progress
|
||||
end
|
||||
|
||||
function DailyChallengeData:getTaskCfgInfo(taskId)
|
||||
return TASK_CFG[taskId]
|
||||
return TASK_CFG[taskId]
|
||||
end
|
||||
|
||||
function DailyChallengeData:getTaskTotalNumber(taskId)
|
||||
if self:getTaskCfgInfo(taskId) then
|
||||
return self:getTaskCfgInfo(taskId).param
|
||||
else
|
||||
return 1 -- 容错,防止报错
|
||||
end
|
||||
if self:getTaskCfgInfo(taskId) then
|
||||
return self:getTaskCfgInfo(taskId).param
|
||||
else
|
||||
return 1 -- 容错,防止报错
|
||||
end
|
||||
end
|
||||
|
||||
function DailyChallengeData:getTaskRewards(taskId)
|
||||
if self:getTaskCfgInfo(taskId) then
|
||||
return self:getTaskCfgInfo(taskId).reward
|
||||
end
|
||||
return nil
|
||||
if self:getTaskCfgInfo(taskId) then
|
||||
return self:getTaskCfgInfo(taskId).reward
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
function DailyChallengeData:getTaskDesc(taskId, needProgress, customProgress)
|
||||
local desc = GConst.EMPTY_STRING
|
||||
if not I18N:getConfig("task_daily_challenge")[taskId] then
|
||||
return desc
|
||||
end
|
||||
local taskNum = self:getTaskTotalNumber(taskId)
|
||||
if PER_TASK[taskId] then
|
||||
taskNum = taskNum * 100 // GConst.BattleConst.DEFAULT_FACTOR
|
||||
end
|
||||
local taskInfo = self:getTaskById(taskId)
|
||||
if not taskInfo then
|
||||
return desc
|
||||
end
|
||||
local desc = GConst.EMPTY_STRING
|
||||
if not I18N:getConfig("task_daily_challenge")[taskId] then
|
||||
return desc
|
||||
end
|
||||
local taskNum = self:getTaskTotalNumber(taskId)
|
||||
if PER_TASK[taskId] then
|
||||
taskNum = taskNum * 100 // GConst.BattleConst.DEFAULT_FACTOR
|
||||
end
|
||||
local taskInfo = self:getTaskById(taskId)
|
||||
if not taskInfo then
|
||||
return desc
|
||||
end
|
||||
|
||||
local conditionStr
|
||||
if FIXED_HERO_TASK[taskId] then -- 具体英雄
|
||||
conditionStr = ModuleManager.HeroManager:getHeroName(taskInfo.param, true)
|
||||
elseif MATCH_TYPE_TASK[taskId] then -- 颜色英雄
|
||||
conditionStr = ModuleManager.HeroManager:getMatchTypeName(taskInfo.param, true)
|
||||
end
|
||||
local conditionStr
|
||||
if FIXED_HERO_TASK[taskId] then -- 具体英雄
|
||||
conditionStr = ModuleManager.HeroManager:getHeroName(taskInfo.param, true)
|
||||
elseif MATCH_TYPE_TASK[taskId] then -- 颜色英雄
|
||||
conditionStr = ModuleManager.HeroManager:getMatchTypeName(taskInfo.param, true)
|
||||
end
|
||||
|
||||
if conditionStr then
|
||||
desc = I18N:getText("task_daily_challenge", taskId, "desc", conditionStr, taskNum)
|
||||
else
|
||||
desc = I18N:getText("task_daily_challenge", taskId, "desc", taskNum)
|
||||
end
|
||||
if conditionStr then
|
||||
desc = I18N:getText("task_daily_challenge", taskId, "desc", conditionStr, taskNum)
|
||||
else
|
||||
desc = I18N:getText("task_daily_challenge", taskId, "desc", taskNum)
|
||||
end
|
||||
|
||||
if needProgress and NEED_PROGRESS_TASK[taskId] then
|
||||
local progress = customProgress or taskInfo.progress
|
||||
if PER_TASK[taskId] then
|
||||
progress = progress * 100 // GConst.BattleConst.DEFAULT_FACTOR .. "%"
|
||||
taskNum = taskNum .. "%"
|
||||
end
|
||||
local progressStr = string.format("<color=#5FFF53>(%s/%s)</color>", progress, taskNum)
|
||||
desc = desc .. progressStr
|
||||
end
|
||||
return desc
|
||||
if needProgress and NEED_PROGRESS_TASK[taskId] then
|
||||
local progress = customProgress or taskInfo.progress
|
||||
if PER_TASK[taskId] then
|
||||
progress = progress * 100 // GConst.BattleConst.DEFAULT_FACTOR .. "%"
|
||||
taskNum = taskNum .. "%"
|
||||
end
|
||||
local progressStr = string.format("<color=#5FFF53>(%s/%s)</color>", progress, taskNum)
|
||||
desc = desc .. progressStr
|
||||
end
|
||||
return desc
|
||||
end
|
||||
|
||||
function DailyChallengeData:getTodayRemainLimitCount()
|
||||
local count = self:getChallengeTimeCost() - self.todayFightCount
|
||||
if count < 0 then
|
||||
count = 0
|
||||
end
|
||||
return count
|
||||
local count = self:getChallengeTimeCost() - self.todayFightCount
|
||||
if count < 0 then
|
||||
count = 0
|
||||
end
|
||||
return count
|
||||
end
|
||||
|
||||
-- 处理主动退出的情况
|
||||
function DailyChallengeData:onFightCountReduce()
|
||||
self.todayFightCount = self.todayFightCount + 1
|
||||
self.todayFightCount = self.todayFightCount + 1
|
||||
end
|
||||
|
||||
function DailyChallengeData:getFixedChapterId()
|
||||
return self.fixedChapterId
|
||||
return self.fixedChapterId
|
||||
end
|
||||
|
||||
function DailyChallengeData:getChapterDailyId()
|
||||
return self.chapterDailyId
|
||||
return self.chapterDailyId
|
||||
end
|
||||
|
||||
function DailyChallengeData:setFixedChapterId(id)
|
||||
self.fixedChapterId = id
|
||||
self.fixedChapterId = id
|
||||
end
|
||||
|
||||
function DailyChallengeData:getTotalFightCount()
|
||||
return self.totalFightCount
|
||||
return self.totalFightCount
|
||||
end
|
||||
|
||||
function DailyChallengeData:getIfCanReset()
|
||||
@ -285,14 +287,14 @@ function DailyChallengeData:getIsInReset()
|
||||
end
|
||||
|
||||
function DailyChallengeData:getIsPopTask()
|
||||
if not self:isOpen() then
|
||||
return false
|
||||
end
|
||||
return self.popTaskTime < Time:getBeginningOfServerToday()
|
||||
if not self:isOpen() then
|
||||
return false
|
||||
end
|
||||
return self.popTaskTime < Time:getBeginningOfServerToday()
|
||||
end
|
||||
|
||||
function DailyChallengeData:markPopTask()
|
||||
if self.popTaskTime >= Time:getBeginningOfServerToday() then
|
||||
if self.popTaskTime >= Time:getBeginningOfServerToday() then
|
||||
return
|
||||
end
|
||||
self.popTaskTime = Time:getBeginningOfServerToday()
|
||||
@ -301,12 +303,36 @@ end
|
||||
|
||||
--@region 红点
|
||||
function DailyChallengeData:showRedPoint()
|
||||
for i = 1, 3 do
|
||||
if DataManager.DailyChallengeData:canClaimTask(i) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
return self:canGetReward()
|
||||
end
|
||||
|
||||
function DailyChallengeData:canGetReward()
|
||||
for i = 1, 3 do
|
||||
if DataManager.DailyChallengeData:canClaimTask(i) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
--@endregion
|
||||
|
||||
--@region 难度
|
||||
function DailyChallengeData:setDiffLv(diffLv)
|
||||
self.diffLv = diffLv
|
||||
self:setDirty()
|
||||
end
|
||||
|
||||
function DailyChallengeData:getDiffLv()
|
||||
return self.diffLv
|
||||
end
|
||||
|
||||
function DailyChallengeData:getMaxDiffLv()
|
||||
return #CHAPTER_DAILY_CHALLENGE_CFG
|
||||
end
|
||||
|
||||
function DailyChallengeData:getDifficultyCfg(id)
|
||||
return CHAPTER_DAILY_CHALLENGE_CFG[id]
|
||||
end
|
||||
--@endregion
|
||||
return DailyChallengeData
|
||||
Loading…
x
Reference in New Issue
Block a user