This commit is contained in:
Fang 2023-06-14 10:22:34 +08:00
parent 1d68846a85
commit 097812e730
7 changed files with 46 additions and 9 deletions

View File

@ -33,6 +33,8 @@ EventManager.CUSTOM_EVENT = {
CLOSE_BOX_HERO_UI = "CLOSE_BOX_HERO_UI", CLOSE_BOX_HERO_UI = "CLOSE_BOX_HERO_UI",
CLOSE_BOX_OPEN_UI = "CLOSE_BOX_OPEN_UI", CLOSE_BOX_OPEN_UI = "CLOSE_BOX_OPEN_UI",
BIND_ACCOUNT_SUCCESS = "BIND_ACCOUNT_SUCCESS", BIND_ACCOUNT_SUCCESS = "BIND_ACCOUNT_SUCCESS",
DUNGEON_CHALLENGE = "DUNGEON_CHALLENGE",-- 副本开始挑战
DUNGEON_SWEEP = "DUNGEON_SWEEP",-- 副本开始扫荡
-- BORAD_TOUCH_BEGIN = "BORAD_TOUCH_BEGIN", -- BORAD_TOUCH_BEGIN = "BORAD_TOUCH_BEGIN",
-- BORAD_TOUCH_OVER = "BORAD_TOUCH_OVER" -- BORAD_TOUCH_OVER = "BORAD_TOUCH_OVER"
} }

View File

@ -32,6 +32,9 @@ end
-- 内部接口-------------------------------------------------------------------------- -- 内部接口--------------------------------------------------------------------------
function DungeonManager:checkDayChange() function DungeonManager:checkDayChange()
if EDITOR_MODE then
Logger.logHighlight("检查跨天:".. tostring(DataManager.DungeonData:getIfCanReset()))
end
if not DataManager.DungeonData:getIfCanReset() then if not DataManager.DungeonData:getIfCanReset() then
return return
end end
@ -44,7 +47,7 @@ end
function DungeonManager:reqChallengeGold(id) function DungeonManager:reqChallengeGold(id)
local moduleKey = ModuleManager.MODULE_KEY.DUNGEON_GOLD local moduleKey = ModuleManager.MODULE_KEY.DUNGEON_GOLD
-- 判断次数 -- 判断次数
if not (DataManager.DungeonData:getRemainTimes(moduleKey) > 0) then if DataManager.DungeonData:getRemainTimes(moduleKey) <= 0 then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_1)) GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_1))
return return
end end
@ -70,6 +73,7 @@ function DungeonManager:respChallengeGold(result)
DataManager.DungeonData:onFightCountReduce(ModuleManager.MODULE_KEY.DUNGEON_GOLD) DataManager.DungeonData:onFightCountReduce(ModuleManager.MODULE_KEY.DUNGEON_GOLD)
DataManager.DungeonData:setCurFightChapterId(result.reqData.chapter_gold_id) DataManager.DungeonData:setCurFightChapterId(result.reqData.chapter_gold_id)
ModuleManager.BattleManager:playBattle(GConst.BattleConst.BATTLE_TYPE.DUNGEON_GOLD) ModuleManager.BattleManager:playBattle(GConst.BattleConst.BATTLE_TYPE.DUNGEON_GOLD)
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.DUNGEON_CHALLENGE)
end end
end end
@ -98,7 +102,7 @@ end
function DungeonManager:reqSweepGold(id) function DungeonManager:reqSweepGold(id)
local moduleKey = ModuleManager.MODULE_KEY.DUNGEON_GOLD local moduleKey = ModuleManager.MODULE_KEY.DUNGEON_GOLD
-- 判断次数 -- 判断次数
if not (DataManager.DungeonData:getRemainTimes(moduleKey) > 0) then if DataManager.DungeonData:getRemainTimes(moduleKey) <= 0 then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_1)) GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_1))
return return
end end
@ -124,14 +128,15 @@ end
function DungeonManager:respSweepGold(result) function DungeonManager:respSweepGold(result)
if result.err_code == GConst.ERROR_STR.SUCCESS then if result.err_code == GConst.ERROR_STR.SUCCESS then
DataManager.DungeonData:onFightCountReduce(ModuleManager.MODULE_KEY.DUNGEON_GOLD) DataManager.DungeonData:onFightCountReduce(ModuleManager.MODULE_KEY.DUNGEON_GOLD)
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.DUNGEON_SWEEP)
end end
end end
-- 请求挑战碎片副本 -- 请求挑战碎片副本
function DungeonManager:reqChallengeShards(id) function DungeonManager:reqChallengeShards(id)
local moduleKey = ModuleManager.MODULE_KEY.DUNGEON_GOLD local moduleKey = ModuleManager.MODULE_KEY.DUNGEON_SHARDS
-- 判断次数 -- 判断次数
if not (DataManager.DungeonData:getRemainTimes(moduleKey) > 0) then if DataManager.DungeonData:getRemainTimes(moduleKey) <= 0 then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_1)) GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_1))
return return
end end
@ -157,6 +162,7 @@ function DungeonManager:respChallengeShards(result)
DataManager.DungeonData:onFightCountReduce(ModuleManager.MODULE_KEY.DUNGEON_SHARDS) DataManager.DungeonData:onFightCountReduce(ModuleManager.MODULE_KEY.DUNGEON_SHARDS)
DataManager.DungeonData:setCurFightChapterId(result.reqData.chapter_shards_id) DataManager.DungeonData:setCurFightChapterId(result.reqData.chapter_shards_id)
ModuleManager.BattleManager:playBattle(GConst.BattleConst.BATTLE_TYPE.DUNGEON_SHARDS) ModuleManager.BattleManager:playBattle(GConst.BattleConst.BATTLE_TYPE.DUNGEON_SHARDS)
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.DUNGEON_CHALLENGE)
end end
end end
@ -184,7 +190,7 @@ end
function DungeonManager:reqSweepShards(id) function DungeonManager:reqSweepShards(id)
local moduleKey = ModuleManager.MODULE_KEY.DUNGEON_SHARDS local moduleKey = ModuleManager.MODULE_KEY.DUNGEON_SHARDS
-- 判断次数 -- 判断次数
if not (DataManager.DungeonData:getRemainTimes(moduleKey) > 0) then if DataManager.DungeonData:getRemainTimes(moduleKey) <= 0 then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_1)) GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_1))
return return
end end
@ -210,6 +216,7 @@ end
function DungeonManager:respSweepShards(result) function DungeonManager:respSweepShards(result)
if result.err_code == GConst.ERROR_STR.SUCCESS then if result.err_code == GConst.ERROR_STR.SUCCESS then
DataManager.DungeonData:onFightCountReduce(ModuleManager.MODULE_KEY.DUNGEON_SHARDS) DataManager.DungeonData:onFightCountReduce(ModuleManager.MODULE_KEY.DUNGEON_SHARDS)
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.DUNGEON_SWEEP)
end end
end end

View File

@ -100,6 +100,13 @@ function DungeonDifficultyUI:onLoadRootComplete()
self.curId = self.curId + 1 self.curId = self.curId + 1
self:refreshDifficulty() self:refreshDifficulty()
end) end)
self:addEventListener(EventManager.CUSTOM_EVENT.DUNGEON_CHALLENGE, function()
self:closeUI()
end)
self:addEventListener(EventManager.CUSTOM_EVENT.DUNGEON_SWEEP, function()
self:closeUI()
end)
end end
function DungeonDifficultyUI:refreshDifficulty() function DungeonDifficultyUI:refreshDifficulty()

View File

@ -41,6 +41,9 @@ function DungeonComp:init()
end end
function DungeonComp:refreshShow() function DungeonComp:refreshShow()
if EDITOR_MODE then
Logger.logHighlight("更新副本显示."..tostring(Time:getTodaySurplusTime()))
end
self.openDungeons = DataManager.DungeonData:getOpenDungeons() self.openDungeons = DataManager.DungeonData:getOpenDungeons()
if self.scrollRectComp:getTotalCount() ~= #self.openDungeons then if self.scrollRectComp:getTotalCount() ~= #self.openDungeons then
self.scrollRectComp:clearCells() self.scrollRectComp:clearCells()
@ -56,7 +59,7 @@ function DungeonComp:refreshShow()
end end
self.countdownSid = self:getBaseObject():scheduleGlobal(function() self.countdownSid = self:getBaseObject():scheduleGlobal(function()
ModuleManager.DungeonManager:checkDayChange() ModuleManager.DungeonManager:checkDayChange()
end, Time:getTodaySurplusTime()) end, Time:getTodaySurplusTime() + 1)
end end

View File

@ -237,7 +237,7 @@ function MainCityUI:_bind()
end end
end) end)
self:bind(DataManager.DailyChallengeData, "isDirty", function() self:bind(DataManager.DungeonData, "isDirty", function()
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN then if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN then
if self.subComps[self.selectedIndex] then if self.subComps[self.selectedIndex] then
self.subComps[self.selectedIndex]:refreshDungeon() self.subComps[self.selectedIndex]:refreshDungeon()

View File

@ -21,6 +21,11 @@ function DungeonData:initDungeonGold(data)
return return
end end
if EDITOR_MODE then
Logger.logHighlight("更新金币副本数据")
Logger.printTable(data)
end
self:initAllDataClass() self:initAllDataClass()
self.dataDungeons[ModuleManager.MODULE_KEY.DUNGEON_GOLD]:init(data) self.dataDungeons[ModuleManager.MODULE_KEY.DUNGEON_GOLD]:init(data)
self.data.gold = data self.data.gold = data
@ -33,6 +38,11 @@ function DungeonData:initDungeonShards(data)
return return
end end
if EDITOR_MODE then
Logger.logHighlight("更新碎片副本数据")
Logger.printTable(data)
end
self:initAllDataClass() self:initAllDataClass()
self.dataDungeons[ModuleManager.MODULE_KEY.DUNGEON_SHARDS]:init(data) self.dataDungeons[ModuleManager.MODULE_KEY.DUNGEON_SHARDS]:init(data)
self.data.shards = data self.data.shards = data
@ -45,6 +55,10 @@ function DungeonData:initAllDataClass()
self.dataDungeons = {} self.dataDungeons = {}
self.dataDungeons[ModuleManager.MODULE_KEY.DUNGEON_GOLD] = require "app/userdata/dungeon/dungeon_gold_data_comp":create() self.dataDungeons[ModuleManager.MODULE_KEY.DUNGEON_GOLD] = require "app/userdata/dungeon/dungeon_gold_data_comp":create()
self.dataDungeons[ModuleManager.MODULE_KEY.DUNGEON_SHARDS] = require "app/userdata/dungeon/dungeon_shards_data_comp":create() self.dataDungeons[ModuleManager.MODULE_KEY.DUNGEON_SHARDS] = require "app/userdata/dungeon/dungeon_shards_data_comp":create()
if EDITOR_MODE then
Logger.logHighlight("星期".. tostring(Time:getWeekByTimeStamp()))
end
end end
self.initDay = Time:getBeginningOfServerToday() self.initDay = Time:getBeginningOfServerToday()
@ -60,7 +74,7 @@ function DungeonData:onDayChange()
self.data.shards.today_challenge_count = 0 self.data.shards.today_challenge_count = 0
self:initDungeonGold(self.data.gold) self:initDungeonGold(self.data.gold)
self:initDungeonGold(self.data.shards) self:initDungeonShards(self.data.shards)
end end
-- 客户端处理副本次数+1的情况 -- 客户端处理副本次数+1的情况
@ -70,7 +84,7 @@ function DungeonData:onFightCountReduce(moduleKey)
self:initDungeonGold(self.data.gold) self:initDungeonGold(self.data.gold)
elseif moduleKey == ModuleManager.MODULE_KEY.DUNGEON_SHARDS then elseif moduleKey == ModuleManager.MODULE_KEY.DUNGEON_SHARDS then
self.data.shards.today_challenge_count = self.data.shards.today_challenge_count + 1 self.data.shards.today_challenge_count = self.data.shards.today_challenge_count + 1
self:initDungeonGold(self.data.shards) self:initDungeonShards(self.data.shards)
end end
end end

View File

@ -37,6 +37,10 @@ function DungeonShardsDataComp:getTitleString()
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_SHARDS_TITLE) return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_SHARDS_TITLE)
end end
function DungeonShardsDataComp:getRuleString()
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_SHARDS_HELP)
end
function DungeonShardsDataComp:getOpenWeekString() function DungeonShardsDataComp:getOpenWeekString()
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_SHARDS_OPEN) return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_SHARDS_OPEN)
end end