diff --git a/lua/app/common/bi_report.lua b/lua/app/common/bi_report.lua index 8536f33d..8d9a2e81 100644 --- a/lua/app/common/bi_report.lua +++ b/lua/app/common/bi_report.lua @@ -96,6 +96,12 @@ BIReport.ITEM_GET_TYPE = { DAILY_CHALLENGE_END = "DailyChallengeEnd", -- 每日挑战结算 DAILY_CHALLENGE_RESET = "DailyChallengeReset", -- 每日挑战重置 DAILY_CHALLENGE_TASK_REWARD = "DailyChallengeTaskReward", -- 每日挑战任务奖励 + DUNGEON_GOLD_CHALLENGE = "DungeonGoldChallenge", -- 金币副本挑战 + DUNGEON_GOLD_END = "DungeonGoldEnd", -- 金币副本结算 + DUNGEON_GOLD_SWEEP = "DungeonGoldSweep", -- 金币副本扫荡 + DUNGEON_SHARDS_CHALLENGE = "DungeonShardsChallenge", -- 碎片副本挑战 + DUNGEON_SHARDS_END = "DungeonShardsEnd", -- 碎片副本结算 + DUNGEON_SHARDS_SWEEP = "DungeonShardsSweep", -- 碎片副本扫荡 } BIReport.ADS_CLICK_TYPE = { diff --git a/lua/app/common/config_manager.lua b/lua/app/common/config_manager.lua index 8147541b..58fe120e 100644 --- a/lua/app/common/config_manager.lua +++ b/lua/app/common/config_manager.lua @@ -111,6 +111,8 @@ function ConfigManager:preLoadConfig() end handleMonsterGrow("monster_chapter") handleMonsterGrow("monster_daily_challenge") + handleMonsterGrow("monster_dungeon_gold") + handleMonsterGrow("monster_dungeon_shards") self.configs["monster"] = { data = monsterFullData, diff --git a/lua/app/common/data_manager.lua b/lua/app/common/data_manager.lua index d6a0dd4a..0d06a130 100644 --- a/lua/app/common/data_manager.lua +++ b/lua/app/common/data_manager.lua @@ -9,6 +9,7 @@ function DataManager:init() self:initManager("PlayerData", "app/userdata/player/player_data") self:initManager("ChapterData", "app/userdata/chapter/chapter_data") self:initManager("DailyChallengeData", "app/userdata/daily_challenge/daily_challenge_data") + self:initManager("DungeonData", "app/userdata/dungeon/dungeon_data") self:initManager("HeroData", "app/userdata/hero/hero_data") self:initManager("BagData", "app/userdata/bag/bag_data") self:initManager("BattleData", "app/userdata/battle/battle_data") @@ -85,6 +86,7 @@ function DataManager:clear() self.PlayerData:clear() self.ChapterData:clear() self.DailyChallengeData:clear() + self.DungeonData:clear() self.HeroData:clear() self.BagData:clear() self.FormationData:clear() @@ -119,6 +121,8 @@ function DataManager:initWithServerData(data) self.PlayerData:init(data) self.ChapterData:init(data.chapter) self.DailyChallengeData:init(data.chapter_daily_challenge) + self.DungeonData:initDungeonGold(data.chapter_gold_challenge) + self.DungeonData:initDungeonShards(data.chapter_shards_challenge) self.HeroData:init(data.bag.heroes) self.BagData:init(data.bag) self.FormationData:init(data.fight_info) diff --git a/lua/app/common/event_manager.lua b/lua/app/common/event_manager.lua index 12cb89c1..1e12eb58 100644 --- a/lua/app/common/event_manager.lua +++ b/lua/app/common/event_manager.lua @@ -29,11 +29,12 @@ EventManager.CUSTOM_EVENT = { SKILL_REFRESH_SUCC = "SKILL_REFRESH_SUCC", GO_SHOP = "GO_SHOP", -- 跳转商店 UPDATE_MAIN_MALL_HEIGHT = "UPDATE_MAIN_MALL_HEIGHT", -- 更新主要商品的高度 - GO_DAILY_CHALLENGE = "GO_DAILY_CHALLENGE", -- 跳转每日挑战 - GO_CHAPTER = "GO_CHAPTER", -- 跳转主线章节 + CHANGE_MAIN_COMP_MODULE = "CHANGE_MAIN_COMP_MODULE", -- 切换主界面模块 CLOSE_BOX_HERO_UI = "CLOSE_BOX_HERO_UI", CLOSE_BOX_OPEN_UI = "CLOSE_BOX_OPEN_UI", BIND_ACCOUNT_SUCCESS = "BIND_ACCOUNT_SUCCESS", + DUNGEON_CHALLENGE = "DUNGEON_CHALLENGE",-- 副本开始挑战 + DUNGEON_SWEEP = "DUNGEON_SWEEP",-- 副本开始扫荡 -- BORAD_TOUCH_BEGIN = "BORAD_TOUCH_BEGIN", -- BORAD_TOUCH_OVER = "BORAD_TOUCH_OVER" } diff --git a/lua/app/common/module_manager.lua b/lua/app/common/module_manager.lua index 1329067a..0e299a5e 100644 --- a/lua/app/common/module_manager.lua +++ b/lua/app/common/module_manager.lua @@ -51,6 +51,8 @@ local MODULE_PATHS = { PlayerManager = "app/module/player/player_manager", -- 账号 AccountManager= "app/module/account/account_manager", + -- 活动副本 + DungeonManager = "app/module/dungeon/dungeon_manager", } -- 这里的key对应func_open里的id @@ -70,6 +72,8 @@ ModuleManager.MODULE_KEY = { FIRST_RECHARGE = "first_charge", -- 首充礼包 BEGINNER_GIFT = "new_player_gift", -- 新手礼包 MAIL = "mail_open", -- 邮件 + DUNGEON_SHARDS = "dungeon_shards_open", -- 碎片副本 + DUNGEON_GOLD = "dungeon_gold_open", -- 金币副本 } local _moduleMgrs = {} diff --git a/lua/app/common/time.lua b/lua/app/common/time.lua index e26e3e01..ea3a7b6e 100644 --- a/lua/app/common/time.lua +++ b/lua/app/common/time.lua @@ -137,6 +137,15 @@ function Time:getOverOfServerToday(time) return self:getBeginningOfServerToday() + SECONDS_PRE_DAY end +-- 获取今日剩余时间 +function Time:getTodaySurplusTime() + local result = self:getOverOfServerToday() - self:getServerTime() + if result < 0 then + result = 0 + end + return result +end + function Time:getBeginningOfToday() local now = os.date('*t', self:getServerTime() + self:getTimeZoneOffset()*SECONDS_PRE_HOUR) local beginDay = os.time{year = now.year, month = now.month, day = now.day, hour = 0} @@ -271,6 +280,15 @@ function Time:getDayByTimeStamp(time) return now.day end +-- 获取当前处于星期几 +function Time:getWeekByTimeStamp(time) + time = time or self:getServerTime() + local now = os.date('!*t', time) + + local weekTab = {7, 1, 2, 3, 4, 5, 6} + return weekTab[now.wday] +end + -- 转换服务器时间字符串(ISO 8601)的对应的时间戳,例如2022-09-10T18:10:00.000Z function Time:convertServerTimeStringToTimestamp(str) local dateTime = CS.System.DateTime.Parse(str) diff --git a/lua/app/config/avatar.lua.meta b/lua/app/config/avatar.lua.meta index f92e8cec..541470ef 100644 --- a/lua/app/config/avatar.lua.meta +++ b/lua/app/config/avatar.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 8d3c3e28eaf46a94287e7509be47d216 +guid: fe59ab7c592d4c141b9fa28289bc898d ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/avatar_frame.lua.meta b/lua/app/config/avatar_frame.lua.meta index 82b8808b..68879273 100644 --- a/lua/app/config/avatar_frame.lua.meta +++ b/lua/app/config/avatar_frame.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 0bf07daf8913b274e9d0b0b3a5fad0d1 +guid: 8d387a3ff3bff68488370d1ca79c39d5 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/cn/avatar.lua.meta b/lua/app/config/strings/cn/avatar.lua.meta index ad39e62f..15a5659a 100644 --- a/lua/app/config/strings/cn/avatar.lua.meta +++ b/lua/app/config/strings/cn/avatar.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 7ab9ad8c53741f74db70394c459f5ddc +guid: e550b6c1888c8c54a983504aadc97dd9 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/cn/avatar_frame.lua.meta b/lua/app/config/strings/cn/avatar_frame.lua.meta index 070fca6f..c845fedc 100644 --- a/lua/app/config/strings/cn/avatar_frame.lua.meta +++ b/lua/app/config/strings/cn/avatar_frame.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 854572b70505d6f49b8709e3414a100f +guid: 7ebdcf5eea9b5744b93b6a66a8a3a4ac ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/de/avatar.lua.meta b/lua/app/config/strings/de/avatar.lua.meta index fbcdff37..35f44d0c 100644 --- a/lua/app/config/strings/de/avatar.lua.meta +++ b/lua/app/config/strings/de/avatar.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b80d583de1bab0249b1c2ea7e2b39f19 +guid: 9dc40103a0748db44a9f1b68cf0aa638 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/de/avatar_frame.lua.meta b/lua/app/config/strings/de/avatar_frame.lua.meta index ac50ab36..cd3295fd 100644 --- a/lua/app/config/strings/de/avatar_frame.lua.meta +++ b/lua/app/config/strings/de/avatar_frame.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 6646cef1053957f498996449942e317b +guid: 45e62fba12275294c9ca0781541e898f ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/en/avatar.lua.meta b/lua/app/config/strings/en/avatar.lua.meta index a9aa2d90..8bea9922 100644 --- a/lua/app/config/strings/en/avatar.lua.meta +++ b/lua/app/config/strings/en/avatar.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9569dbcc21310dd4892f99b934dacdf1 +guid: 2efd30882537bcf4d85d41874b20a5d1 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/en/avatar_frame.lua.meta b/lua/app/config/strings/en/avatar_frame.lua.meta index 85703584..a78ecf24 100644 --- a/lua/app/config/strings/en/avatar_frame.lua.meta +++ b/lua/app/config/strings/en/avatar_frame.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c4d871056db7f784c8c8346a2a757b6a +guid: feee83113a5ebf648b61119b6ea67052 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/fr/avatar.lua.meta b/lua/app/config/strings/fr/avatar.lua.meta index 56ef60b5..748f5bf0 100644 --- a/lua/app/config/strings/fr/avatar.lua.meta +++ b/lua/app/config/strings/fr/avatar.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 9e880ced67030724b8e10531e93925aa +guid: 1b7f9b5c90bd55244adec4028f50f7ae ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/fr/avatar_frame.lua.meta b/lua/app/config/strings/fr/avatar_frame.lua.meta index 827c15c0..804746aa 100644 --- a/lua/app/config/strings/fr/avatar_frame.lua.meta +++ b/lua/app/config/strings/fr/avatar_frame.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c17fae36e98d089418b7172a74c0f72b +guid: 91626068ba5bf40478d4c5f990dd336c ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/id/avatar.lua.meta b/lua/app/config/strings/id/avatar.lua.meta index e1310f32..79497262 100644 --- a/lua/app/config/strings/id/avatar.lua.meta +++ b/lua/app/config/strings/id/avatar.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 3ebd55d0b39273a489c43c02889dcabd +guid: be940f5ccbf143143bcb35878aa85b20 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/id/avatar_frame.lua.meta b/lua/app/config/strings/id/avatar_frame.lua.meta index 12ad405e..50329b86 100644 --- a/lua/app/config/strings/id/avatar_frame.lua.meta +++ b/lua/app/config/strings/id/avatar_frame.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: d0df14a4c7def2b4dba7e30aa219d179 +guid: 9b782692fe3bc8046acedd1c14447f80 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/ja/avatar.lua.meta b/lua/app/config/strings/ja/avatar.lua.meta index 7465c67b..7d1b2d2e 100644 --- a/lua/app/config/strings/ja/avatar.lua.meta +++ b/lua/app/config/strings/ja/avatar.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 56e74edf74e085649a1d58b52050bf83 +guid: 4e211405289be9d4fb6973d27e4c0454 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/ja/avatar_frame.lua.meta b/lua/app/config/strings/ja/avatar_frame.lua.meta index 48ddcb38..d60f8e6b 100644 --- a/lua/app/config/strings/ja/avatar_frame.lua.meta +++ b/lua/app/config/strings/ja/avatar_frame.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 713a1bacc42589f49a5309bc4a7f064a +guid: e19cdea5919e19a4b8bb6538c8b11347 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/ko/avatar.lua.meta b/lua/app/config/strings/ko/avatar.lua.meta index e22d6f8b..5032167e 100644 --- a/lua/app/config/strings/ko/avatar.lua.meta +++ b/lua/app/config/strings/ko/avatar.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b4194298591232d469bee8927cca98ee +guid: 845ceb9424b01974aa158e74309a0190 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/ko/avatar_frame.lua.meta b/lua/app/config/strings/ko/avatar_frame.lua.meta index 139a1b7e..b7eaf6e4 100644 --- a/lua/app/config/strings/ko/avatar_frame.lua.meta +++ b/lua/app/config/strings/ko/avatar_frame.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 81ee6a8c01c550649bd38da09fcb4c99 +guid: 76981286f85df2347a2124c248246121 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/pt/avatar.lua.meta b/lua/app/config/strings/pt/avatar.lua.meta index 6d2aa709..96bb6418 100644 --- a/lua/app/config/strings/pt/avatar.lua.meta +++ b/lua/app/config/strings/pt/avatar.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: a3046085d8ac78c4ea564cd0cae61a52 +guid: 0b2a3b866e0802941977489faf1a38fb ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/pt/avatar_frame.lua.meta b/lua/app/config/strings/pt/avatar_frame.lua.meta index 1dfd1bcb..14125ba1 100644 --- a/lua/app/config/strings/pt/avatar_frame.lua.meta +++ b/lua/app/config/strings/pt/avatar_frame.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c09ce43658ef5e74a80b3dfa22e1f1b5 +guid: b9d9a6866f4d1ab4887e52bd0917cdc2 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/ru/avatar.lua.meta b/lua/app/config/strings/ru/avatar.lua.meta index 455f93e4..b3abce46 100644 --- a/lua/app/config/strings/ru/avatar.lua.meta +++ b/lua/app/config/strings/ru/avatar.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b15dbe64e966569489a7836e7aff9685 +guid: ff8547e7031a5194d8b1d50552114e6e ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/ru/avatar_frame.lua.meta b/lua/app/config/strings/ru/avatar_frame.lua.meta index 6f6b940a..9ac28a23 100644 --- a/lua/app/config/strings/ru/avatar_frame.lua.meta +++ b/lua/app/config/strings/ru/avatar_frame.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 50113a7df3a762746877843f9da2b217 +guid: b6be5004e7718fd47bff83daa57c7d73 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/th/avatar.lua.meta b/lua/app/config/strings/th/avatar.lua.meta index 14584350..5de6792d 100644 --- a/lua/app/config/strings/th/avatar.lua.meta +++ b/lua/app/config/strings/th/avatar.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: bdd97d866a3ead549bf1326f93ec6162 +guid: f47e3fc3edf30dc49b517e1f6d62d4f2 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/th/avatar_frame.lua.meta b/lua/app/config/strings/th/avatar_frame.lua.meta index d03fe09e..326e0f83 100644 --- a/lua/app/config/strings/th/avatar_frame.lua.meta +++ b/lua/app/config/strings/th/avatar_frame.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 95494c882fd4db940b204e0f41b55b35 +guid: b6035fe28448bba4d99008ec9615b2d8 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/vi/avatar.lua.meta b/lua/app/config/strings/vi/avatar.lua.meta index adfa778b..408b76c4 100644 --- a/lua/app/config/strings/vi/avatar.lua.meta +++ b/lua/app/config/strings/vi/avatar.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: ab538b46345987a4aa0c2294067ba315 +guid: 2e1f0c926cef57f4986fb3a41d1496d9 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/vi/avatar_frame.lua.meta b/lua/app/config/strings/vi/avatar_frame.lua.meta index 4352c589..f22fcc60 100644 --- a/lua/app/config/strings/vi/avatar_frame.lua.meta +++ b/lua/app/config/strings/vi/avatar_frame.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 96311fba66b34c94dbbf1927048d18b9 +guid: 386cfeaa1310f294887e8b821f909933 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/zh/avatar.lua.meta b/lua/app/config/strings/zh/avatar.lua.meta index 03085442..bb12dbed 100644 --- a/lua/app/config/strings/zh/avatar.lua.meta +++ b/lua/app/config/strings/zh/avatar.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1c2c4275bc1a0294aa37b9908a8fdb4d +guid: b7c423d2d55031d48bb7b8fecf330920 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/global/global_const.lua b/lua/app/global/global_const.lua index 02c84fcd..048b5d8e 100644 --- a/lua/app/global/global_const.lua +++ b/lua/app/global/global_const.lua @@ -181,6 +181,7 @@ GConst.ATLAS_PATH = { MAIN = "assets/arts/atlas/ui/main.asset", BATTLE = "assets/arts/atlas/ui/battle.asset", DAILY_CHALLENGE = "assets/arts/atlas/ui/daily_challenge.asset", + DUNGEON = "assets/arts/atlas/ui/dungeon.asset", ICON_ITEM = "assets/arts/atlas/icon/item.asset", UI_LOGIN = "assets/arts/atlas/ui/login.asset", ICON_SKILL = "assets/arts/atlas/icon/skill.asset", diff --git a/lua/app/global/global_func.lua b/lua/app/global/global_func.lua index 00009489..58e86a09 100644 --- a/lua/app/global/global_func.lua +++ b/lua/app/global/global_func.lua @@ -1684,15 +1684,6 @@ function GFunc.recycleTempMap() end end --- 获取table长度 -function GFunc.getTableLength(table) - local length = 0 - for k, v in pairs(table) do - length = length + 1 - end - return length -end - --[[ 设置tabLe只速 出现改写会抛出Lua error 用法locaL readOnlyCfg = GFunc.readOnlyTab(cfg) return readOnlyCfg diff --git a/lua/app/module/account/account_manager.lua b/lua/app/module/account/account_manager.lua index d867b3c2..6b0cd55f 100644 --- a/lua/app/module/account/account_manager.lua +++ b/lua/app/module/account/account_manager.lua @@ -78,7 +78,7 @@ function AccountManager:onBindAccount(result) local params = { boxType = GConst.MESSAGE_BOX_TYPE.MB_OK, okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK), - } + } if result.status == 13 then -- 重复绑定 params.content = I18N:getGlobalText(I18N.GlobalConst.ALREADY_BINDED_DESC) else diff --git a/lua/app/module/battle/battle_const.lua b/lua/app/module/battle/battle_const.lua index 9658311b..0368bb51 100644 --- a/lua/app/module/battle/battle_const.lua +++ b/lua/app/module/battle/battle_const.lua @@ -77,6 +77,8 @@ BattleConst.TIME_SCALE = { BattleConst.BATTLE_TYPE = { STAGE = "1", DAILY_CHALLENGE = "2", + DUNGEON_GOLD = "3", + DUNGEON_SHARDS = "4", } BattleConst.TYPEOF_LUA_COMP = { diff --git a/lua/app/module/battle/battle_manager.lua b/lua/app/module/battle/battle_manager.lua index 080c39c3..cd2ea012 100644 --- a/lua/app/module/battle/battle_manager.lua +++ b/lua/app/module/battle/battle_manager.lua @@ -9,6 +9,8 @@ local BATTLE_CONTROLLER_BASE = "app/module/battle/controller/battle_controller" local BATTLE_CONTROLLER = { [BattleConst.BATTLE_TYPE.STAGE] = "app/module/battle/controller/battle_controller_stage", [BattleConst.BATTLE_TYPE.DAILY_CHALLENGE] = "app/module/battle/controller/battle_controller_daily_challenge", + [BattleConst.BATTLE_TYPE.DUNGEON_GOLD] = "app/module/battle/controller/battle_controller_dungeon_gold", + [BattleConst.BATTLE_TYPE.DUNGEON_SHARDS] = "app/module/battle/controller/battle_controller_dungeon_shards", } function BattleManager:showPauseUI(battleType) diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index 660d925a..09b059c3 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -19,24 +19,72 @@ local BUFF_NAME_TO_ATTR = BattleConst.BUFF_NAME_TO_ATTR local GRID_BREAK_CONDITION = BattleConst.GRID_BREAK_CONDITION -- *************各个子模块的战斗需要重写的方法 START************* +function BattleController:getBoardConfig() + return {} +end + +function BattleController:getChapterConfig() + return {} +end + function BattleController:getChapterId() return 0 end function BattleController:getInitBoard() - return {} + if not self.boradList then + self.boradList = {} + self.fixedRandomGrid = {} + self.mysteryBoxIndexMap = {} + + local config = self:getChapterConfig()[self.chapterId] + local boardCfg = self:getBoardConfig() + for _, boardId in ipairs(config.board) do + local cfg = boardCfg[boardId] + if cfg then + table.insert(self.boradList, {board = GFunc.getTable(cfg.board), mysteryBoard = GFunc.getTable(cfg.mystery_box_board)}) + table.insert(self.fixedRandomGrid, GFunc.getTable(cfg.control_element)) + end + end + end + + return self.boradList, self.fixedRandomGrid, self.mysteryBoxIndexMap end function BattleController:getNotInvolvedSkills() - return {} + if not self.notInvolvedSkills then + self.notInvolvedSkills = {} + local config = self:getChapterConfig()[self.chapterId] + if config.not_involved_skill then + for _, skillId in ipairs(config.not_involved_skill) do + self.notInvolvedSkills[skillId] = true + end + end + end + + return self.notInvolvedSkills end function BattleController:getFixedRogueSkill() - return {} + if not self.fixedRogueSkill then + self.fixedRogueSkill = {} + end + + return self.fixedRogueSkill end function BattleController:getSealElementType() - return {} + if not self.sealElementType then + self.sealElementType = {} + local config = self:getChapterConfig()[self.chapterId] + if config.seal_element then + for _, elementType in ipairs(config.seal_element) do + self.sealElementType[elementType] = true + end + end + end + + return self.sealElementType end function BattleController:getBuffs() @@ -112,7 +160,11 @@ end -- 一共有多少波 function BattleController:getMaxWave() - return 1 + local config = self:getChapterConfig()[self.chapterId] + if not config or not config.monster then + return 0 + end + return #config.monster end function BattleController:getMinEliminationCount() @@ -123,11 +175,82 @@ function BattleController:getMinEliminationCount() end function BattleController:initDefUnits(callback) - callback() + local config = self:getChapterConfig()[self.chapterId] + self.battleUI:loadBg(config.scene) + local unitEntity = DataManager.BattleData:addMonster(config.monster[1]) + local modelId = unitEntity:getModelId() + BattleHelper:loadBattleHeroModel(modelId, self.battleUI:getBattleNode(), function(spineObject) + local monsterComp = spineObject:addLuaComponent(GConst.BattleConst.TYPEOF_LUA_COMP.BATTLE_MONSTER_COMPONENT) + monsterComp:initWithEntity(modelId, unitEntity, self) + self.defTeam:addUnit(monsterComp, true) + self.battleUI:refreshDefHp(unitEntity:getHp(), unitEntity:getHpPercent()) + callback() + end) +end + +function BattleController:generateNextMonster() + local config = self:getChapterConfig()[self.chapterId] + local monsterId = config.monster[self.waveIndex + 1] + if monsterId == nil then + return self:enterNextWave() + end + local isBoss = self.defTeam:getIsBoss() + local unitEntity = DataManager.BattleData:addMonster(monsterId, true) + local modelId = unitEntity:getModelId() + BattleHelper:loadBattleHeroModel(modelId, self.battleUI:getBattleNode(), function(spineObject) + self.defTeam:removeAllUnits() + local monsterComp = spineObject:addLuaComponent(GConst.BattleConst.TYPEOF_LUA_COMP.BATTLE_MONSTER_COMPONENT) + monsterComp:initWithEntity(modelId, unitEntity, self) + self.defTeam:addUnit(monsterComp, true) + self:handleBuffs(GConst.BattleConst.SIDE_DEF) + self.battleUI:refreshDefHp(unitEntity:getHp(), unitEntity:getHpPercent()) + local bornTime = monsterComp:getAnimationDuration(GConst.BattleConst.SPINE_ANIMATION_NAME.BORN) + if isBoss then -- 如果是boss就跑过去 + local count = 0 + local function onFinish() + count = count + 1 + if count == 2 then + self.atkTeam:stopRunAction() + self:onRoundEnd(true) + end + end + self.atkTeam:playRunAction() + self.atkTeam:recoverHpOnWaveOver(onFinish) + + isBoss = self.defTeam:getIsBoss() + if isBoss then + local monsterInfo = ConfigManager:getConfig("monster")[monsterId] + self.battleUI:showBossEnterAni(bornTime, ModuleManager.HeroManager:getMonsterName(monsterInfo.monster_base), monsterComp, function() + monsterComp:playEnterBattlefield(true, onFinish) + end) + else + monsterComp:playEnterBattlefield(true, onFinish) + end + else + local count = 0 + local function onFinish() + count = count + 1 + if count == 2 then + self:onRoundEnd(true) + end + end + self.atkTeam:recoverHpOnWaveOver(onFinish) + + isBoss = self.defTeam:getIsBoss() + if isBoss then + local monsterInfo = ConfigManager:getConfig("monster")[monsterId] + self.battleUI:showBossEnterAni(bornTime, ModuleManager.HeroManager:getMonsterName(monsterInfo.monster_base), monsterComp, function() + monsterComp:playEnterBattlefield(false, onFinish) + end) + else + monsterComp:playEnterBattlefield(false, onFinish) + end + end + end) end function BattleController:findNextDefUnit() - self:enterRoundEnd() + self:generateNextMonster() end function BattleController:onDefDead(callback) @@ -239,11 +362,26 @@ end ---- 障碍格子图片 function BattleController:getBlockIcon() - return "battle_hinder_4" + local chapterInfo = self:getChapterConfig()[self.chapterId] + if not chapterInfo then + return "battle_hinder_4" + end + return chapterInfo.block_icon end function BattleController:getChessBoardBgName() - return "chessboard_1" + local chapterInfo = self:getChapterConfig()[self.chapterId] + if not chapterInfo then + return "chessboard_1" + end + return chapterInfo.chess_board +end + +function BattleController:refreshWave() + if not self.battleUI then + return + end + self.battleUI:refreshWave(self.waveIndex) end -- *************各个子模块的战斗需要重写的方法 END************* @@ -528,9 +666,7 @@ function BattleController:enterNextWave() end self.waveIndex = self.waveIndex + 1 - if self.battleUI then - self.battleUI:refreshWave(self.waveIndex) - end + self:refreshWave(self.waveIndex) if self.waveIndex == 1 then -- 第一波 self.needWaitingBoardOver = true self:generateBoard(true) diff --git a/lua/app/module/battle/controller/battle_controller_daily_challenge.lua b/lua/app/module/battle/controller/battle_controller_daily_challenge.lua index d065314e..de1980a9 100644 --- a/lua/app/module/battle/controller/battle_controller_daily_challenge.lua +++ b/lua/app/module/battle/controller/battle_controller_daily_challenge.lua @@ -1,28 +1,20 @@ local BattleHelper = require "app/module/battle/helper/battle_helper" local BattleController = require "app/module/battle/controller/battle_controller" local BattleControllerDailyChallenge = class("BattleControllerDailyChallenge", BattleController) -local CHAPTER_CFG = ConfigManager:getConfig("chapter_daily_challenge") local BattleBuffEntity = require "app/userdata/battle/skill/battle_buff_entity" +function BattleControllerDailyChallenge:getBoardConfig() + return ConfigManager:getConfig("chapter_board_daily_challenge") +end + +function BattleControllerDailyChallenge:getChapterConfig() + return ConfigManager:getConfig("chapter_daily_challenge") +end + function BattleControllerDailyChallenge:getChapterId() return DataManager.DailyChallengeData:getChapterDailyId() end -function BattleControllerDailyChallenge:getMaxWave() - if CHAPTER_CFG[self.chapterId] then - return #CHAPTER_CFG[self.chapterId].monster - end - return 0 -end - -function BattleControllerDailyChallenge:getChessBoardBgName() - local chapterInfo = CHAPTER_CFG[self.chapterId] - if not chapterInfo then - return "chessboard_1" - end - return chapterInfo.chess_board -end - function BattleControllerDailyChallenge:getBuffs() if not self.initBuffs then self.initBuffs = {} @@ -51,8 +43,8 @@ function BattleControllerDailyChallenge:onLoadComplete(...) end function BattleControllerDailyChallenge:initOther() - local ChapterId = DataManager.DailyChallengeData:getFixedChapterId() - local cfg = ConfigManager:getConfig("chapter")[ChapterId] + local chapterId = DataManager.DailyChallengeData:getFixedChapterId() + local cfg = ConfigManager:getConfig("chapter")[chapterId] self.monsterAtkAddition = 0 self.monsterHpAddition = 0 if cfg and cfg.daily_challenge_difficulty then @@ -71,89 +63,14 @@ function BattleControllerDailyChallenge:getMonsterHpAddition() return self.monsterHpAddition end -function BattleControllerDailyChallenge:initDefUnits(callback) - local config = CHAPTER_CFG[self.chapterId] - self.battleUI:loadBg(config.scene) - local unitEntity = DataManager.BattleData:addMonster(config.monster[1], nil, self) - local modelId = unitEntity:getModelId() - BattleHelper:loadBattleHeroModel(modelId, self.battleUI:getBattleNode(), function(spineObject) - local monsterComp = spineObject:addLuaComponent(GConst.BattleConst.TYPEOF_LUA_COMP.BATTLE_MONSTER_COMPONENT) - monsterComp:initWithEntity(modelId, unitEntity, self) - self.defTeam:addUnit(monsterComp, true) - self.battleUI:refreshDefHp(unitEntity:getHp(), unitEntity:getHpPercent()) - callback() - end) -end - -function BattleControllerDailyChallenge:_stageGenerateNextMonster() - local config = CHAPTER_CFG[self.chapterId] - local monsterId = config.monster[self.waveIndex + 1] - if monsterId == nil then - return self:enterNextWave() - end - local isBoss = self.defTeam:getIsBoss() - local unitEntity = DataManager.BattleData:addMonster(monsterId, true, self) - local modelId = unitEntity:getModelId() - BattleHelper:loadBattleHeroModel(modelId, self.battleUI:getBattleNode(), function(spineObject) - self.defTeam:removeAllUnits() - local monsterComp = spineObject:addLuaComponent(GConst.BattleConst.TYPEOF_LUA_COMP.BATTLE_MONSTER_COMPONENT) - monsterComp:initWithEntity(modelId, unitEntity, self) - self.defTeam:addUnit(monsterComp, true) - self:handleBuffs(GConst.BattleConst.SIDE_DEF) - self.battleUI:refreshDefHp(unitEntity:getHp(), unitEntity:getHpPercent()) - local bornTime = monsterComp:getAnimationDuration(GConst.BattleConst.SPINE_ANIMATION_NAME.BORN) - if isBoss then -- 如果是boss就跑过去 - local count = 0 - local function onFinish() - count = count + 1 - if count == 2 then - self.atkTeam:stopRunAction() - self:onRoundEnd(true) - end - end - self.atkTeam:playRunAction() - self.atkTeam:recoverHpOnWaveOver(onFinish) - - isBoss = self.defTeam:getIsBoss() - if isBoss then - local monsterInfo = ConfigManager:getConfig("monster")[monsterId] - self.battleUI:showBossEnterAni(bornTime, ModuleManager.HeroManager:getMonsterName(monsterInfo.monster_base), monsterComp, function() - monsterComp:playEnterBattlefield(true, onFinish) - end) - else - monsterComp:playEnterBattlefield(true, onFinish) - end - else - local count = 0 - local function onFinish() - count = count + 1 - if count == 2 then - self:onRoundEnd(true) - end - end - self.atkTeam:recoverHpOnWaveOver(onFinish) - - isBoss = self.defTeam:getIsBoss() - if isBoss then - local monsterInfo = ConfigManager:getConfig("monster")[monsterId] - self.battleUI:showBossEnterAni(bornTime, ModuleManager.HeroManager:getMonsterName(monsterInfo.monster_base), monsterComp, function() - monsterComp:playEnterBattlefield(false, onFinish) - end) - else - monsterComp:playEnterBattlefield(false, onFinish) - end - end - end) -end - function BattleControllerDailyChallenge:getInitBoard() if not self.boradList then self.boradList = {} self.fixedRandomGrid = {} self.mysteryBoxIndexMap = {} - local config = CHAPTER_CFG[self.chapterId] - local boardCfg = ConfigManager:getConfig("chapter_board_daily_challenge") + local config = self:getChapterConfig()[self.chapterId] + local boardCfg = self:getBoardConfig() for _, boardId in ipairs(config.chapter_board_daily_challenge) do local cfg = boardCfg[boardId] if cfg then @@ -165,51 +82,6 @@ function BattleControllerDailyChallenge:getInitBoard() return self.boradList, self.fixedRandomGrid, self.mysteryBoxIndexMap end -function BattleControllerDailyChallenge:getSealElementType() - if not self.sealElementType then - self.sealElementType = {} - local config = CHAPTER_CFG[self.chapterId] - if config.seal_element then - for _, elementType in ipairs(config.seal_element) do - self.sealElementType[elementType] = true - end - end - end - - return self.sealElementType -end - -function BattleControllerDailyChallenge:getNotInvolvedSkills() - if not self.notInvolvedSkills then - self.notInvolvedSkills = {} - local config = CHAPTER_CFG[self.chapterId] - if config.not_involved_skill then - for _, skillId in ipairs(config.not_involved_skill) do - self.notInvolvedSkills[skillId] = true - end - end - end - - return self.notInvolvedSkills -end - -function BattleControllerDailyChallenge:getFixedRogueSkill() - if not self.fixedRogueSkill then - local config = CHAPTER_CFG[self.chapterId] - if config.involved_skill then - self.fixedRogueSkill = GFunc.getTable(config.involved_skill) - else - self.fixedRogueSkill = {} - end - end - - return self.fixedRogueSkill -end - -function BattleControllerDailyChallenge:findNextDefUnit() - self:_stageGenerateNextMonster() -end - function BattleControllerDailyChallenge:controllBattleEnd() self.combatReport = { battleType = GConst.BattleConst.BATTLE_TYPE.DAILY_CHALLENGE, diff --git a/lua/app/module/battle/controller/battle_controller_dungeon_gold.lua b/lua/app/module/battle/controller/battle_controller_dungeon_gold.lua new file mode 100644 index 00000000..3b1746da --- /dev/null +++ b/lua/app/module/battle/controller/battle_controller_dungeon_gold.lua @@ -0,0 +1,107 @@ +local BattleController = require "app/module/battle/controller/battle_controller" +local BattleControllerDungeonGold = class("BattleControllerDungeonGold", BattleController) + +function BattleControllerDungeonGold:getBoardConfig() + return ConfigManager:getConfig("chapter_board_dungeon_gold") +end + +function BattleControllerDungeonGold:getChapterConfig() + return ConfigManager:getConfig("chapter_dungeon_gold") +end + +function BattleControllerDungeonGold:getChapterId() + return DataManager.DungeonData:getCurFightChapterId() +end + +function BattleControllerDungeonGold:refreshWave() +end + +function BattleControllerDungeonGold:enterRoundBegin(...) + local nextWaveRound = 0 + if self.dungeonGoldMaxRoundCount then + nextWaveRound = (self.waveRoundCount[self.waveIndex] or 0) + 1 + if self.dungeonGoldMaxRoundCount < nextWaveRound then -- 超过最大回合, 直接结算 + self.victory = false + self:postWaveOver(false) + self:battleEnd() + return + end + end + if self.battleUI then + self.battleUI:refreshWave(self.dungeonGoldMaxRoundCount - nextWaveRound + 1, GConst.ATLAS_PATH.COMMON, "common_dec_15") + end + BattleController.enterRoundBegin(self, ...) +end + +-- 不同模块的战斗需要初始化的东西 +function BattleControllerDungeonGold:initOther() + self.dungeonGoldMaxRoundCount = self:getChapterConfig()[self.chapterId].wave_limit or 1 + + if self.battleUI then + self.battleUI:refreshWave(self.dungeonGoldMaxRoundCount, GConst.ATLAS_PATH.COMMON, "common_dec_15") + end +end + +function BattleControllerDungeonGold:controllBattleEnd() + local remainRound = self.dungeonGoldMaxRoundCount - (self.waveRoundCount[1] or 0) + self.combatReport = { + battleType = GConst.BattleConst.BATTLE_TYPE.DUNGEON_GOLD, + wave = self.waveIndex, + victory = self.victory, + remainRound = remainRound, + } + local atkReport = {} + local teamEntity = DataManager.BattleData:getAtkTeam() + local members = teamEntity:getAllMembers() + local totalDamage = 0 + for k, v in pairs(members) do + local report = { + heroId = v:getId(), + dmg = v:getDamageCount(), + } + totalDamage = totalDamage + v:getDamageCount() + table.insert(atkReport, report) + end + self.combatReport.atkReport = atkReport + if not self.victory then + self.combatReport.wave = self.combatReport.wave - 1 + end + local remainingHp = self.defTeam:getMainUnit().unitEntity:getHp() + ModuleManager.DungeonManager:reqEndChallengeGold(self.chapterId, self.combatReport, self.taskProgress, totalDamage, remainingHp) +end + +function BattleControllerDungeonGold:postWaveOver(atkDead, isQuit) + local deathType = BIReport.FIGHT_DEATH_TYPE.SURVIVE + local waveEndType = BIReport.FIGHT_WAVE_END_TYPE.WIN + if atkDead then + if self.isBossWave then + deathType = BIReport.FIGHT_DEATH_TYPE.BOSS_FAIL + else + deathType = BIReport.FIGHT_DEATH_TYPE.NORMAL_FAIL + end + waveEndType = BIReport.FIGHT_WAVE_END_TYPE.FAIL + end + + if isQuit then + waveEndType = BIReport.FIGHT_WAVE_END_TYPE.QUIT + end + + local duration = self.waveDurationTime + local totalTime = self.totalDurationTime + local startTimes = DataManager.DungeonData:getTotalCount(ModuleManager.MODULE_KEY.DUNGEON_GOLD, self.chapterId) + local isFirstWin = false + if DataManager.DungeonData:getPassedMaxId(ModuleManager.MODULE_KEY.DUNGEON_GOLD) < self.chapterId and self.victory then + isFirstWin = true + end + + local isFianlStep = self.waveIndex >= self.maxWaveIndex + + BIReport:postFightEnd(GConst.BattleConst.BATTLE_TYPE.DUNGEON_GOLD, self.chapterId, self.waveIndex, duration, totalTime, self.eliminateCount, self.eliminateTotalCount, waveEndType, deathType, startTimes, isFirstWin, isFianlStep, self.maxLinkCount) +end + +function BattleControllerDungeonGold:postFightStart() + local unlockMaxChapter = DataManager.DungeonData:getUnlockMaxId(ModuleManager.MODULE_KEY.DUNGEON_GOLD) + BIReport:postFightBegin(GConst.BattleConst.BATTLE_TYPE.DUNGEON_GOLD, self.waveIndex, self.chapterId, unlockMaxChapter, DataManager.DungeonData:getTotalCount(ModuleManager.MODULE_KEY.DUNGEON_GOLD, self.chapterId)) +end + +return BattleControllerDungeonGold \ No newline at end of file diff --git a/lua/app/module/battle/controller/battle_controller_dungeon_gold.lua.meta b/lua/app/module/battle/controller/battle_controller_dungeon_gold.lua.meta new file mode 100644 index 00000000..17c51a60 --- /dev/null +++ b/lua/app/module/battle/controller/battle_controller_dungeon_gold.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: f918b2e0ce7132d4bb9f23da30447f0d +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/module/battle/controller/battle_controller_dungeon_shards.lua b/lua/app/module/battle/controller/battle_controller_dungeon_shards.lua new file mode 100644 index 00000000..058ef731 --- /dev/null +++ b/lua/app/module/battle/controller/battle_controller_dungeon_shards.lua @@ -0,0 +1,75 @@ +local BattleController = require "app/module/battle/controller/battle_controller" +local BattleControllerDungeonShards = class("BattleControllerDungeonShards", BattleController) + +function BattleControllerDungeonShards:getBoardConfig() + return ConfigManager:getConfig("chapter_board_dungeon_shards") +end + +function BattleControllerDungeonShards:getChapterConfig() + return ConfigManager:getConfig("chapter_dungeon_shards") +end + +function BattleControllerDungeonShards:getChapterId() + return DataManager.DungeonData:getCurFightChapterId() +end + +function BattleControllerDungeonShards:controllBattleEnd() + self.combatReport = { + battleType = GConst.BattleConst.BATTLE_TYPE.DUNGEON_SHARDS, + wave = self.waveIndex, + victory = self.victory, + } + local atkReport = {} + local teamEntity = DataManager.BattleData:getAtkTeam() + local members = teamEntity:getAllMembers() + local totalDamage = 0 + for k, v in pairs(members) do + local report = { + heroId = v:getId(), + dmg = v:getDamageCount(), + } + totalDamage = totalDamage + v:getDamageCount() + table.insert(atkReport, report) + end + self.combatReport.atkReport = atkReport + if not self.victory then + self.combatReport.wave = self.combatReport.wave - 1 + end + ModuleManager.DungeonManager:reqEndChallengeShards(self.chapterId, self.combatReport, self.taskProgress, totalDamage) +end + +function BattleControllerDungeonShards:postWaveOver(atkDead, isQuit) + local deathType = BIReport.FIGHT_DEATH_TYPE.SURVIVE + local waveEndType = BIReport.FIGHT_WAVE_END_TYPE.WIN + if atkDead then + if self.isBossWave then + deathType = BIReport.FIGHT_DEATH_TYPE.BOSS_FAIL + else + deathType = BIReport.FIGHT_DEATH_TYPE.NORMAL_FAIL + end + waveEndType = BIReport.FIGHT_WAVE_END_TYPE.FAIL + end + + if isQuit then + waveEndType = BIReport.FIGHT_WAVE_END_TYPE.QUIT + end + + local duration = self.waveDurationTime + local totalTime = self.totalDurationTime + local startTimes = DataManager.DungeonData:getTotalCount(ModuleManager.MODULE_KEY.DUNGEON_SHARDS, self.chapterId) + local isFirstWin = false + if DataManager.DungeonData:getPassedMaxId(ModuleManager.MODULE_KEY.DUNGEON_SHARDS) < self.chapterId and self.victory then + isFirstWin = true + end + + local isFianlStep = self.waveIndex >= self.maxWaveIndex + + BIReport:postFightEnd(GConst.BattleConst.BATTLE_TYPE.DUNGEON_SHARDS, self.chapterId, self.waveIndex, duration, totalTime, self.eliminateCount, self.eliminateTotalCount, waveEndType, deathType, startTimes, isFirstWin, isFianlStep, self.maxLinkCount) +end + +function BattleControllerDungeonShards:postFightStart() + local unlockMaxChapter = DataManager.DungeonData:getUnlockMaxId(ModuleManager.MODULE_KEY.DUNGEON_SHARDS) + BIReport:postFightBegin(GConst.BattleConst.BATTLE_TYPE.DUNGEON_SHARDS, self.waveIndex, self.chapterId, unlockMaxChapter, DataManager.DungeonData:getTotalCount(ModuleManager.MODULE_KEY.DUNGEON_SHARDS, self.chapterId)) +end + +return BattleControllerDungeonShards \ No newline at end of file diff --git a/lua/app/module/battle/controller/battle_controller_dungeon_shards.lua.meta b/lua/app/module/battle/controller/battle_controller_dungeon_shards.lua.meta new file mode 100644 index 00000000..c77a89f0 --- /dev/null +++ b/lua/app/module/battle/controller/battle_controller_dungeon_shards.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: f7a7f047a4373bb409eb65b4af05fa01 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/module/battle/controller/battle_controller_stage.lua b/lua/app/module/battle/controller/battle_controller_stage.lua index f0f21360..928b61e3 100644 --- a/lua/app/module/battle/controller/battle_controller_stage.lua +++ b/lua/app/module/battle/controller/battle_controller_stage.lua @@ -1,120 +1,26 @@ -local BattleHelper = require "app/module/battle/helper/battle_helper" - local BattleController = require "app/module/battle/controller/battle_controller" local BattleControllerStage = class("BattleControllerStage", BattleController) +function BattleControllerStage:getBoardConfig() + return ConfigManager:getConfig("chapter_board") +end + +function BattleControllerStage:getChapterConfig() + return ConfigManager:getConfig("chapter") +end + function BattleControllerStage:getChapterId() return DataManager.ChapterData:getChapterId() end -function BattleControllerStage:getMaxWave() - return DataManager.ChapterData:getChapterCfgMaxWave(self.chapterId) -end - -function BattleControllerStage:getBlockIcon() - local chapterInfo = ConfigManager:getConfig("chapter")[self.chapterId] - if not chapterInfo then - return "battle_hinder_4" - end - return chapterInfo.block_icon -end - -function BattleControllerStage:getChessBoardBgName() - local chapterInfo = ConfigManager:getConfig("chapter")[self.chapterId] - if not chapterInfo then - return "chessboard_1" - end - return chapterInfo.chess_board -end - - -function BattleControllerStage:initOther() - -end - -function BattleControllerStage:initDefUnits(callback) - local config = ConfigManager:getConfig("chapter")[self.chapterId] - self.battleUI:loadBg(config.scene) - local unitEntity = DataManager.BattleData:addMonster(config.monster[1]) - local modelId = unitEntity:getModelId() - BattleHelper:loadBattleHeroModel(modelId, self.battleUI:getBattleNode(), function(spineObject) - local monsterComp = spineObject:addLuaComponent(GConst.BattleConst.TYPEOF_LUA_COMP.BATTLE_MONSTER_COMPONENT) - monsterComp:initWithEntity(modelId, unitEntity, self) - self.defTeam:addUnit(monsterComp, true) - self.battleUI:refreshDefHp(unitEntity:getHp(), unitEntity:getHpPercent()) - callback() - end) -end - -function BattleControllerStage:_stageGenerateNextMonster() - local config = ConfigManager:getConfig("chapter")[self.chapterId] - local monsterId = config.monster[self.waveIndex + 1] - if monsterId == nil then - return self:enterNextWave() - end - local isBoss = self.defTeam:getIsBoss() - local unitEntity = DataManager.BattleData:addMonster(monsterId, true) - local modelId = unitEntity:getModelId() - BattleHelper:loadBattleHeroModel(modelId, self.battleUI:getBattleNode(), function(spineObject) - self.defTeam:removeAllUnits() - local monsterComp = spineObject:addLuaComponent(GConst.BattleConst.TYPEOF_LUA_COMP.BATTLE_MONSTER_COMPONENT) - monsterComp:initWithEntity(modelId, unitEntity, self) - self.defTeam:addUnit(monsterComp, true) - self:handleBuffs(GConst.BattleConst.SIDE_DEF) - self.battleUI:refreshDefHp(unitEntity:getHp(), unitEntity:getHpPercent()) - local bornTime = monsterComp:getAnimationDuration(GConst.BattleConst.SPINE_ANIMATION_NAME.BORN) - if isBoss then -- 如果是boss就跑过去 - local count = 0 - local function onFinish() - count = count + 1 - if count == 2 then - self.atkTeam:stopRunAction() - self:onRoundEnd(true) - end - end - self.atkTeam:playRunAction() - self.atkTeam:recoverHpOnWaveOver(onFinish) - - isBoss = self.defTeam:getIsBoss() - if isBoss then - local monsterInfo = ConfigManager:getConfig("monster")[monsterId] - self.battleUI:showBossEnterAni(bornTime, ModuleManager.HeroManager:getMonsterName(monsterInfo.monster_base), monsterComp, function() - monsterComp:playEnterBattlefield(true, onFinish) - end) - else - monsterComp:playEnterBattlefield(true, onFinish) - end - else - local count = 0 - local function onFinish() - count = count + 1 - if count == 2 then - self:onRoundEnd(true) - end - end - self.atkTeam:recoverHpOnWaveOver(onFinish) - - isBoss = self.defTeam:getIsBoss() - if isBoss then - local monsterInfo = ConfigManager:getConfig("monster")[monsterId] - self.battleUI:showBossEnterAni(bornTime, ModuleManager.HeroManager:getMonsterName(monsterInfo.monster_base), monsterComp, function() - monsterComp:playEnterBattlefield(false, onFinish) - end) - else - monsterComp:playEnterBattlefield(false, onFinish) - end - end - end) -end - function BattleControllerStage:getInitBoard() if not self.boradList then self.boradList = {} self.fixedRandomGrid = {} self.mysteryBoxIndexMap = {} - local config = ConfigManager:getConfig("chapter")[self.chapterId] - local boardCfg = ConfigManager:getConfig("chapter_board") + local config = self:getChapterConfig()[self.chapterId] + local boardCfg = self:getBoardConfig() for _, boardId in ipairs(config.board) do local cfg = boardCfg[boardId] if cfg then @@ -135,34 +41,6 @@ function BattleControllerStage:getInitBoard() return self.boradList, self.fixedRandomGrid, self.mysteryBoxIndexMap end -function BattleControllerStage:getSealElementType() - if not self.sealElementType then - self.sealElementType = {} - local config = ConfigManager:getConfig("chapter")[self.chapterId] - if config.seal_element then - for _, elementType in ipairs(config.seal_element) do - self.sealElementType[elementType] = true - end - end - end - - return self.sealElementType -end - -function BattleControllerStage:getNotInvolvedSkills() - if not self.notInvolvedSkills then - self.notInvolvedSkills = {} - local config = ConfigManager:getConfig("chapter")[self.chapterId] - if config.not_involved_skill then - for _, skillId in ipairs(config.not_involved_skill) do - self.notInvolvedSkills[skillId] = true - end - end - end - - return self.notInvolvedSkills -end - function BattleControllerStage:getFixedRogueSkill() if not self.fixedRogueSkill then local config = ConfigManager:getConfig("chapter")[self.chapterId] @@ -176,10 +54,6 @@ function BattleControllerStage:getFixedRogueSkill() return self.fixedRogueSkill end -function BattleControllerStage:findNextDefUnit() - self:_stageGenerateNextMonster() -end - function BattleControllerStage:controllBattleEnd() self.combatReport = { battleType = GConst.BattleConst.BATTLE_TYPE.STAGE, diff --git a/lua/app/module/chapter/chapter_manager.lua b/lua/app/module/chapter/chapter_manager.lua index fc602b5e..0010b04d 100644 --- a/lua/app/module/chapter/chapter_manager.lua +++ b/lua/app/module/chapter/chapter_manager.lua @@ -116,6 +116,8 @@ function ChapterManager:endFightFinish(result) DataManager:tryOpenModules() -- 更新每日挑战数据 ModuleManager.DailyChallengeManager:onResetState() + -- 更新副本活动 + DataManager.DungeonData:setDirty() -- 章节通关 标记可弹出章节礼包 DataManager.ShopData:markPopUpGiftForActChapterStore(maxChapter) ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_PASS_CHAPTER) diff --git a/lua/app/module/dungeon.meta b/lua/app/module/dungeon.meta new file mode 100644 index 00000000..74913bc9 --- /dev/null +++ b/lua/app/module/dungeon.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 120307307c2846141b488d71d9d0a672 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/lua/app/module/dungeon/dungeon_manager.lua b/lua/app/module/dungeon/dungeon_manager.lua new file mode 100644 index 00000000..66a1e8d0 --- /dev/null +++ b/lua/app/module/dungeon/dungeon_manager.lua @@ -0,0 +1,225 @@ +local DungeonManager = class("DungeonManager", BaseModule) + +-- 外部接口-------------------------------------------------------------------------- + +-- 挑战 +function DungeonManager:reqChallenge(module, id) + if module == ModuleManager.MODULE_KEY.DUNGEON_GOLD then + self:reqChallengeGold(id) + elseif module == ModuleManager.MODULE_KEY.DUNGEON_SHARDS then + self:reqChallengeShards(id) + end +end + +-- 结算 +function DungeonManager:reqEndChallenge(module, id) + if module == ModuleManager.MODULE_KEY.DUNGEON_GOLD then + self:reqEndChallengeGold(id) + elseif module == ModuleManager.MODULE_KEY.DUNGEON_SHARDS then + self:reqEndChallengeShards(id) + end +end + +-- 扫荡 +function DungeonManager:reqSweep(module, id) + if module == ModuleManager.MODULE_KEY.DUNGEON_GOLD then + self:reqSweepGold(id) + elseif module == ModuleManager.MODULE_KEY.DUNGEON_SHARDS then + self:reqSweepShards(id) + end +end + +-- 内部接口-------------------------------------------------------------------------- + +function DungeonManager:checkDayChange() + if EDITOR_MODE then + Logger.logHighlight("检查跨天:".. tostring(DataManager.DungeonData:getIfCanReset())) + end + if not DataManager.DungeonData:getIfCanReset() then + return + end + + -- 跨天重置数据 + DataManager.DungeonData:onDayChange() +end + +-- 请求挑战金币副本 +function DungeonManager:reqChallengeGold(id) + local moduleKey = ModuleManager.MODULE_KEY.DUNGEON_GOLD + -- 判断次数 + if DataManager.DungeonData:getRemainTimes(moduleKey) <= 0 then + GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_1)) + return + end + + -- 判断体力 + if not DataManager.DungeonData:isEnoughHp(moduleKey) then + GFunc.showItemNotEnough(GConst.ItemConst.ITEM_ID_VIT) + ModuleManager.CommerceManager:showBuyVitUI() + return + end + + if not DataManager.DungeonData:isCanChallenge(moduleKey) then + return + end + + local parmas = {chapter_gold_id = id} + self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterGoldChallengeStartReq, parmas, {}, self.respChallengeGold, BIReport.ITEM_GET_TYPE.DUNGEON_GOLD_CHALLENGE) +end + +-- 响应挑战金币副本 +function DungeonManager:respChallengeGold(result) + if result.err_code == GConst.ERROR_STR.SUCCESS then + DataManager.DungeonData:onFightCountReduce(ModuleManager.MODULE_KEY.DUNGEON_GOLD) + DataManager.DungeonData:setCurFightChapterId(result.reqData.chapter_gold_id) + ModuleManager.BattleManager:playBattle(GConst.BattleConst.BATTLE_TYPE.DUNGEON_GOLD) + EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.DUNGEON_CHALLENGE) + end +end + +-- 请求结算金币副本 +function DungeonManager:reqEndChallengeGold(id, combatReport, taskProgress, totalDamage, remainingHp) + local parmas = { + win = combatReport.victory, + total_damage = totalDamage, + remaining_hp = remainingHp, + chapter_gold_id = id, + task_stat = taskProgress, + combatReport = combatReport, + } + self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterGoldChallengeSettlementReq, parmas, {}, self.respEndChallengeGold, BIReport.ITEM_GET_TYPE.DUNGEON_GOLD_END) +end + +-- 响应结算金币副本 +function DungeonManager:respEndChallengeGold(result) + if result.err_code == GConst.ERROR_STR.SUCCESS then + DataManager.DungeonData:initDungeonGold(result.gold_challenge) + ModuleManager.BattleManager:showBattleResultUI(GConst.BattleConst.BATTLE_TYPE.DUNGEON_GOLD, result.rewards, result.reqData.combatReport) + end +end + +-- 请求扫荡金币副本 +function DungeonManager:reqSweepGold(id) + local moduleKey = ModuleManager.MODULE_KEY.DUNGEON_GOLD + -- 判断次数 + if DataManager.DungeonData:getRemainTimes(moduleKey) <= 0 then + GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_1)) + return + end + + -- 判断体力 + if not DataManager.DungeonData:isEnoughHp(moduleKey) then + GFunc.showItemNotEnough(GConst.ItemConst.ITEM_ID_VIT) + ModuleManager.CommerceManager:showBuyVitUI() + return + end + + if not DataManager.DungeonData:isCanChallenge(moduleKey) then + return + end + + local parmas = { + chapter_gold_id = id, + } + self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterGoldChallengeFarmReq, parmas, {}, self.respSweepGold, BIReport.ITEM_GET_TYPE.DUNGEON_GOLD_SWEEP) +end + +-- 响应扫荡金币副本 +function DungeonManager:respSweepGold(result) + if result.err_code == GConst.ERROR_STR.SUCCESS then + DataManager.DungeonData:onFightCountReduce(ModuleManager.MODULE_KEY.DUNGEON_GOLD) + GFunc.showRewardBox(result.rewards) + EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.DUNGEON_SWEEP) + end +end + +-- 请求挑战碎片副本 +function DungeonManager:reqChallengeShards(id) + local moduleKey = ModuleManager.MODULE_KEY.DUNGEON_SHARDS + -- 判断次数 + if DataManager.DungeonData:getRemainTimes(moduleKey) <= 0 then + GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_1)) + return + end + + -- 判断体力 + if not DataManager.DungeonData:isEnoughHp(moduleKey) then + GFunc.showItemNotEnough(GConst.ItemConst.ITEM_ID_VIT) + ModuleManager.CommerceManager:showBuyVitUI() + return + end + + if not DataManager.DungeonData:isCanChallenge(moduleKey) then + return + end + + local parmas = {chapter_shards_id = id} + self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterShardsChallengeStartReq, parmas, {}, self.respChallengeShards, BIReport.ITEM_GET_TYPE.DUNGEON_SHARDS_CHALLENGE) +end + +-- 响应挑战碎片副本 +function DungeonManager:respChallengeShards(result) + if result.err_code == GConst.ERROR_STR.SUCCESS then + DataManager.DungeonData:onFightCountReduce(ModuleManager.MODULE_KEY.DUNGEON_SHARDS) + DataManager.DungeonData:setCurFightChapterId(result.reqData.chapter_shards_id) + ModuleManager.BattleManager:playBattle(GConst.BattleConst.BATTLE_TYPE.DUNGEON_SHARDS) + EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.DUNGEON_CHALLENGE) + end +end + +-- 请求结算碎片副本 +function DungeonManager:reqEndChallengeShards(id, combatReport, taskProgress, totalDamage) + local parmas = { + win = true, + total_damage = totalDamage, + chapter_shards_id = id, + task_stat = taskProgress, + combatReport = combatReport, + } + self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterShardsChallengeSettlementReq, parmas, {}, self.respEndChallengeShards, BIReport.ITEM_GET_TYPE.DUNGEON_SHARDS_END) +end + +-- 响应结算碎片副本 +function DungeonManager:respEndChallengeShards(result) + if result.err_code == GConst.ERROR_STR.SUCCESS then + DataManager.DungeonData:initDungeonShards(result.shards_challenge) + ModuleManager.BattleManager:showBattleResultUI(GConst.BattleConst.BATTLE_TYPE.DUNGEON_SHARDS, result.rewards, result.reqData.combatReport) + end +end + +-- 请求扫荡碎片副本 +function DungeonManager:reqSweepShards(id) + local moduleKey = ModuleManager.MODULE_KEY.DUNGEON_SHARDS + -- 判断次数 + if DataManager.DungeonData:getRemainTimes(moduleKey) <= 0 then + GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE_DESC_1)) + return + end + + -- 判断体力 + if not DataManager.DungeonData:isEnoughHp(moduleKey) then + GFunc.showItemNotEnough(GConst.ItemConst.ITEM_ID_VIT) + ModuleManager.CommerceManager:showBuyVitUI() + return + end + + if not DataManager.DungeonData:isCanChallenge(moduleKey) then + return + end + + local parmas = { + chapter_shards_id = id, + } + self:sendMessage(ProtoMsgType.FromMsgEnum.ChapterShardsChallengeFarmReq, parmas, {}, self.respSweepShards, BIReport.ITEM_GET_TYPE.DUNGEON_SHARDS_SWEEP) +end + +-- 响应扫荡碎片副本 +function DungeonManager:respSweepShards(result) + if result.err_code == GConst.ERROR_STR.SUCCESS then + DataManager.DungeonData:onFightCountReduce(ModuleManager.MODULE_KEY.DUNGEON_SHARDS) + GFunc.showRewardBox(result.rewards) + EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.DUNGEON_SWEEP) + end +end + +return DungeonManager \ No newline at end of file diff --git a/lua/app/module/dungeon/dungeon_manager.lua.meta b/lua/app/module/dungeon/dungeon_manager.lua.meta new file mode 100644 index 00000000..622f4e3f --- /dev/null +++ b/lua/app/module/dungeon/dungeon_manager.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 10cc1e2d34182e345b319afee1686513 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/module/maincity/maincity_const.lua b/lua/app/module/maincity/maincity_const.lua index 6bf73be7..1bffbd83 100644 --- a/lua/app/module/maincity/maincity_const.lua +++ b/lua/app/module/maincity/maincity_const.lua @@ -18,6 +18,7 @@ MainCityConst.BOTTOM_CLOSE_ICON = { MainCityConst.MAIN_MODULE = { DAILY_CHALLENGE = 1, CHAPTER = 2, + DUNGEON = 3, } MainCityConst.LEFT_SIDE_BARS = { diff --git a/lua/app/ui/battle/battle_result_ui.lua b/lua/app/ui/battle/battle_result_ui.lua index b61b9086..5e20ad50 100644 --- a/lua/app/ui/battle/battle_result_ui.lua +++ b/lua/app/ui/battle/battle_result_ui.lua @@ -95,6 +95,15 @@ function BattleResultUI:refreshFixedInfo() desc3:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_7, GFunc.num2Str(self.totalDmg))) rewardTitle:setText(I18N:getGlobalText(I18N.GlobalConst.REWARD_DESC)) continue:setText(I18N:getGlobalText(I18N.GlobalConst.CONTINUE_DESC)) + + local iconName = "common_dec_3" + if self.battleType == GConst.BattleConst.BATTLE_TYPE.DUNGEON_GOLD then + iconName = "common_dec_15" + local round = self.combatReport.remainRound or 0 + desc2:setText(round) + end + icon:setSprite(GConst.ATLAS_PATH.COMMON, iconName) + GFunc.centerImgAndTx(icon, desc2, 7) end diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index 2f978be5..d62dfcb4 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -1674,12 +1674,16 @@ function BattleUI:refreshLv() self.lastLv = lv end -function BattleUI:refreshWave(wave) +function BattleUI:refreshWave(wave, iconAtlas, iconName) local uiMap = self.root:genAllChildren() local icon = uiMap["battle_ui.top_node.wave_icon"] local desc = uiMap["battle_ui.top_node.wave_desc"] desc:setText(wave) GFunc.centerImgAndTx(icon, desc, 10) + + iconAtlas = iconAtlas or GConst.ATLAS_PATH.COMMON + iconName = iconName or "common_dec_3" + icon:setSprite(iconAtlas, iconName) end function BattleUI:refreshTaskBtn() diff --git a/lua/app/ui/dungeon.meta b/lua/app/ui/dungeon.meta new file mode 100644 index 00000000..55309697 --- /dev/null +++ b/lua/app/ui/dungeon.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c079de69e6c30a0438fa6e6a4f405800 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/lua/app/ui/dungeon/dungeon_board_cell.lua b/lua/app/ui/dungeon/dungeon_board_cell.lua new file mode 100644 index 00000000..b060a4be --- /dev/null +++ b/lua/app/ui/dungeon/dungeon_board_cell.lua @@ -0,0 +1,124 @@ +local DungeonBoardCell = class("DungeonBoardCell", BaseCell) + +function DungeonBoardCell:init() + self.uiMap = self:getUIMap() + + self.txTitle = self.uiMap["dungeon_board_cell.tx_title"] + self.countdown = self.uiMap["dungeon_board_cell.countdown"] + self.txCountdown = self.uiMap["dungeon_board_cell.countdown.tx_countdown"] + self.txOpen = self.uiMap["dungeon_board_cell.tx_open"] + self.lock = self.uiMap["dungeon_board_cell.lock"] + self.lockIcon = self.uiMap["dungeon_board_cell.lock.desc.icon"] + self.lockTxLock = self.uiMap["dungeon_board_cell.lock.desc.tx_lock"] + self.lockIconCountdown = self.uiMap["dungeon_board_cell.lock.countdown.icon"] + self.lockTxCountdown = self.uiMap["dungeon_board_cell.lock.countdown.tx_countdown"] + self.btnStart = self.uiMap["dungeon_board_cell.btn_start"] + self.txStart = self.uiMap["dungeon_board_cell.btn_start.tx_btn"] + self.txTimes = self.uiMap["dungeon_board_cell.btn_start.tx_times"] + self.btnHelp = self.uiMap["dungeon_board_cell.btn_help"] + self.itemReward = self.uiMap["dungeon_board_cell.item_reward"] + self.itemRewardIcon = self.uiMap["dungeon_board_cell.item_reward.icon"] + + self.btnStart:addClickListener(function() + -- 打开副本关卡选择界面 + UIManager:showUI("app/ui/dungeon/dungeon_difficulty_ui", {module = self.moduleKey}) + end) + self.btnHelp:addClickListener(function() + -- 展示提示 + ModuleManager.TipsManager:showDescTips(DataManager.DungeonData:getRule(self.moduleKey), self.btnHelp) + end) +end + +function DungeonBoardCell:refresh(moduleKey) + self.moduleKey = moduleKey + + self:refreshInfo() + self:refreshRewards() +end + +function DungeonBoardCell:refreshInfo() + self.txTitle:setText(DataManager.DungeonData:getTitle(self.moduleKey)) + self.txOpen:setText("" .. DataManager.DungeonData:getOpenTimeDesc(self.moduleKey) .. "") + self.baseObject:setTexture(DataManager.DungeonData:getBanner(self.moduleKey)) + + if DataManager.DungeonData:isActive(self.moduleKey) then + self.btnStart:setVisible(true) + self.countdown:setVisible(true) + self.lock:setVisible(false) + + -- 红点 + if DataManager.DungeonData:isCanChallenge(self.moduleKey) then + self.btnStart:addRedPoint(110, 40, 0.6) + else + self.btnStart:removeRedPoint() + end + + self.txOpen:setAnchoredPositionY(-110) + self.txStart:setText(I18N:getGlobalText(I18N.GlobalConst.START_DESC)) + local time = DataManager.DungeonData:getRemainTimes(self.moduleKey) + local timeStr = nil + if time <= 0 then + timeStr = ":" .. time .. "" + else + timeStr = ":" .. time + end + self.txTimes:setText(I18N:getGlobalText(I18N.GlobalConst.TODAY_REMAIN_TIMES, timeStr)) + self:refreshCountdown(self.txCountdown) + else + self.btnStart:setVisible(false) + self.countdown:setVisible(false) + self.lock:setVisible(true) + + self.txOpen:setAnchoredPositionY(-75) + self.lockTxLock:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_OPEN)) + self:refreshCountdown(self.lockTxCountdown) + end + + GFunc.centerImgAndTx(self.lockIcon, self.lockTxLock, 10) + GFunc.centerImgAndTx(self.lockIconCountdown, self.lockTxCountdown, 10) +end + +function DungeonBoardCell:refreshRewards() + local reward = DataManager.DungeonData:getBoardShowRewardId(self.moduleKey) + if reward ~= nil then + -- 展示实际item + local info = ConfigManager:getConfig("item")[reward] + if info == nil then + return + end + + self.itemRewardIcon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, info.icon) + self.itemReward:setTouchEnable(true) + self.itemReward:addClickListener(function() + ModuleManager.TipsManager:showRewardTips(reward, info.type, self.itemReward) + end) + else + reward = DataManager.DungeonData:getBoardShowRewardIcon(self.moduleKey) + -- 展示icon图片 + self.itemRewardIcon:setSprite(reward[1], reward[2]) + self.itemReward:setTouchEnable(false) + end +end + +function DungeonBoardCell:refreshCountdown(txCountdown) + if self.countdownSid then + SchedulerManager:unscheduleGlobal(self.countdownSid) + self.countdownSid = nil + end + self.countdownSid = txCountdown:scheduleGlobal(function() + self:updateTime(txCountdown) + end, 1) + self:updateTime(txCountdown) +end + +function DungeonBoardCell:updateTime(txCountdown) + if self.remainTime == nil or self.remainTime < 0 then + self.remainTime = DataManager.DungeonData:geNextTime(self.moduleKey) + else + self.remainTime = self.remainTime - 1 + end + + txCountdown:setText(GFunc.getTimeStrWithHMS(self.remainTime)) +end + +return DungeonBoardCell \ No newline at end of file diff --git a/lua/app/ui/dungeon/dungeon_board_cell.lua.meta b/lua/app/ui/dungeon/dungeon_board_cell.lua.meta new file mode 100644 index 00000000..5eafd3e5 --- /dev/null +++ b/lua/app/ui/dungeon/dungeon_board_cell.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 42e0b145611148845b047bd6359e9f4e +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/ui/dungeon/dungeon_difficulty_ui.lua b/lua/app/ui/dungeon/dungeon_difficulty_ui.lua new file mode 100644 index 00000000..684fd7c1 --- /dev/null +++ b/lua/app/ui/dungeon/dungeon_difficulty_ui.lua @@ -0,0 +1,208 @@ +local DungeonDifficultyUI = class("DungeonDifficultyUI", BaseUI) + +function DungeonDifficultyUI:isFullScreen() + return false +end + +function DungeonDifficultyUI:getPrefabPath() + return "assets/prefabs/ui/dungeon/dungeon_difficulty_ui.prefab" +end + +function DungeonDifficultyUI:ctor(params) + self.module = params.module + self.curId = DataManager.DungeonData:getUnlockMaxId(self.module) +end + +function DungeonDifficultyUI:onCover() +end + +function DungeonDifficultyUI:onReshow() +end + +function DungeonDifficultyUI:onClose() +end + +function DungeonDifficultyUI:onLoadRootComplete() + self.uiMap = self.root:genAllChildren() + + self.icon = self.uiMap["dungeon_difficulty_ui.bg.title.icon_title"] + self.btnClose = self.uiMap["dungeon_difficulty_ui.bg.close_btn"] + self.btnStart = self.uiMap["dungeon_difficulty_ui.bg.btns.btn_start"] + self.txStart = self.uiMap["dungeon_difficulty_ui.bg.btns.btn_start.tx_start"] + self.txStartCost = self.uiMap["dungeon_difficulty_ui.bg.btns.btn_start.cost.tx_cost"] + self.btnSweep = self.uiMap["dungeon_difficulty_ui.bg.btns.btn_sweep"] + self.txSweep = self.uiMap["dungeon_difficulty_ui.bg.btns.btn_sweep.tx_sweep"] + self.txSweepCost = self.uiMap["dungeon_difficulty_ui.bg.btns.btn_sweep.cost.tx_cost"] + self.txTime = self.uiMap["dungeon_difficulty_ui.bg.btns.tx_time"] + self.txDifficulty = self.uiMap["dungeon_difficulty_ui.bg.select.chapter.tx_difficulty"] + self.txLevel = self.uiMap["dungeon_difficulty_ui.bg.select.chapter.tx_level"] + self.arrowLeft = self.uiMap["dungeon_difficulty_ui.bg.select.chapter.arrow_left"] + self.arrowRight = self.uiMap["dungeon_difficulty_ui.bg.select.chapter.arrow_right"] + self.txDesc = self.uiMap["dungeon_difficulty_ui.bg.tx_desc"] + self.txTitle = self.uiMap["dungeon_difficulty_ui.bg.title.title_text"] + self.buffObj = self.uiMap["dungeon_difficulty_ui.bg.boss_buff"] + self.txbuff = self.uiMap["dungeon_difficulty_ui.bg.boss_buff.tx_buff"] + self.iconBuff = self.uiMap["dungeon_difficulty_ui.bg.boss_buff.icon_buff"] + self.rewardTx = self.uiMap["dungeon_difficulty_ui.bg.reward_desc"] + self.rewardFirst = self.uiMap["dungeon_difficulty_ui.bg.rewards.reward_first"] + self.rewardFirstIcon = self.uiMap["dungeon_difficulty_ui.bg.rewards.reward_first.icon"] + self.rewardFirstNum = self.uiMap["dungeon_difficulty_ui.bg.rewards.reward_first.num"] + self.rewardPass = self.uiMap["dungeon_difficulty_ui.bg.rewards.reward_pass"] + self.rewardPassIcon = self.uiMap["dungeon_difficulty_ui.bg.rewards.reward_pass.icon"] + self.rewardPassNum = self.uiMap["dungeon_difficulty_ui.bg.rewards.reward_pass.num"] + self.txFrist = self.uiMap["dungeon_difficulty_ui.bg.rewards.reward_first.tx_first"] + self.txLock = self.uiMap["dungeon_difficulty_ui.bg.tx_lock"] + self.btnGroup = self.uiMap["dungeon_difficulty_ui.bg.btns"] + + local iconPath = DataManager.DungeonData:getIcon(self.module) + self.icon:setSprite(iconPath[1], iconPath[2], function() + self.icon:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE):SetNativeSize() + end) + self.txTitle:setText(DataManager.DungeonData:getTitle(self.module)) + self.txDifficulty:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_STAGE)) + self.txStart:setText(I18N:getGlobalText(I18N.GlobalConst.START_DESC)) + self.txSweep:setText(I18N:getGlobalText(I18N.GlobalConst.SMASH)) + local cost = DataManager.DungeonData:getChallengeHpCost(self.module) + self.txStartCost:setText(GFunc.getRewardNum(cost)) + self.txSweepCost:setText(GFunc.getRewardNum(cost)) + + local time = DataManager.DungeonData:getRemainTimes(self.module) + local timeStr = nil + if time <= 0 then + timeStr = ":" .. time .. "" + else + timeStr = ":" .. time + end + self.txTime:setText(I18N:getGlobalText(I18N.GlobalConst.TODAY_REMAIN_TIMES, timeStr)) + self.txFrist:setText(I18N:getGlobalText(I18N.GlobalConst.FIRST_PASS)) + self.rewardTx:setText(I18N:getGlobalText(I18N.GlobalConst.REWARD_DESC)..":") + self.txLock:setText(I18N:getGlobalText(I18N.GlobalConst.PASS_REQUIRE)) + + self:refreshDifficulty() + + self.btnClose:addClickListener(function() + self:closeUI() + end) + self.btnStart:addClickListener(function() + -- 开始挑战 + ModuleManager.DungeonManager:reqChallenge(self.module, self.curId) + end) + self.btnSweep:addClickListener(function() + -- 开始扫荡 + ModuleManager.DungeonManager:reqSweep(self.module, self.curId) + end) + self.arrowLeft:addClickListener(function() + if self:isMinId() then + return + end + + self.curId = self.curId - 1 + self:refreshDifficulty() + end) + self.arrowRight:addClickListener(function() + if self:isMaxId() then + return + end + + self.curId = self.curId + 1 + self:refreshDifficulty() + end) + + self:addEventListener(EventManager.CUSTOM_EVENT.DUNGEON_CHALLENGE, function() + self:closeUI() + end) + self:addEventListener(EventManager.CUSTOM_EVENT.DUNGEON_SWEEP, function() + self:closeUI() + end) +end + +function DungeonDifficultyUI:refreshDifficulty() + self.btnSweep:setActive(self:isCanSweepId()) + self.txLevel:setText(tostring(self.curId)) + + -- buff or desc + local buff = DataManager.DungeonData:getBossBuff(self.module, self.curId) + local desc = DataManager.DungeonData:getRule(self.module) + if buff then + local cfg = ConfigManager:getConfigWithOtherKey("buff", "name")[buff.type] + self.txDesc:setActive(false) + self.buffObj:setActive(true) + self.txbuff:setText(I18N:getGlobalText(I18N.GlobalConst.DUNGEON_DESC)) + self.iconBuff:setSprite(GConst.ATLAS_PATH.ICON_BUFF, cfg.icon) + self.iconBuff:addClickListener(function() + ModuleManager.TipsManager:showDescTips(GFunc.getBuffDesc(buff.type, buff.num), self.iconBuff) + end) + elseif desc then + self.txDesc:setActive(true) + self.buffObj:setActive(false) + self.txDesc:setText(desc) + else + self.txDesc:setActive(false) + self.buffObj:setActive(false) + end + + -- 箭头 + self.txLock:setActive(not self:isCanChallengeId()) + self.btnGroup:setActive(self:isCanChallengeId()) + self.arrowRight:setActive(not self:isMaxId()) + self.arrowLeft:setActive(not self:isMinId()) + + -- 奖励 + local reward = DataManager.DungeonData:getBoardShowRewardId(self.module) + if reward ~= nil then + -- 展示实际item + local info = ConfigManager:getConfig("item")[reward] + if info == nil then + return + end + + self.rewardFirstIcon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, info.icon) + self.rewardPassIcon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, info.icon) + self.rewardFirst:setTouchEnable(true) + self.rewardPass:setTouchEnable(true) + self.rewardFirst:addClickListener(function() + ModuleManager.TipsManager:showRewardTips(reward, info.type, self.rewardFirst) + end) + self.rewardPass:addClickListener(function() + ModuleManager.TipsManager:showRewardTips(reward, info.type, self.rewardPass) + end) + else + reward = DataManager.DungeonData:getBoardShowRewardIcon(self.module) + -- 展示icon图片 + self.rewardFirstIcon:setSprite(reward[1], reward[2]) + self.rewardPassIcon:setSprite(reward[1], reward[2]) + self.rewardFirst:setTouchEnable(false) + self.rewardPass:setTouchEnable(false) + end + local firstNum = DataManager.DungeonData:getFirstRewardNum(self.module, self.curId) + local passNum = DataManager.DungeonData:getPassRewardNum(self.module, self.curId) + if not self:isCanSweepId() and firstNum then + self.rewardFirst:setActive(true) + self.rewardFirstNum:setText(firstNum) + else + self.rewardFirst:setActive(false) + end + self.rewardPassNum:setText(passNum) +end + +-- 是否是可扫荡关卡 +function DungeonDifficultyUI:isCanSweepId() + return self.curId < DataManager.DungeonData:getUnlockMaxId(self.module) +end + +--是否是可挑战关卡 +function DungeonDifficultyUI:isCanChallengeId() + return self.curId <= DataManager.DungeonData:getUnlockMaxId(self.module) +end + +-- 是最大副本id +function DungeonDifficultyUI:isMaxId() + return self.curId == DataManager.DungeonData:getConfigMaxId(self.module) +end + +--是最小关卡 +function DungeonDifficultyUI:isMinId() + return self.curId == 1 +end + +return DungeonDifficultyUI \ No newline at end of file diff --git a/lua/app/ui/dungeon/dungeon_difficulty_ui.lua.meta b/lua/app/ui/dungeon/dungeon_difficulty_ui.lua.meta new file mode 100644 index 00000000..77f4cfb7 --- /dev/null +++ b/lua/app/ui/dungeon/dungeon_difficulty_ui.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 93a0a9d95d4774c49b001c3108e5a61c +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/ui/main_city/component/chapter_comp.lua b/lua/app/ui/main_city/component/chapter_comp.lua index 004f252e..7f5d55f3 100644 --- a/lua/app/ui/main_city/component/chapter_comp.lua +++ b/lua/app/ui/main_city/component/chapter_comp.lua @@ -12,11 +12,15 @@ function ChapterComp:getIsOpen() end function ChapterComp:getEntranceName() - return "主线章节" + return I18N:getGlobalText(I18N.GlobalConst.MAIN_CHAPTER) end function ChapterComp:getEntranceIcon() - return GConst.ATLAS_PATH.COMMON,"common_dec_1" + return GConst.ATLAS_PATH.MAIN,"main_dec_5" +end + +function ChapterComp:getEntranceBg() + return GConst.ATLAS_PATH.MAIN,"main_btn_ringt" end function ChapterComp:getHpCost() diff --git a/lua/app/ui/main_city/component/daily_challenge_comp.lua b/lua/app/ui/main_city/component/daily_challenge_comp.lua index 4c59f52d..038c0a81 100644 --- a/lua/app/ui/main_city/component/daily_challenge_comp.lua +++ b/lua/app/ui/main_city/component/daily_challenge_comp.lua @@ -6,13 +6,17 @@ function DailyChallengeComp:getIsOpen() end function DailyChallengeComp:getEntranceName() - return "每日挑战" + return I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE) end function DailyChallengeComp:getEntranceIcon() return GConst.ATLAS_PATH.MAIN,"main_dec_1" end +function DailyChallengeComp:getEntranceBg() + return GConst.ATLAS_PATH.MAIN,"main_btn_ligth" +end + function DailyChallengeComp:getShowEntranceRedPoint() return DataManager.DailyChallengeData:isMeetChallenge() end @@ -137,7 +141,7 @@ end function DailyChallengeComp:updateTime() ModuleManager.DailyChallengeManager:checkDayChange() - local remainTime = DataManager.DailyChallengeData:getTodaySurplusTime() + local remainTime = Time:getTodaySurplusTime() self.countdownTx:setText(GFunc.getTimeStrWithHMS(remainTime)) end diff --git a/lua/app/ui/main_city/component/dungeon_comp.lua b/lua/app/ui/main_city/component/dungeon_comp.lua new file mode 100644 index 00000000..192883ae --- /dev/null +++ b/lua/app/ui/main_city/component/dungeon_comp.lua @@ -0,0 +1,66 @@ +local MainCompBaseCell = require "app/ui/main_city/component/main_comp_base_cell" +local DungeonComp = class("DungeonComp", MainCompBaseCell) + +function DungeonComp:getIsOpen() + return DataManager.DungeonData:isOpenAnyone() +end + +function DungeonComp:getEntranceName() + return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_BTN) +end + +function DungeonComp:getEntranceIcon() + return GConst.ATLAS_PATH.MAIN,"main_dec_2" +end + +function DungeonComp:getEntranceBg() + return GConst.ATLAS_PATH.MAIN,"main_btn_ringt" +end + +function DungeonComp:getShowEntranceRedPoint() + return DataManager.DungeonData:isCanChallengeAnyone() +end + +function DungeonComp:ctor() +end + +function DungeonComp:init() + self.uiMap = self:getBaseObject():genAllChildren() + + self.scrollRect = self.uiMap["dungeon_comp.scrollrect"] + self.scrollRectComp = self.scrollRect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE) + self.scrollRectComp:addInitCallback(function() + return "app/ui/dungeon/dungeon_board_cell" + end) + self.scrollRectComp:addRefreshCallback(function(index, cell) + cell:refresh(self.openDungeons[index]) + end) + self.scrollRectComp:clearCells() + self.scrollRectComp:setTotalCount(0) + self:refreshShow() +end + +function DungeonComp:refreshShow() + if EDITOR_MODE then + Logger.logHighlight("更新副本显示."..tostring(Time:getTodaySurplusTime())) + end + self.openDungeons = DataManager.DungeonData:getOpenDungeons() + if self.scrollRectComp:getTotalCount() ~= #self.openDungeons then + self.scrollRectComp:clearCells() + self.scrollRectComp:refillCells(#self.openDungeons) + else + self.scrollRectComp:updateAllCell() + end + + -- 跨天定时器 + if self.countdownSid then + SchedulerManager:unscheduleGlobal(self.countdownSid) + self.countdownSid = nil + end + self.countdownSid = self:getBaseObject():scheduleGlobal(function() + ModuleManager.DungeonManager:checkDayChange() + end, Time:getTodaySurplusTime() + 1) + +end + +return DungeonComp \ No newline at end of file diff --git a/lua/app/ui/main_city/component/dungeon_comp.lua.meta b/lua/app/ui/main_city/component/dungeon_comp.lua.meta new file mode 100644 index 00000000..f7d453b9 --- /dev/null +++ b/lua/app/ui/main_city/component/dungeon_comp.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: eeb42cdacecfcf4468aecedc8d7cd340 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/ui/main_city/component/main_comp.lua b/lua/app/ui/main_city/component/main_comp.lua index 843351c0..0bad81ea 100644 --- a/lua/app/ui/main_city/component/main_comp.lua +++ b/lua/app/ui/main_city/component/main_comp.lua @@ -1,15 +1,15 @@ local MainComp = class("MainComp", LuaComponent) local CHAPTER_COMP = "app/ui/main_city/component/chapter_comp" local DAILY_CHALLENGE_COMP = "app/ui/main_city/component/daily_challenge_comp" +local DUNGEON_COMP = "app/ui/main_city/component/dungeon_comp" local BOTTOM_HEIGHT = 120 function MainComp:init() self.uiMap = self:getBaseObject():genAllChildren() - self:refreshModule(ModuleManager.MaincityManager:getCurModule()) self:initStageFormation() - + self:refreshModule(ModuleManager.MaincityManager:getCurModule()) end function MainComp:refreshModule(selectModule) @@ -25,31 +25,36 @@ function MainComp:refreshModule(selectModule) self.dailyChallengeComp = CellManager:addCellComp(dailyChallengeComp, DAILY_CHALLENGE_COMP) self.dailyChallengeComp:initWithParentUI(self) self.moduleMap[GConst.MainCityConst.MAIN_MODULE.DAILY_CHALLENGE] = self.dailyChallengeComp + -- 活动副本 + local dungeonComp = self.uiMap["main_comp.dungeon_comp"] + self.dungeonComp = CellManager:addCellComp(dungeonComp, DUNGEON_COMP) + self.dungeonComp:initWithParentUI(self) + self.moduleMap[GConst.MainCityConst.MAIN_MODULE.DUNGEON] = self.dungeonComp end if self.curModuleType ~= selectModule then self.curModuleType = selectModule ModuleManager.MaincityManager:setCurModule(self.curModuleType) + self:setFormationVisible(true) + if self.curModuleType == GConst.MainCityConst.MAIN_MODULE.CHAPTER then -- 切换到主线章节 - EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.GO_CHAPTER) elseif self.curModuleType == GConst.MainCityConst.MAIN_MODULE.DAILY_CHALLENGE then -- 切换到每日挑战 - EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.GO_DAILY_CHALLENGE) if not DataManager.TutorialData:getIsInTutorial() and DataManager.DailyChallengeData:getIsPopTask() then ModuleManager.DailyChallengeManager:showBattleTaskUI() end + elseif self.curModuleType == GConst.MainCityConst.MAIN_MODULE.DUNGEON then + -- 切换到活动副本 + self:setFormationVisible(false) end + EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.CHANGE_MAIN_COMP_MODULE, self.curModuleType) end for idx, cell in pairs(self.moduleMap) do cell:getBaseObject():setActive(self.curModuleType == idx) end - local heroBg = self.uiMap["main_comp.hero_bg"] - local heroBgPosY = heroBg:fastGetAnchoredPositionY() - local sWidth, sHeight = GFunc.getUIExpandScreenSize() - local hSHeight = sHeight / 2 - self.btnPosY = (heroBgPosY + (BOTTOM_HEIGHT / 2 - hSHeight)) / 2 + self:refreshBtns() end @@ -62,17 +67,18 @@ end function MainComp:refreshFightBtn() local moduleCell = self.moduleMap[self.curModuleType] - self.uiMap["main_comp.fight_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.START_DESC)) local cost = moduleCell:getHpCost() if cost then + self.uiMap["main_comp.fight_btn"]:setActive(true) + self.uiMap["main_comp.fight_btn"]:addClickListener(moduleCell.onClickFight) + self.uiMap["main_comp.fight_btn"]:setAnchoredPositionY(self.btnPosY) + self.uiMap["main_comp.fight_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.START_DESC)) self.uiMap["main_comp.fight_btn.desc_2"]:setText(GFunc.getRewardNum(cost)) else - self.uiMap["main_comp.fight_btn.desc_2"]:setText("0") + self.uiMap["main_comp.fight_btn"]:setActive(false) + return end - self.uiMap["main_comp.fight_btn"]:addClickListener(moduleCell.onClickFight) - self.uiMap["main_comp.fight_btn"]:setAnchoredPositionY(self.btnPosY) - local remainCount = moduleCell:getTodayRemainCount() if remainCount >= 0 then self.uiMap["main_comp.fight_btn.num_tx"]:setActive(true) @@ -99,9 +105,13 @@ function MainComp:refreshLeftBtn() end self.leftBtn:setActive(true) + local bgAtlas, bgName = moduleCell:getEntranceBg() + self.uiMap["main_comp.left_btn.bg"]:setSprite(bgAtlas, bgName) local iconAtlas, iconName = moduleCell:getEntranceIcon() self.uiMap["main_comp.left_btn.desc"]:setText(moduleCell:getEntranceName()) - self.uiMap["main_comp.left_btn.icon"]:setSprite(iconAtlas, iconName) + self.uiMap["main_comp.left_btn.icon"]:setSprite(iconAtlas, iconName, function() + self.uiMap["main_comp.left_btn.icon"]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE):SetNativeSize() + end) self.leftBtn:addClickListener(function() self:refreshModule(leftIdx) end) @@ -129,9 +139,13 @@ function MainComp:refreshRightBtn() end self.rightBtn:setActive(true) + local bgAtlas, bgName = moduleCell:getEntranceBg() + self.uiMap["main_comp.right_btn.bg"]:setSprite(bgAtlas, bgName) local iconAtlas, iconName = moduleCell:getEntranceIcon() self.uiMap["main_comp.right_btn.desc"]:setText(moduleCell:getEntranceName()) - self.uiMap["main_comp.right_btn.icon"]:setSprite(iconAtlas, iconName) + self.uiMap["main_comp.right_btn.icon"]:setSprite(iconAtlas, iconName, function() + self.uiMap["main_comp.right_btn.icon"]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE):SetNativeSize() + end) self.rightBtn:addClickListener(function() self:refreshModule(rightIdx) end) @@ -151,7 +165,7 @@ function MainComp:getCurLeftModuleIdx() end function MainComp:getCurRightModuleIdx() - local totalModuleNum = GFunc.getTableLength(GConst.MainCityConst.MAIN_MODULE) + local totalModuleNum = table.nums(GConst.MainCityConst.MAIN_MODULE) if self.curModuleType == totalModuleNum then return nil end @@ -167,6 +181,16 @@ function MainComp:initStageFormation() self.uiMap["main_comp.hero_bg.hero_cell_4"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL), self.uiMap["main_comp.hero_bg.hero_cell_5"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL), } + + self.heroFormation = self.uiMap["main_comp.hero_bg"] + local heroBgPosY = self.heroFormation:fastGetAnchoredPositionY() + local sWidth, sHeight = GFunc.getUIExpandScreenSize() + local hSHeight = sHeight / 2 + self.btnPosY = (heroBgPosY + (BOTTOM_HEIGHT / 2 - hSHeight)) / 2 +end + +function MainComp:setFormationVisible(visible) + self.heroFormation:setVisible(visible) end function MainComp:refresh() @@ -187,6 +211,11 @@ function MainComp:refreshChallenge() self.dailyChallengeComp:refreshShow() end +function MainComp:refreshDungeon() + self:refreshBtns() + self.dungeonComp:refreshShow() +end + function MainComp:refreshStageFormaion() local formation = DataManager.FormationData:getStageFormation() for i, heroCell in ipairs(self.heroCells) do diff --git a/lua/app/ui/main_city/component/main_comp_base_cell.lua b/lua/app/ui/main_city/component/main_comp_base_cell.lua index 99255a0f..5ade76df 100644 --- a/lua/app/ui/main_city/component/main_comp_base_cell.lua +++ b/lua/app/ui/main_city/component/main_comp_base_cell.lua @@ -15,12 +15,16 @@ function MainCompBaseCell:getEntranceIcon() return "","" end +function MainCompBaseCell:getEntranceBg() + return "","" +end + function MainCompBaseCell:getShowEntranceRedPoint() return false end function MainCompBaseCell:getHpCost() - return 0 + return nil-- 默认不显示挑战按钮 end function MainCompBaseCell:getTodayRemainCount() diff --git a/lua/app/ui/main_city/main_city_ui.lua b/lua/app/ui/main_city/main_city_ui.lua index 088a2011..f9ab2d28 100644 --- a/lua/app/ui/main_city/main_city_ui.lua +++ b/lua/app/ui/main_city/main_city_ui.lua @@ -19,8 +19,6 @@ MainCityUI.CLICK_BTN_TYPE = { [3] = "SHOP", } -local MAIN_COMP_INDEX = 1 - function MainCityUI:getUIType() return UIManager.UI_TYPE.MAIN end @@ -35,7 +33,7 @@ function MainCityUI:getCurrencyParams() itemIds = {} } end - self.selectedIndex = self.selectedIndex or MAIN_COMP_INDEX + self.selectedIndex = self.selectedIndex or GConst.MainCityConst.BOTTOM_PAGE.MAIN self.currencyParams.showType = GConst.CURRENCY_TYPE.HORIZONTAL for k, v in ipairs(self.currencyParams.itemIds) do table.remove(self.currencyParams.itemIds) @@ -158,18 +156,8 @@ function MainCityUI:_addListeners() end end) - self:addEventListener(EventManager.CUSTOM_EVENT.GO_DAILY_CHALLENGE, function() - if self.selectedIndex ~= GConst.MainCityConst.BOTTOM_PAGE.MAIN then - return - end - self:refreshBounty() - end) - - self:addEventListener(EventManager.CUSTOM_EVENT.GO_CHAPTER, function() - if self.selectedIndex ~= GConst.MainCityConst.BOTTOM_PAGE.MAIN then - return - end - self:refreshBounty() + self:addEventListener(EventManager.CUSTOM_EVENT.CHANGE_MAIN_COMP_MODULE, function(module) + self:switchMainCompModule(module) end) DataManager.MailData:checkNewMail() end @@ -248,6 +236,14 @@ function MainCityUI:_bind() end end end) + + self:bind(DataManager.DungeonData, "isDirty", function() + if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN then + if self.subComps[self.selectedIndex] then + self.subComps[self.selectedIndex]:refreshDungeon() + end + end + end) end function MainCityUI:initBottomUI() @@ -319,7 +315,7 @@ function MainCityUI:refreshBottom(selectedIndex, playAnim) return end local oldIndex = self.selectedIndex - self.selectedIndex = selectedIndex and selectedIndex or MAIN_COMP_INDEX + self.selectedIndex = selectedIndex and selectedIndex or GConst.MainCityConst.BOTTOM_PAGE.MAIN self:switchComp() if oldIndex ~= selectedIndex then @@ -703,17 +699,37 @@ function MainCityUI:switchComp(index) end end self:updateCurrencyBar() - if self.selectedIndex == MAIN_COMP_INDEX then + if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN then self:checkMainPop() - self:setTopNodeVisible(true) self:refreshTopNode() - self:setSideBarVisible(true) + self:switchMainCompModule() else self:setTopNodeVisible(false) self:setSideBarVisible(false) end end +-- 切换主界面活动模块 +function MainCityUI:switchMainCompModule(moduleKey) + if self.selectedIndex ~= GConst.MainCityConst.BOTTOM_PAGE.MAIN then + return + end + + if moduleKey == nil then + moduleKey = self.subComps[self.selectedIndex]:getCurModuleType() + end + + if moduleKey == GConst.MainCityConst.MAIN_MODULE.DUNGEON then + -- 活动副本切换刷新 + self:setTopNodeVisible(false) + self:setSideBarVisible(false) + else + self:setTopNodeVisible(true) + self:setSideBarVisible(true) + self:refreshBounty() + end +end + function MainCityUI:updateTime() if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.SHOP and self.subComps[self.selectedIndex] then if self.subComps[self.selectedIndex] then diff --git a/lua/app/userdata/daily_challenge/daily_challenge_data.lua b/lua/app/userdata/daily_challenge/daily_challenge_data.lua index cf1e8d6c..b642af3f 100644 --- a/lua/app/userdata/daily_challenge/daily_challenge_data.lua +++ b/lua/app/userdata/daily_challenge/daily_challenge_data.lua @@ -113,15 +113,6 @@ function DailyChallengeData:getBuffDesc(buffId) return I18N:getText("buff_daily_challenge", buffId, "desc") end --- 获取今日剩余时间 -function DailyChallengeData:getTodaySurplusTime() - local result = Time:getOverOfServerToday() - Time:getServerTime() - if result < 0 then - result = 0 - end - return result -end - -- 获取最终boss配置信息 function DailyChallengeData:getFinalBossInfo() if not self:isOpen() then diff --git a/lua/app/userdata/dungeon.meta b/lua/app/userdata/dungeon.meta new file mode 100644 index 00000000..690af9e8 --- /dev/null +++ b/lua/app/userdata/dungeon.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 256d487279ef573429ce63e3bb5ca819 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/lua/app/userdata/dungeon/dungeon_base_entity.lua b/lua/app/userdata/dungeon/dungeon_base_entity.lua new file mode 100644 index 00000000..57a38c20 --- /dev/null +++ b/lua/app/userdata/dungeon/dungeon_base_entity.lua @@ -0,0 +1,117 @@ +local DungeonBaseEntity = class("DungeonBaseEntity", BaseData) + +-- 需要继承重写的部分 *********************************************************** + +-- 初始化服务器数据 +function DungeonBaseEntity:init(data) +end + +-- 获取副本模块名,对应ModuleManager.MODULE_KEY +function DungeonBaseEntity:getModuleKey() + return nil +end + +-- 获取副本开启周期(星期几) +function DungeonBaseEntity:getOpenWeekCycle() + return nil +end + +-- 获取副本配置名称 +function DungeonBaseEntity:getConfigName() + return nil +end + +-- 获取副本标题文案 +function DungeonBaseEntity:getTitleString() + return nil +end + +-- 获取副本规则描述(金币副本) +function DungeonBaseEntity:getRuleString() + return nil +end + +-- 获取副本boss抗性(碎片副本) +function DungeonBaseEntity:getBossBuff(id) + return nil +end + +-- 获取开始时间描述 +function DungeonBaseEntity:getOpenWeekString() + return nil +end + +-- 获取副本角标图 +function DungeonBaseEntity:getIcon() + return nil +end + +-- 获取副本banner图 +function DungeonBaseEntity:getBanner() + return nil +end + +-- 获取开启时间文本颜色 +function DungeonBaseEntity:getOpenTextColor() + return nil +end + +-- 获取总挑战次数 +function DungeonBaseEntity:getTotalChallengeCount() + return nil +end + +-- 获取今日已挑战次数 +function DungeonBaseEntity:getTodayChallengeCount() + return nil +end + +-- 获取已通关的最大副本id +function DungeonBaseEntity:getPassedMaxId() + return nil +end + +-- 获取挑战体力消耗 +function DungeonBaseEntity:getChallengeHpCost() + return nil +end + +-- 获取每日最大挑战次数 +function DungeonBaseEntity:getTodayMaxCount() + return nil +end + +-- 获取看板展示的副本奖励(返回icon) +function DungeonBaseEntity:getBoardShowRewardIcon() + return nil +end + +-- 获取看板展示的副本奖励(返回id list) +function DungeonBaseEntity:getBoardShowRewardId() + return nil +end + +-- 获取首通奖励个数 +function DungeonBaseEntity:getFirstRewardNum() + return nil +end + +-- 获取通关奖励个数 +function DungeonBaseEntity:getPassRewardNum() + return nil +end + + +-- 常规逻辑 ********************************************************************* + +-- 获取今日剩余挑战次数 +function DungeonBaseEntity:getTodayRemainLimitCount() + return self:getTodayMaxCount() - self:getTodayChallengeCount() +end + +-- 获取副本配置 +function DungeonBaseEntity:getConfig() + return ConfigManager:getConfig(self:getConfigName()) +end + +return DungeonBaseEntity \ No newline at end of file diff --git a/lua/app/userdata/dungeon/dungeon_base_entity.lua.meta b/lua/app/userdata/dungeon/dungeon_base_entity.lua.meta new file mode 100644 index 00000000..4f849ef1 --- /dev/null +++ b/lua/app/userdata/dungeon/dungeon_base_entity.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: e4b0cc0f74106f04ab07ab30b1b724d8 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/userdata/dungeon/dungeon_data.lua b/lua/app/userdata/dungeon/dungeon_data.lua new file mode 100644 index 00000000..24a15496 --- /dev/null +++ b/lua/app/userdata/dungeon/dungeon_data.lua @@ -0,0 +1,372 @@ +local DungeonData = class("DungeonData", BaseData) + +-- 副本展示权重(由上到下排列) +local DUNGEON_SHOW_WEIGHT = { + [1] = ModuleManager.MODULE_KEY.DUNGEON_SHARDS, + [2] = ModuleManager.MODULE_KEY.DUNGEON_GOLD, +} + +-- 所有活动副本数据 + +function DungeonData:ctor() + self.data.isDirty = false +end + +function DungeonData:clear() +end + +-- 初始化金币副本数据 +function DungeonData:initDungeonGold(data) + if data == nil then + return + end + + if EDITOR_MODE then + Logger.logHighlight("更新金币副本数据") + Logger.printTable(data) + end + + self:initAllDataClass() + self.dataDungeons[ModuleManager.MODULE_KEY.DUNGEON_GOLD]:init(data) + self.data.gold = data + self:setDirty() +end + +-- 初始化碎片副本数据 +function DungeonData:initDungeonShards(data) + if data == nil then + return + end + + if EDITOR_MODE then + Logger.logHighlight("更新碎片副本数据") + Logger.printTable(data) + end + + self:initAllDataClass() + self.dataDungeons[ModuleManager.MODULE_KEY.DUNGEON_SHARDS]:init(data) + self.data.shards = data + self:setDirty() +end + +-- 初始化所有副本数据类 +function DungeonData:initAllDataClass() + if self.dataDungeons == nil then + self.dataDungeons = {} + self.dataDungeons[ModuleManager.MODULE_KEY.DUNGEON_GOLD] = require "app/userdata/dungeon/dungeon_gold_entity":create() + self.dataDungeons[ModuleManager.MODULE_KEY.DUNGEON_SHARDS] = require "app/userdata/dungeon/dungeon_shards_entity":create() + + if EDITOR_MODE then + Logger.logHighlight("星期".. tostring(Time:getWeekByTimeStamp())) + end + end + + self.initDay = Time:getBeginningOfServerToday() +end + +function DungeonData:getIfCanReset() + return self.initDay < Time:getBeginningOfServerToday() +end + +-- 跨天处理 +function DungeonData:onDayChange() + self.data.gold.today_challenge_count = 0 + self.data.shards.today_challenge_count = 0 + + if EDITOR_MODE then + Logger.logHighlight("星期".. tostring(Time:getWeekByTimeStamp())) + end + + self:initDungeonGold(self.data.gold) + self:initDungeonShards(self.data.shards) +end + +-- 客户端处理副本次数+1的情况 +function DungeonData:onFightCountReduce(moduleKey) + if moduleKey == ModuleManager.MODULE_KEY.DUNGEON_GOLD then + self.data.gold.today_challenge_count = self.data.gold.today_challenge_count + 1 + self:initDungeonGold(self.data.gold) + elseif moduleKey == ModuleManager.MODULE_KEY.DUNGEON_SHARDS then + self.data.shards.today_challenge_count = self.data.shards.today_challenge_count + 1 + self:initDungeonShards(self.data.shards) + end +end + +function DungeonData:setDirty() + self.data.isDirty = not self.data.isDirty +end + +-- 是否开启任意一个副本 +function DungeonData:isOpenAnyone() + for key, value in pairs(self.dataDungeons) do + if self:isOpen(key) then + return true + end + end + return false +end + +-- 某副本是否已开启 +function DungeonData:isOpen(moduleKey) + if not ModuleManager:getIsOpen(moduleKey, true) then + return false + end + return true +end + +-- 返回已开启的副本 +function DungeonData:getOpenDungeons() + local openDungeons = {} + for idx, moduleKey in pairs(DUNGEON_SHOW_WEIGHT) do + if self:isOpen(moduleKey) then + table.insert(openDungeons, moduleKey) + end + end + if EDITOR_MODE then + Logger.logHighlight("已开启副本:") + Logger.printTable(openDungeons) + end + return table.revert(openDungeons) +end + +-- 是否在活动副本时间内 +function DungeonData:isActive(moduleKey) + if not self:isOpen(moduleKey) then + return false + end + + -- 判断周期 + if self:isActiveCycle(moduleKey, Time:getWeekByTimeStamp()) then + return true + else + return false + end +end + +-- 判断是否在活跃周期内 +function DungeonData:isActiveCycle(moduleKey, checkWeek) + if not self.dataDungeons[moduleKey] then + return false + end + + for index, week in ipairs(self.dataDungeons[moduleKey]:getOpenWeekCycle()) do + if week == checkWeek then + return true + end + end + return false +end + +-- 是否任意一个副本可以挑战 +function DungeonData:isCanChallengeAnyone() + for key, value in pairs(self.dataDungeons) do + if self:isCanChallenge(key) then + return true + end + end + return false +end + +-- 副本是否可以挑战 +function DungeonData:isCanChallenge(moduleKey) + if not self:isActive(moduleKey) then + return false + end + if not (self:getRemainTimes(moduleKey) > 0) then + return false + end + if not self:isEnoughHp(moduleKey) then + return false + end + return true +end + +-- 副本是否可以扫荡 +function DungeonData:isCanSweep(moduleKey, id) + if not self:isActive(moduleKey) then + return false + end + if not (self:getRemainTimes(moduleKey) > 0) then + return false + end + if not self:isEnoughHp(moduleKey) then + return false + end + if not self:getPassedMaxId(moduleKey) >= id then + return false + end + return true +end + +-- 获取副本挑战总次数 +function DungeonData:getTotalCount(moduleKey) + return self.dataDungeons[moduleKey]:getTotalChallengeCount() +end + +-- 获取副本今日剩余次数 +function DungeonData:getRemainTimes(moduleKey) + if not self:isActive(moduleKey) then + return 0 + end + if not self.dataDungeons[moduleKey] then + return 0 + end + + return self.dataDungeons[moduleKey]:getTodayRemainLimitCount() +end + +-- 体力是否足够 +function DungeonData:isEnoughHp(moduleKey) + local const = self:getChallengeHpCost(moduleKey) + local constNum = 0 + if const then + constNum = GFunc.getRewardNum(const) + end + return constNum <= DataManager.BagData.ItemData:getVit() +end + +-- 获取挑战体力消耗 +function DungeonData:getChallengeHpCost(moduleKey) + if not self:isActive(moduleKey) then + return 0 + end + if not self.dataDungeons[moduleKey] then + return 0 + end + + return self.dataDungeons[moduleKey]:getChallengeHpCost() +end + +-- 获取副本下个状态改变时间 +function DungeonData:geNextTime(moduleKey) + if self:isActive(moduleKey) then + return self:getCloseTime(moduleKey) + else + return self:getOpenTime(moduleKey) + end +end + +-- 获取副本开启倒计时 +function DungeonData:getOpenTime(moduleKey) + if not self.dataDungeons[moduleKey] then + return 0 + end + + local isClose = true + local count = 0 + while isClose do + local checkWeek = Time:getWeekByTimeStamp(Time:getServerTime() + ((count + 1) * 86400)) + if self:isActiveCycle(moduleKey, checkWeek) then + isClose = false + else + count = count + 1 + end + end + + return Time:getTodaySurplusTime() + (count * 86400) +end + +-- 获取副本关闭倒计时 +function DungeonData:getCloseTime(moduleKey) + if not self.dataDungeons[moduleKey] then + return 0 + end + + local isActive = true + local count = 0 + while isActive do + local checkWeek = Time:getWeekByTimeStamp(Time:getServerTime() + ((count + 1) * 86400)) + if not self:isActiveCycle(moduleKey, checkWeek) then + isActive = false + else + count = count + 1 + end + end + + return Time:getTodaySurplusTime() + (count * 86400) +end + +-- 获取看板展示的副本奖励(返回icon) +function DungeonData:getBoardShowRewardIcon(moduleKey) + return self.dataDungeons[moduleKey]:getBoardShowRewardIcon() +end + +-- 获取看板展示的副本奖励(返回item id list) +function DungeonData:getBoardShowRewardId(moduleKey) + return self.dataDungeons[moduleKey]:getBoardShowRewardId() +end + +-- 获取展示副本首通奖励个数 +function DungeonData:getFirstRewardNum(moduleKey, id) + -- 通关后,不展示首通奖励 + return self.dataDungeons[moduleKey]:getFirstRewardNum(id) +end + +-- 获取展示副本通关奖励个数 +function DungeonData:getPassRewardNum(moduleKey, id) + return self.dataDungeons[moduleKey]:getPassRewardNum(id) +end + +--获取副本已解锁最大id +function DungeonData:getUnlockMaxId(moduleKey) + local id = self.dataDungeons[moduleKey]:getPassedMaxId() + 1 + if id > self:getConfigMaxId(moduleKey) then + id = id - 1 + end + return id +end + +-- 获取副本配置的最高关卡 +function DungeonData:getConfigMaxId(moduleKey) + return #self.dataDungeons[moduleKey]:getConfig() +end + +--获取副本已通关的最高关卡id +function DungeonData:getPassedMaxId(moduleKey) + return self.dataDungeons[moduleKey]:getPassedMaxId() +end + +-- 获取副本标题文案 +function DungeonData:getTitle(moduleKey) + return self.dataDungeons[moduleKey]:getTitleString() +end + +-- 获取副本规则描述 +function DungeonData:getRule(moduleKey) + return self.dataDungeons[moduleKey]:getRuleString() +end + +-- 获取副本当前关卡buff +function DungeonData:getBossBuff(moduleKey, id) + return self.dataDungeons[moduleKey]:getBossBuff(id) +end + +-- 获取副本开启时间描述 +function DungeonData:getOpenTimeDesc(moduleKey) + return self.dataDungeons[moduleKey]:getOpenWeekString() +end + +-- 获取副本角标图 +function DungeonData:getIcon(moduleKey) + return self.dataDungeons[moduleKey]:getIcon() +end + +-- 获取副本banner图 +function DungeonData:getBanner(moduleKey) + return self.dataDungeons[moduleKey]:getBanner() +end + +-- 获取开启时间文本颜色 +function DungeonData:getOpenTextColor(moduleKey) + return self.dataDungeons[moduleKey]:getOpenTextColor() +end + +function DungeonData:setCurFightChapterId(chapterId) + self.curFightchapterId = chapterId or 1 +end + +function DungeonData:getCurFightChapterId() + return self.curFightchapterId or 1 +end + +return DungeonData \ No newline at end of file diff --git a/lua/app/userdata/dungeon/dungeon_data.lua.meta b/lua/app/userdata/dungeon/dungeon_data.lua.meta new file mode 100644 index 00000000..27a7e375 --- /dev/null +++ b/lua/app/userdata/dungeon/dungeon_data.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 0dea895676e488b45ac59508224e0564 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/userdata/dungeon/dungeon_gold_entity.lua b/lua/app/userdata/dungeon/dungeon_gold_entity.lua new file mode 100644 index 00000000..f059d6c4 --- /dev/null +++ b/lua/app/userdata/dungeon/dungeon_gold_entity.lua @@ -0,0 +1,86 @@ +local DungeonBaseEntity = require "app/userdata/dungeon/dungeon_base_entity" +local DungeonGoldEntity = class("DungeonGoldEntity", DungeonBaseEntity) + +-- 金币副本数据 + +function DungeonGoldEntity:init(data) + self.totalChallengeCount = data.total_challenge_count + self.todayChallengeCount = data.today_challenge_count + self.maxPassedId = data.max_chapter_gold_id +end + +function DungeonGoldEntity:getTotalChallengeCount() + return self.totalChallengeCount +end + +function DungeonGoldEntity:getTodayChallengeCount() + return self.todayChallengeCount +end + +function DungeonGoldEntity:getPassedMaxId() + return self.maxPassedId +end + +function DungeonGoldEntity:getModuleKey() + return ModuleManager.MODULE_KEY.DUNGEON_GOLD +end + +function DungeonGoldEntity:getOpenWeekCycle() + if self.openWeek == nil then + self.openWeek = {2,4,6,7} + end + return self.openWeek +end + +function DungeonGoldEntity:getConfigName() + return "chapter_dungeon_gold" +end + +function DungeonGoldEntity:getTitleString() + return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_GOLD_TITLE) +end + +function DungeonGoldEntity:getRuleString() + return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_GOLD_HELP) +end + +function DungeonGoldEntity:getOpenWeekString() + return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_GOLD_OPEN) +end + +function DungeonGoldEntity:getIcon() + if self.dungeonIcon == nil then + self.dungeonIcon = {GConst.ATLAS_PATH.DUNGEON,"dungeon_dec_1"} + end + return self.dungeonIcon +end + +function DungeonGoldEntity:getBanner() + return "assets/arts/textures/background/dungeon/dungeon_bg_1.png" +end + +function DungeonGoldEntity:getOpenTextColor() + return "#FFEDC5" +end + +function DungeonGoldEntity:getChallengeHpCost() + return GFunc.getConstReward("dungeon_gold_cost") +end + +function DungeonGoldEntity:getTodayMaxCount() + return GFunc.getConstIntValue("dungeon_gold_limit") +end + +function DungeonGoldEntity:getBoardShowRewardId() + return 1 +end + +function DungeonGoldEntity:getFirstRewardNum(id) + return GFunc.getRewardNum(ConfigManager:getConfig("chapter_dungeon_gold")[id].first_pass_reward) +end + +function DungeonGoldEntity:getPassRewardNum(id) + return GFunc.getRewardNum(ConfigManager:getConfig("chapter_dungeon_gold")[id].percent_reward) +end + +return DungeonGoldEntity \ No newline at end of file diff --git a/lua/app/userdata/dungeon/dungeon_gold_entity.lua.meta b/lua/app/userdata/dungeon/dungeon_gold_entity.lua.meta new file mode 100644 index 00000000..e259d755 --- /dev/null +++ b/lua/app/userdata/dungeon/dungeon_gold_entity.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 792ac3a45b52c5d4c895737413faf6db +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/userdata/dungeon/dungeon_shards_entity.lua b/lua/app/userdata/dungeon/dungeon_shards_entity.lua new file mode 100644 index 00000000..73e8d6de --- /dev/null +++ b/lua/app/userdata/dungeon/dungeon_shards_entity.lua @@ -0,0 +1,106 @@ +local DungeonBaseEntity = require "app/userdata/dungeon/dungeon_base_entity" +local DungeonShardsEntity = class("DungeonShardsEntity", DungeonBaseEntity) + +-- 碎片副本数据 + +function DungeonShardsEntity:init(data) + self.totalChallengeCount = data.total_challenge_count + self.todayChallengeCount = data.today_challenge_count + self.maxPassedId = data.max_chapter_shards_id +end + +function DungeonShardsEntity:getTotalChallengeCount() + return self.totalChallengeCount +end + +function DungeonShardsEntity:getTodayChallengeCount() + return self.todayChallengeCount +end + +function DungeonShardsEntity:getPassedMaxId() + return self.maxPassedId +end + +function DungeonShardsEntity:getModuleKey() + return ModuleManager.MODULE_KEY.DUNGEON_SHARDS +end + +function DungeonShardsEntity:getOpenWeekCycle() + if self.openWeek == nil then + self.openWeek = {1,3,5,7} + end + return self.openWeek +end + +function DungeonShardsEntity:getConfigName() + return "chapter_dungeon_shards" +end + +function DungeonShardsEntity:getTitleString() + return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_SHARDS_TITLE) +end + +function DungeonShardsEntity:getRuleString() + return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_SHARDS_HELP) +end + +function DungeonShardsEntity:getOpenWeekString() + return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_SHARDS_OPEN) +end + +function DungeonShardsEntity:getBossBuff(id) + return self:getConfig()[id].effect[1] +end + +function DungeonShardsEntity:getIcon() + if self.dungeonIcon == nil then + self.dungeonIcon = {GConst.ATLAS_PATH.DUNGEON,"dungeon_dec_2"} + end + return self.dungeonIcon +end + +function DungeonShardsEntity:getBanner() + return "assets/arts/textures/background/dungeon/dungeon_bg_2.png" +end + +function DungeonShardsEntity:getOpenTextColor() + return "#E4F5FE" +end + +function DungeonShardsEntity:getChallengeHpCost() + return GFunc.getConstReward("dungeon_shards_cost") +end + +function DungeonShardsEntity:getTodayMaxCount() + return GFunc.getConstIntValue("dungeon_shards_limit") +end + +function DungeonShardsEntity:getBoardShowRewardIcon() + if self.rewardIcon == nil then + self.rewardIcon = {GConst.ATLAS_PATH.ICON_ITEM,"20"} + end + return self.rewardIcon +end + +function DungeonShardsEntity:getFirstRewardNum(id) + local count = 0 + for index, reward in ipairs(ConfigManager:getConfig("chapter_dungeon_shards")[id].first_pass_reward) do + count = count + GFunc.getRewardNum(reward) + end + return count +end + +function DungeonShardsEntity:getPassRewardNum(id) + local count = 0 + local pass = ConfigManager:getConfig("chapter_dungeon_shards")[id].pass_reward + local wave = ConfigManager:getConfig("chapter_dungeon_shards")[id].wave_reward + for index, reward in ipairs(pass) do + count = count + GFunc.getRewardNum(reward) + end + for index, reward in ipairs(wave) do + count = count + GFunc.getRewardNum(reward) + end + return count +end + +return DungeonShardsEntity \ No newline at end of file diff --git a/lua/app/userdata/dungeon/dungeon_shards_entity.lua.meta b/lua/app/userdata/dungeon/dungeon_shards_entity.lua.meta new file mode 100644 index 00000000..f6e34ec0 --- /dev/null +++ b/lua/app/userdata/dungeon/dungeon_shards_entity.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 915b7ed44e1bfb24fa12a24eeb2813d3 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}