Merge branch 'dev' of git.juzugame.com:b6-client/b6-lua into dev

This commit is contained in:
chenxi 2023-05-17 20:05:23 +08:00
commit 8ebd69c6de
21 changed files with 180 additions and 51 deletions

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 26403a4c77be4584982691a5a64cc90f guid: 11665dfdb08a75846bfb0d3a63277542
ScriptedImporter: ScriptedImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 07c0eb9d579311240a0b9b3b1348bb43 guid: bbf38508076c6a04d9f1bf15181bd3b6
ScriptedImporter: ScriptedImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e26e5e7d841ab3a4c8c21aa4d8ab3a61 guid: 3a1954dd8e9d1c54c981ef71c96077be
ScriptedImporter: ScriptedImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 08a7b69c149fe5943a502b8a91b933df guid: 90d8b11fdee6134419f8e702ab468cf5
ScriptedImporter: ScriptedImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 71bf6f3e5fdd2b9419cfcbb212c0c5e1 guid: eb850ef427dabc54794afaf8bcedf737
ScriptedImporter: ScriptedImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: 77a44aaa25d3c4c49a24dd0ce83e84ef guid: 2cea8977c8008a84685fa9c216ea4e6d
ScriptedImporter: ScriptedImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: e4b1b6fe02323924683bfd93258bf4f0 guid: fe3092af5b4df5c48a321faee19026de
ScriptedImporter: ScriptedImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2 fileFormatVersion: 2
guid: f0c9c665019032543baa38c9226146f2 guid: 82da7c0e4ab2825488868c862fa80ec1
ScriptedImporter: ScriptedImporter:
internalIDToNameTable: [] internalIDToNameTable: []
externalObjects: {} externalObjects: {}

View File

@ -377,6 +377,7 @@ BattleConst.GRID_EFFECT_TYPE = {
DIRECTION_ELIMINATION = 1, DIRECTION_ELIMINATION = 1,
CROSS_SPREAD = 2, CROSS_SPREAD = 2,
SELECT_COMMON_SKILL = 3, SELECT_COMMON_SKILL = 3,
REWARD_BOX = 4,
} }
BattleConst.GRID_EFFECT_TRIGGER_TYPE = { BattleConst.GRID_EFFECT_TRIGGER_TYPE = {

View File

@ -14,8 +14,8 @@ function BattleManager:showPauseUI()
UIManager:showUI("app/ui/battle/battle_pause_ui") UIManager:showUI("app/ui/battle/battle_pause_ui")
end end
function BattleManager:showBattleResultUI(rewards, combatReport) function BattleManager:showBattleResultUI(rewards, combatReport, mysteryBoxIdx)
UIManager:showUI("app/ui/battle/battle_result_ui", {rewards = rewards, combatReport = combatReport}) UIManager:showUI("app/ui/battle/battle_result_ui", {rewards = rewards, combatReport = combatReport, mysteryBoxIdx = mysteryBoxIdx})
end end
function BattleManager:playBattle(battleType, params, returnFunc) function BattleManager:playBattle(battleType, params, returnFunc)

View File

@ -211,6 +211,8 @@ function BattleController:init(params)
self.roundStep = BattleConst.BATTLE_ROUND_STEP.WAIT_BEGIN self.roundStep = BattleConst.BATTLE_ROUND_STEP.WAIT_BEGIN
self.effectTexts = {} self.effectTexts = {}
self.instructions = {} self.instructions = {}
self.gotMysteryBoxIndexs = {}
self.showMysteryBoxIndexs = {}
self.delayEffectTextList = {} self.delayEffectTextList = {}
self.delayEffectTextCount = 0 self.delayEffectTextCount = 0
self.time = 0 self.time = 0
@ -1003,6 +1005,12 @@ function BattleController:dealGridBreak(posId, condition, time, breakedMap, sequ
end end
end end
end end
if entity:getBreakFlyToCharacter() then
aniUnit.breakFlyToCharacter = true
aniUnit.noAni = false
aniUnit.overCallback = aniUnit.callback
aniUnit.callback = nil
end
end end
return isIdle return isIdle
@ -1122,9 +1130,25 @@ function BattleController:fillBoard(isRoundBeginCheck)
end end
function BattleController:onFillBoardOver(isRoundBeginCheck) function BattleController:onFillBoardOver(isRoundBeginCheck)
if not isRoundBeginCheck and self.battleData:useCommonSelectSkillCount() then 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 self.battleData:useCommonSelectSkillCount() then -- 检查神灯
self:tryShowSelectSkillComp(false, true) self:tryShowSelectSkillComp(false, true)
else return
end
end
if self.onFillBoardOverCallback then if self.onFillBoardOverCallback then
self.onFillBoardOverCallback() self.onFillBoardOverCallback()
end end
@ -1141,8 +1165,6 @@ function BattleController:onFillBoardOver(isRoundBeginCheck)
end) end)
end end
end end
self.battleUI:enableUITouch()
end
function BattleController:generateInstructions(skillEntity, elementType, lineCount, influenceElementTypeMap, elementTypeMap) function BattleController:generateInstructions(skillEntity, elementType, lineCount, influenceElementTypeMap, elementTypeMap)
local elementTypeCount = 0 local elementTypeCount = 0
@ -1325,7 +1347,7 @@ function BattleController:exeInstructions(callback)
end end
function BattleController:generateBoard(isFirst) function BattleController:generateBoard(isFirst)
local boardList, _ = self:getInitBoard() local boardList, _, mysteryBoxIndexMap = self:getInitBoard()
if self.curBoardIndex and self.curBoardIndex >= #boardList then if self.curBoardIndex and self.curBoardIndex >= #boardList then
return return
end end
@ -1334,8 +1356,13 @@ function BattleController:generateBoard(isFirst)
return return
end end
self.curBoardIndex = (self.curBoardIndex or 0) + 1 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.battleUI:switchBoard(function()
self.battleData:refreshBoard(board, self:getBlockIcon()) self.battleData:refreshBoard(board, self:getBlockIcon())
self.battleUI:initGridCell() self.battleUI:initGridCell()
@ -1344,6 +1371,11 @@ function BattleController:generateBoard(isFirst)
end, isFirst) end, isFirst)
end end
function BattleController:onGotMysteryBoxIndexs()
self.gotMysteryBoxIndexs[self.curBoardIndex] = true
table.insert(self.showMysteryBoxIndexs, self.curBoardIndex)
end
function BattleController:putBoardCacheSkill(callback) function BattleController:putBoardCacheSkill(callback)
if not self.battleUI then if not self.battleUI then
return return

View File

@ -91,18 +91,28 @@ function BattleControllerStage:getInitBoard()
if not self.boradList then if not self.boradList then
self.boradList = {} self.boradList = {}
self.fixedRandomGrid = {} self.fixedRandomGrid = {}
self.mysteryBoxIndexMap = {}
local config = ConfigManager:getConfig("chapter")[self.chapterId] local config = ConfigManager:getConfig("chapter")[self.chapterId]
local boardCfg = ConfigManager:getConfig("chapter_board") local boardCfg = ConfigManager:getConfig("chapter_board")
for _, boardId in ipairs(config.board) do for _, boardId in ipairs(config.board) do
local cfg = boardCfg[boardId] local cfg = boardCfg[boardId]
if cfg then 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)) table.insert(self.fixedRandomGrid, GFunc.getTable(cfg.control_element))
end end
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 end
return self.boradList, self.fixedRandomGrid return self.boradList, self.fixedRandomGrid, self.mysteryBoxIndexMap
end end
function BattleControllerStage:getSealElementType() function BattleControllerStage:getSealElementType()
@ -170,7 +180,7 @@ function BattleControllerStage:controllBattleEnd()
if not self.victory then if not self.victory then
self.combatReport.wave = self.combatReport.wave - 1 self.combatReport.wave = self.combatReport.wave - 1
end end
ModuleManager.ChapterManager:endFight(self.chapterId, self.combatReport) ModuleManager.ChapterManager:endFight(self.chapterId, self.combatReport, self.gotMysteryBoxIndexs)
end end
function BattleController:postWaveOver(atkDead, isQuit) function BattleController:postWaveOver(atkDead, isQuit)

View File

@ -43,10 +43,18 @@ local function _selectCommonSkill(entity, gridEntities, battleController, onlyCh
battleController.battleData:addCommonSelectSkillCount() battleController.battleData:addCommonSelectSkillCount()
end end
local function _rewardBox(entity, gridEntities, battleController, onlyCheck)
if onlyCheck then
return
end
battleController:onGotMysteryBoxIndexs()
end
BattleGridEffectHandle._gridEffectOn = { BattleGridEffectHandle._gridEffectOn = {
[GRID_EFFECT_TYPE.DIRECTION_ELIMINATION] = _directionElinination, [GRID_EFFECT_TYPE.DIRECTION_ELIMINATION] = _directionElinination,
[GRID_EFFECT_TYPE.CROSS_SPREAD] = _crossSpread, [GRID_EFFECT_TYPE.CROSS_SPREAD] = _crossSpread,
[GRID_EFFECT_TYPE.SELECT_COMMON_SKILL] = _selectCommonSkill, [GRID_EFFECT_TYPE.SELECT_COMMON_SKILL] = _selectCommonSkill,
[GRID_EFFECT_TYPE.REWARD_BOX] = _rewardBox,
} }
function BattleGridEffectHandle.gridEffectOn(posId, gridEntities, triggerType, battleController, onlyCheck) function BattleGridEffectHandle.gridEffectOn(posId, gridEntities, triggerType, battleController, onlyCheck)

View File

@ -48,10 +48,17 @@ function ChapterManager:startFightFinish(result)
end end
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 = { local parmas = {
chapter_id = id,
win = combatReport.victory, win = combatReport.victory,
chapter_id = id,
mystery_box_idx = mystery_box_idx,
pass_wave = combatReport.wave, pass_wave = combatReport.wave,
combatReport = combatReport, combatReport = combatReport,
} }
@ -63,12 +70,22 @@ function ChapterManager:endFightFinish(result)
if result.err_code == GConst.ERROR_STR.SUCCESS then if result.err_code == GConst.ERROR_STR.SUCCESS then
local reqData = result.reqData local reqData = result.reqData
local maxChapter = DataManager.ChapterData:getNewChapterId() local maxChapter = DataManager.ChapterData:getNewChapterId()
local rewards = {}
local newRewards = {} local newRewards = {}
if result.rewards then local mysteryBoxIdx = result.mystery
GFunc.mergeRewards2(result.rewards, newRewards) 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) end
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() DataManager.GodPigData:addGoldPigCount()

View File

@ -52,10 +52,11 @@ function TipsManager:showItemTips(id, tarPrefabObj, alignType)
UIManager:showUI("app/ui/tips/item_tips", params) UIManager:showUI("app/ui/tips/item_tips", params)
end end
function TipsManager:showRewardsTips(rewards, customTitleStr, tarPrefabObj, alignType) function TipsManager:showRewardsTips(rewards, customTitleStr, tarPrefabObj, callback, alignType)
local params = { local params = {
rewards = rewards, rewards = rewards,
customTitleStr = customTitleStr, customTitleStr = customTitleStr,
callback = callback,
aniType = UIManager.ANI_TYPE.NONE, aniType = UIManager.ANI_TYPE.NONE,
} }
if tarPrefabObj then if tarPrefabObj then

View File

@ -9,6 +9,7 @@ end
function BattleResultUI:ctor(params) function BattleResultUI:ctor(params)
self.rewards = params.rewards self.rewards = params.rewards
self.combatReport = params.combatReport self.combatReport = params.combatReport
self.mysteryBoxIdx = params.mysteryBoxIdx or 0
self.totalDmg = 0 self.totalDmg = 0
if self.combatReport.atkReport then if self.combatReport.atkReport then
for _, info in ipairs(self.combatReport.atkReport) do for _, info in ipairs(self.combatReport.atkReport) do
@ -103,6 +104,7 @@ function BattleResultUI:refreshRewards()
end) end)
self.scrollRectComp:addRefreshCallback(function(index, cell) self.scrollRectComp:addRefreshCallback(function(index, cell)
cell:refresh(self.rewards[index]) cell:refresh(self.rewards[index])
cell:showLeftUpIcon(index <= self.mysteryBoxIdx, GConst.ATLAS_PATH.COMMON, "common_chest_1")
end) end)
self.scrollRectComp:setFadeArgs(0.05, 0.3) self.scrollRectComp:setFadeArgs(0.05, 0.3)
self.scrollRectComp:clearCells() self.scrollRectComp:clearCells()

View File

@ -884,6 +884,7 @@ function BattleUI:eliminationAni(aniSequence, effectGridMap, callback)
end end
local baseObject = entity:getCell():getBaseObject() local baseObject = entity:getCell():getBaseObject()
baseObject:getTransform():SetAsLastSibling() baseObject:getTransform():SetAsLastSibling()
local anitime = 0
if info.aniPosList then if info.aniPosList then
local posList = {} local posList = {}
local count = 0 local count = 0
@ -891,17 +892,8 @@ function BattleUI:eliminationAni(aniSequence, effectGridMap, callback)
table.insert(posList, ModuleManager.BattleManager:getPosInfo(posId)) table.insert(posList, ModuleManager.BattleManager:getPosInfo(posId))
count = count + 1 count = count + 1
end 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)) 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 else
if info.noAni then if info.noAni then
baseObject:setAnchoredPositionX(DEFAULT_X) baseObject:setAnchoredPositionX(DEFAULT_X)
@ -918,9 +910,24 @@ function BattleUI:eliminationAni(aniSequence, effectGridMap, callback)
obj:play() obj:play()
end) end)
end) end)
self.eliminationAniSeq:Insert(time + 0.2, baseObject:getTransform():DOAnchorPos(self:getElementSkillPos(entity:getElementType()), 0.3)) local targetPos = self:getElementSkillPos(entity:getElementType())
self.eliminationAniSeq:Insert(time + 0.2, baseObject:getTransform():DOScale(0.5, 0.3)) 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 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
end end

View File

@ -8,6 +8,7 @@ function RewardCell:init()
self.check = uiMap["reward_cell.check"] self.check = uiMap["reward_cell.check"]
self.numTx = uiMap["reward_cell.item_bg.num"] self.numTx = uiMap["reward_cell.item_bg.num"]
self.fragment = uiMap["reward_cell.item_bg.fragment"] 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.frameAni = uiMap["reward_cell.frame_ani"]
self:hideFrameAnimation() self:hideFrameAnimation()
self.baseObject:addClickListener(function() self.baseObject:addClickListener(function()
@ -139,4 +140,12 @@ function RewardCell:hideFrameAnimation()
self.frameAni:setVisible(false) self.frameAni:setVisible(false)
end 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 return RewardCell

View File

@ -5,6 +5,7 @@ function RewardsTips:ctor(params)
self.params = params self.params = params
self.tarCornerScreenPos = params.tarCornerScreenPos self.tarCornerScreenPos = params.tarCornerScreenPos
self.location = params.location self.location = params.location
self.callback = params.callback
end end
function RewardsTips:getPrefabPath() function RewardsTips:getPrefabPath()
@ -65,6 +66,9 @@ function RewardsTips:onClose()
tipsBgTransform.anchoredPosition = self.originAnchoredPosition tipsBgTransform.anchoredPosition = self.originAnchoredPosition
tipsBgTransform.localPosition = self.originLocalPosition tipsBgTransform.localPosition = self.originLocalPosition
end end
if self.callback then
self.callback()
end
end end
return RewardsTips return RewardsTips

View File

@ -386,4 +386,8 @@ function BattleGridEntity:getEffectTrigger()
return self:getGridTypeConfig().effect_trigger return self:getGridTypeConfig().effect_trigger
end end
function BattleGridEntity:getBreakFlyToCharacter()
return self:getGridTypeConfig().break_fly_to_character == 1
end
return BattleGridEntity return BattleGridEntity

View File

@ -297,11 +297,12 @@ function ChapterData:openBox(chapterId, index)
self:setDirty() self:setDirty()
end end
function ChapterData:fightChapter(chapterId, maxChapterId, maxWave) function ChapterData:fightChapter(chapterId, maxChapterId, maxWave, mysteryBoxIdx)
if not self.data.chapterInfo[chapterId] then if not self.data.chapterInfo[chapterId] then
self.data.chapterInfo[chapterId] = { self.data.chapterInfo[chapterId] = {
total_count = 0, total_count = 0,
index = {} index = {},
mystery_box_idx = {}
} }
end end
self.data.chapterInfo[chapterId].total_count = (self.data.chapterInfo[chapterId].total_count or 0) + 1 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 self.data.maxChapterId = maxChapterId - 1
end 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() self:setDirty()
end 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 return ChapterData