diff --git a/lua/app/config/mail.lua.meta b/lua/app/config/mail.lua.meta index 9ae2271c..80fb8974 100644 --- a/lua/app/config/mail.lua.meta +++ b/lua/app/config/mail.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 26403a4c77be4584982691a5a64cc90f +guid: 11665dfdb08a75846bfb0d3a63277542 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/cn/mail.lua.meta b/lua/app/config/strings/cn/mail.lua.meta index 543d6cd6..30d52525 100644 --- a/lua/app/config/strings/cn/mail.lua.meta +++ b/lua/app/config/strings/cn/mail.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 07c0eb9d579311240a0b9b3b1348bb43 +guid: bbf38508076c6a04d9f1bf15181bd3b6 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/de/mail.lua.meta b/lua/app/config/strings/de/mail.lua.meta index 9549b5d5..e9a05b82 100644 --- a/lua/app/config/strings/de/mail.lua.meta +++ b/lua/app/config/strings/de/mail.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e26e5e7d841ab3a4c8c21aa4d8ab3a61 +guid: 3a1954dd8e9d1c54c981ef71c96077be ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/en/mail.lua.meta b/lua/app/config/strings/en/mail.lua.meta index e8b4e948..07abc06c 100644 --- a/lua/app/config/strings/en/mail.lua.meta +++ b/lua/app/config/strings/en/mail.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 08a7b69c149fe5943a502b8a91b933df +guid: 90d8b11fdee6134419f8e702ab468cf5 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/fr/mail.lua.meta b/lua/app/config/strings/fr/mail.lua.meta index f9c1b37f..60f7b257 100644 --- a/lua/app/config/strings/fr/mail.lua.meta +++ b/lua/app/config/strings/fr/mail.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 71bf6f3e5fdd2b9419cfcbb212c0c5e1 +guid: eb850ef427dabc54794afaf8bcedf737 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/ja/mail.lua.meta b/lua/app/config/strings/ja/mail.lua.meta index cd48cb0f..11fe2c81 100644 --- a/lua/app/config/strings/ja/mail.lua.meta +++ b/lua/app/config/strings/ja/mail.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 77a44aaa25d3c4c49a24dd0ce83e84ef +guid: 2cea8977c8008a84685fa9c216ea4e6d ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/ko/mail.lua.meta b/lua/app/config/strings/ko/mail.lua.meta index 0d52397b..654cb103 100644 --- a/lua/app/config/strings/ko/mail.lua.meta +++ b/lua/app/config/strings/ko/mail.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: e4b1b6fe02323924683bfd93258bf4f0 +guid: fe3092af5b4df5c48a321faee19026de ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/config/strings/zh/mail.lua.meta b/lua/app/config/strings/zh/mail.lua.meta index 2b549a16..6b95e3cb 100644 --- a/lua/app/config/strings/zh/mail.lua.meta +++ b/lua/app/config/strings/zh/mail.lua.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f0c9c665019032543baa38c9226146f2 +guid: 82da7c0e4ab2825488868c862fa80ec1 ScriptedImporter: internalIDToNameTable: [] externalObjects: {} diff --git a/lua/app/module/battle/battle_const.lua b/lua/app/module/battle/battle_const.lua index f2700b28..359d0332 100644 --- a/lua/app/module/battle/battle_const.lua +++ b/lua/app/module/battle/battle_const.lua @@ -377,6 +377,7 @@ BattleConst.GRID_EFFECT_TYPE = { DIRECTION_ELIMINATION = 1, CROSS_SPREAD = 2, SELECT_COMMON_SKILL = 3, + REWARD_BOX = 4, } BattleConst.GRID_EFFECT_TRIGGER_TYPE = { diff --git a/lua/app/module/battle/battle_manager.lua b/lua/app/module/battle/battle_manager.lua index cc4328c2..f87d74d3 100644 --- a/lua/app/module/battle/battle_manager.lua +++ b/lua/app/module/battle/battle_manager.lua @@ -14,8 +14,8 @@ function BattleManager:showPauseUI() UIManager:showUI("app/ui/battle/battle_pause_ui") end -function BattleManager:showBattleResultUI(rewards, combatReport) - UIManager:showUI("app/ui/battle/battle_result_ui", {rewards = rewards, combatReport = combatReport}) +function BattleManager:showBattleResultUI(rewards, combatReport, mysteryBoxIdx) + UIManager:showUI("app/ui/battle/battle_result_ui", {rewards = rewards, combatReport = combatReport, mysteryBoxIdx = mysteryBoxIdx}) end function BattleManager:playBattle(battleType, params, returnFunc) diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index c631a5bc..0533d068 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -211,6 +211,8 @@ function BattleController:init(params) self.roundStep = BattleConst.BATTLE_ROUND_STEP.WAIT_BEGIN self.effectTexts = {} self.instructions = {} + self.gotMysteryBoxIndexs = {} + self.showMysteryBoxIndexs = {} self.delayEffectTextList = {} self.delayEffectTextCount = 0 self.time = 0 @@ -1003,6 +1005,12 @@ function BattleController:dealGridBreak(posId, condition, time, breakedMap, sequ end end end + if entity:getBreakFlyToCharacter() then + aniUnit.breakFlyToCharacter = true + aniUnit.noAni = false + aniUnit.overCallback = aniUnit.callback + aniUnit.callback = nil + end end return isIdle @@ -1122,26 +1130,40 @@ function BattleController:fillBoard(isRoundBeginCheck) end function BattleController:onFillBoardOver(isRoundBeginCheck) - if not isRoundBeginCheck and self.battleData:useCommonSelectSkillCount() then - self:tryShowSelectSkillComp(false, true) - else - if self.onFillBoardOverCallback then - self.onFillBoardOverCallback() + self.battleUI:enableUITouch() + + if not isRoundBeginCheck then -- 检查一些表现 + if self.showMysteryBoxIndexs[1] then -- 检查宝箱 + local index = table.remove(self.showMysteryBoxIndexs, 1) + local boardList, _, mysteryBoxIndexMap = self:getInitBoard() + local rewards = mysteryBoxIndexMap[index] + ModuleManager.TipsManager:showRewardsTips(rewards, nil, nil, function() + self:onFillBoardOver() + end) + return end - if isRoundBeginCheck then - EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.BOARD_FILL_OVER) - self:popBoardCacheSkill(function() - self:enterElimination(true) - end) - else - self:generateSkill(function() - self.battleUI:refreshSkill() - self:enterBattleStep() - end) + if self.battleData:useCommonSelectSkillCount() then -- 检查神灯 + self:tryShowSelectSkillComp(false, true) + return end end - self.battleUI:enableUITouch() + + if self.onFillBoardOverCallback then + self.onFillBoardOverCallback() + end + + if isRoundBeginCheck then + EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.BOARD_FILL_OVER) + self:popBoardCacheSkill(function() + self:enterElimination(true) + end) + else + self:generateSkill(function() + self.battleUI:refreshSkill() + self:enterBattleStep() + end) + end end function BattleController:generateInstructions(skillEntity, elementType, lineCount, influenceElementTypeMap, elementTypeMap) @@ -1325,7 +1347,7 @@ function BattleController:exeInstructions(callback) end function BattleController:generateBoard(isFirst) - local boardList, _ = self:getInitBoard() + local boardList, _, mysteryBoxIndexMap = self:getInitBoard() if self.curBoardIndex and self.curBoardIndex >= #boardList then return end @@ -1334,8 +1356,13 @@ function BattleController:generateBoard(isFirst) return end + self.curBoardIndex = (self.curBoardIndex or 0) + 1 - local board = boardList[self.curBoardIndex] + local board = boardList[self.curBoardIndex].board + local mysteryBoard = boardList[self.curBoardIndex].mysteryBoard + if mysteryBoard and mysteryBoxIndexMap and mysteryBoxIndexMap[self.curBoardIndex] then + board = mysteryBoard + end self.battleUI:switchBoard(function() self.battleData:refreshBoard(board, self:getBlockIcon()) self.battleUI:initGridCell() @@ -1344,6 +1371,11 @@ function BattleController:generateBoard(isFirst) end, isFirst) end +function BattleController:onGotMysteryBoxIndexs() + self.gotMysteryBoxIndexs[self.curBoardIndex] = true + table.insert(self.showMysteryBoxIndexs, self.curBoardIndex) +end + function BattleController:putBoardCacheSkill(callback) if not self.battleUI then return diff --git a/lua/app/module/battle/controller/battle_controller_stage.lua b/lua/app/module/battle/controller/battle_controller_stage.lua index 8719b80e..8e7ed497 100644 --- a/lua/app/module/battle/controller/battle_controller_stage.lua +++ b/lua/app/module/battle/controller/battle_controller_stage.lua @@ -91,18 +91,28 @@ 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") for _, boardId in ipairs(config.board) do local cfg = boardCfg[boardId] if cfg then - table.insert(self.boradList, GFunc.getTable(cfg.board)) + 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 + + if config.mystery_box and config.mystery_box_reward then + for i, index in ipairs(config.mystery_box) do + if not DataManager.ChapterData:getChapterMysteryBoxIsGot(self.chapterId, index) then + self.mysteryBoxIndexMap[index] = config.mystery_box_reward[i] + end + end + end end - return self.boradList, self.fixedRandomGrid + return self.boradList, self.fixedRandomGrid, self.mysteryBoxIndexMap end function BattleControllerStage:getSealElementType() @@ -170,7 +180,7 @@ function BattleControllerStage:controllBattleEnd() if not self.victory then self.combatReport.wave = self.combatReport.wave - 1 end - ModuleManager.ChapterManager:endFight(self.chapterId, self.combatReport) + ModuleManager.ChapterManager:endFight(self.chapterId, self.combatReport, self.gotMysteryBoxIndexs) end function BattleController:postWaveOver(atkDead, isQuit) diff --git a/lua/app/module/battle/skill/battle_grid_effect_handle.lua b/lua/app/module/battle/skill/battle_grid_effect_handle.lua index ee56641e..6137c42d 100644 --- a/lua/app/module/battle/skill/battle_grid_effect_handle.lua +++ b/lua/app/module/battle/skill/battle_grid_effect_handle.lua @@ -43,10 +43,18 @@ local function _selectCommonSkill(entity, gridEntities, battleController, onlyCh battleController.battleData:addCommonSelectSkillCount() end +local function _rewardBox(entity, gridEntities, battleController, onlyCheck) + if onlyCheck then + return + end + battleController:onGotMysteryBoxIndexs() +end + BattleGridEffectHandle._gridEffectOn = { [GRID_EFFECT_TYPE.DIRECTION_ELIMINATION] = _directionElinination, [GRID_EFFECT_TYPE.CROSS_SPREAD] = _crossSpread, [GRID_EFFECT_TYPE.SELECT_COMMON_SKILL] = _selectCommonSkill, + [GRID_EFFECT_TYPE.REWARD_BOX] = _rewardBox, } function BattleGridEffectHandle.gridEffectOn(posId, gridEntities, triggerType, battleController, onlyCheck) diff --git a/lua/app/module/chapter/chapter_manager.lua b/lua/app/module/chapter/chapter_manager.lua index 10c04a0e..831a3aae 100644 --- a/lua/app/module/chapter/chapter_manager.lua +++ b/lua/app/module/chapter/chapter_manager.lua @@ -48,10 +48,17 @@ function ChapterManager:startFightFinish(result) end end -function ChapterManager:endFight(id, combatReport) +function ChapterManager:endFight(id, combatReport, gotMysteryBoxIndexs) + local mystery_box_idx = {} + if gotMysteryBoxIndexs then + for index, _ in pairs(gotMysteryBoxIndexs) do + table.insert(mystery_box_idx, index) + end + end local parmas = { - chapter_id = id, win = combatReport.victory, + chapter_id = id, + mystery_box_idx = mystery_box_idx, pass_wave = combatReport.wave, combatReport = combatReport, } @@ -63,12 +70,22 @@ function ChapterManager:endFightFinish(result) if result.err_code == GConst.ERROR_STR.SUCCESS then local reqData = result.reqData local maxChapter = DataManager.ChapterData:getNewChapterId() + local rewards = {} local newRewards = {} - if result.rewards then - GFunc.mergeRewards2(result.rewards, newRewards) + local mysteryBoxIdx = result.mystery + for i, reward in ipairs(result.rewards) do + if i <= mysteryBoxIdx then + table.insert(newRewards, reward) + else + table.insert(rewards, reward) + end end - ModuleManager.BattleManager:showBattleResultUI(newRewards, reqData.combatReport) - DataManager.ChapterData:fightChapter(reqData.chapter_id, result.max_chapter_id, result.max_wave) + + if rewards then + GFunc.mergeRewards2(rewards, newRewards) + end + ModuleManager.BattleManager:showBattleResultUI(newRewards, reqData.combatReport, mysteryBoxIdx) + DataManager.ChapterData:fightChapter(reqData.chapter_id, result.max_chapter_id, result.max_wave, reqData.mystery_box_idx) -- 处理金猪 DataManager.GodPigData:addGoldPigCount() diff --git a/lua/app/module/tips/tips_manager.lua b/lua/app/module/tips/tips_manager.lua index 949ef5ab..082b5649 100644 --- a/lua/app/module/tips/tips_manager.lua +++ b/lua/app/module/tips/tips_manager.lua @@ -52,10 +52,11 @@ function TipsManager:showItemTips(id, tarPrefabObj, alignType) UIManager:showUI("app/ui/tips/item_tips", params) end -function TipsManager:showRewardsTips(rewards, customTitleStr, tarPrefabObj, alignType) +function TipsManager:showRewardsTips(rewards, customTitleStr, tarPrefabObj, callback, alignType) local params = { rewards = rewards, customTitleStr = customTitleStr, + callback = callback, aniType = UIManager.ANI_TYPE.NONE, } if tarPrefabObj then diff --git a/lua/app/ui/battle/battle_result_ui.lua b/lua/app/ui/battle/battle_result_ui.lua index c8d0a314..2a3be616 100644 --- a/lua/app/ui/battle/battle_result_ui.lua +++ b/lua/app/ui/battle/battle_result_ui.lua @@ -9,6 +9,7 @@ end function BattleResultUI:ctor(params) self.rewards = params.rewards self.combatReport = params.combatReport + self.mysteryBoxIdx = params.mysteryBoxIdx or 0 self.totalDmg = 0 if self.combatReport.atkReport then for _, info in ipairs(self.combatReport.atkReport) do @@ -103,6 +104,7 @@ function BattleResultUI:refreshRewards() end) self.scrollRectComp:addRefreshCallback(function(index, cell) cell:refresh(self.rewards[index]) + cell:showLeftUpIcon(index <= self.mysteryBoxIdx, GConst.ATLAS_PATH.COMMON, "common_chest_1") end) self.scrollRectComp:setFadeArgs(0.05, 0.3) self.scrollRectComp:clearCells() diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index 862a9781..19e2b2b3 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -884,6 +884,7 @@ function BattleUI:eliminationAni(aniSequence, effectGridMap, callback) end local baseObject = entity:getCell():getBaseObject() baseObject:getTransform():SetAsLastSibling() + local anitime = 0 if info.aniPosList then local posList = {} local count = 0 @@ -891,17 +892,8 @@ function BattleUI:eliminationAni(aniSequence, effectGridMap, callback) table.insert(posList, ModuleManager.BattleManager:getPosInfo(posId)) count = count + 1 end - local anitime = count * GConst.BattleConst.GRID_BREAK_EFFECT_INTERVAL + anitime = count * GConst.BattleConst.GRID_BREAK_EFFECT_INTERVAL self.eliminationAniSeq:Insert(time, baseObject:getTransform():DOLocalPath(posList, anitime):SetEase(CS.DG.Tweening.Ease.Linear)) - - if info.overCallback then - self.eliminationAniSeq:InsertCallback(time + anitime, function() - if info.noAni then - baseObject:setAnchoredPositionX(DEFAULT_X) - end - info.overCallback() - end) - end else if info.noAni then baseObject:setAnchoredPositionX(DEFAULT_X) @@ -918,10 +910,25 @@ function BattleUI:eliminationAni(aniSequence, effectGridMap, callback) obj:play() end) end) - self.eliminationAniSeq:Insert(time + 0.2, baseObject:getTransform():DOAnchorPos(self:getElementSkillPos(entity:getElementType()), 0.3)) + local targetPos = self:getElementSkillPos(entity:getElementType()) + if info.breakFlyToCharacter then + targetPos = self.battleController.atkTeam:getMainUnit():getBaseObject():getTransform().position + local sPoint = UIManager:getUICameraComponent():WorldToScreenPoint(targetPos) + targetPos = CS.BF.Utils.RectTransformScreenPointToLocalPointInRectangle(self.boardNode:getTransform(), sPoint.x, sPoint.y, UIManager:getUICameraComponent()) + end + self.eliminationAniSeq:Insert(time + 0.2, baseObject:getTransform():DOAnchorPos(targetPos, 0.3)) self.eliminationAniSeq:Insert(time + 0.2, baseObject:getTransform():DOScale(0.5, 0.3)) + anitime = 0.5 end end + if info.overCallback then + self.eliminationAniSeq:InsertCallback(time + anitime, function() + if info.noAni then + baseObject:setAnchoredPositionX(DEFAULT_X) + end + info.overCallback() + end) + end end end end diff --git a/lua/app/ui/common/cell/reward_cell.lua b/lua/app/ui/common/cell/reward_cell.lua index ed640d57..e0196cd3 100644 --- a/lua/app/ui/common/cell/reward_cell.lua +++ b/lua/app/ui/common/cell/reward_cell.lua @@ -8,6 +8,7 @@ function RewardCell:init() self.check = uiMap["reward_cell.check"] self.numTx = uiMap["reward_cell.item_bg.num"] self.fragment = uiMap["reward_cell.item_bg.fragment"] + self.leftUpIcon = uiMap["reward_cell.item_bg.left_up_icon"] self.frameAni = uiMap["reward_cell.frame_ani"] self:hideFrameAnimation() self.baseObject:addClickListener(function() @@ -139,4 +140,12 @@ function RewardCell:hideFrameAnimation() self.frameAni:setVisible(false) end +function RewardCell:showLeftUpIcon(show, atlas, iconName) + self.leftUpIcon:setVisible(show) + if not show then + return + end + self.leftUpIcon:setSprite(atlas, iconName) +end + return RewardCell \ No newline at end of file diff --git a/lua/app/ui/tips/rewards_tips.lua b/lua/app/ui/tips/rewards_tips.lua index b0cc58ec..318aa27c 100644 --- a/lua/app/ui/tips/rewards_tips.lua +++ b/lua/app/ui/tips/rewards_tips.lua @@ -5,6 +5,7 @@ function RewardsTips:ctor(params) self.params = params self.tarCornerScreenPos = params.tarCornerScreenPos self.location = params.location + self.callback = params.callback end function RewardsTips:getPrefabPath() @@ -65,6 +66,9 @@ function RewardsTips:onClose() tipsBgTransform.anchoredPosition = self.originAnchoredPosition tipsBgTransform.localPosition = self.originLocalPosition end + if self.callback then + self.callback() + end end return RewardsTips \ No newline at end of file diff --git a/lua/app/userdata/battle/battle_grid_entity.lua b/lua/app/userdata/battle/battle_grid_entity.lua index 1a40c8c3..ca230147 100644 --- a/lua/app/userdata/battle/battle_grid_entity.lua +++ b/lua/app/userdata/battle/battle_grid_entity.lua @@ -386,4 +386,8 @@ function BattleGridEntity:getEffectTrigger() return self:getGridTypeConfig().effect_trigger end +function BattleGridEntity:getBreakFlyToCharacter() + return self:getGridTypeConfig().break_fly_to_character == 1 +end + return BattleGridEntity \ No newline at end of file diff --git a/lua/app/userdata/chapter/chapter_data.lua b/lua/app/userdata/chapter/chapter_data.lua index 086b81a7..5747712e 100644 --- a/lua/app/userdata/chapter/chapter_data.lua +++ b/lua/app/userdata/chapter/chapter_data.lua @@ -297,11 +297,12 @@ function ChapterData:openBox(chapterId, index) self:setDirty() end -function ChapterData:fightChapter(chapterId, maxChapterId, maxWave) +function ChapterData:fightChapter(chapterId, maxChapterId, maxWave, mysteryBoxIdx) if not self.data.chapterInfo[chapterId] then self.data.chapterInfo[chapterId] = { total_count = 0, - index = {} + index = {}, + mystery_box_idx = {} } end self.data.chapterInfo[chapterId].total_count = (self.data.chapterInfo[chapterId].total_count or 0) + 1 @@ -318,7 +319,40 @@ function ChapterData:fightChapter(chapterId, maxChapterId, maxWave) self.data.maxChapterId = maxChapterId - 1 end + for _, idx in ipairs(mysteryBoxIdx) do + if not self:getChapterMysteryBoxIsGot(chapterId, idx) then + table.insert(self.data.chapterInfo[chapterId].mystery_box_idx, idx) + end + end + self:setDirty() end +function ChapterData:getChapterMysteryBox(chapterId) + return self.data.chapterInfo[chapterId].mystery_box_idx +end + +function ChapterData:getChapterMysteryBoxReward(chapterId) + local cfg = self:getChapterCfg()[chapterId] + if not cfg then + return + end + return cfg.mystery_box_reward +end + +function ChapterData:getChapterMysteryBoxIsGot(chapterId, index) + if not self.data.chapterInfo[chapterId] then + return false + end + if not self.data.chapterInfo[chapterId].mystery_box_idx then + return false + end + for _, idx in ipairs(self.data.chapterInfo[chapterId].mystery_box_idx) do + if idx == index then + return true + end + end + return false +end + return ChapterData \ No newline at end of file