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
guid: 26403a4c77be4584982691a5a64cc90f
guid: 11665dfdb08a75846bfb0d3a63277542
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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 = {

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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)

View File

@ -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()

View File

@ -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

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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