diff --git a/lua/app/bf/unity/effect_object.lua b/lua/app/bf/unity/effect_object.lua index 91a7307c..0ab95f9f 100644 --- a/lua/app/bf/unity/effect_object.lua +++ b/lua/app/bf/unity/effect_object.lua @@ -34,6 +34,18 @@ function EffectObject:play() self.effectHelper:Play() end +function EffectObject:playComplete(complete, customTime) + self.effectHelper:Play() + local duration = customTime or self:getDuration() + if self.playCompleteSeq then + self.playCompleteSeq:Kill() + self.playCompleteSeq = nil + end + self.playCompleteSeq = self:createBindTweenSequence() + self.playCompleteSeq:AppendInterval(duration) + self.playCompleteSeq:AppendCallback(complete) +end + -- 延迟播放 function EffectObject:playDelay(delayTime, hideBeforePlay) if delayTime <= 0 then diff --git a/lua/app/module/account/account_manager.lua b/lua/app/module/account/account_manager.lua index a31e2fa5..94d70632 100644 --- a/lua/app/module/account/account_manager.lua +++ b/lua/app/module/account/account_manager.lua @@ -64,7 +64,7 @@ function AccountManager:onBindAccount(result) loginType = SDKManager.BF_LOGIN_TYPE.APPLE accountInfo.apple_id = result.reqData.id else - accountInfo.googld_id = result.reqData.id + accountInfo.google_id = result.reqData.id end LocalData:setLastLoginInfo(loginType, result.reqData.id, result.reqData.token) LocalData:setAccountInfo(accountInfo) @@ -103,6 +103,22 @@ function AccountManager:changeAccount() if not params.token then return end + local accountInfo = LocalData:getAccountInfo() + local bindId = nil + if Platform:isIosPlatform() then + bindId = accountInfo.apple_id + else + bindId = accountInfo.google_id + end + if bindId and bindId ~= "" and bindId == params.id then + local params = { + content = I18N:getGlobalText(I18N.GlobalConst.CHANGE_ACCOUNT_FAILED_2), + boxType = GConst.MESSAGE_BOX_TYPE.MB_OK, + okText = I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_OK), + } + GFunc.showMessageBox(params) + return + end local args = { type = SDKManager.LOGIN_TYPE[loginType], id = params.id, @@ -120,7 +136,7 @@ function AccountManager:onChangeAccount(result) loginType = SDKManager.BF_LOGIN_TYPE.APPLE accountInfo.apple_id = result.reqData.id else - accountInfo.googld_id = result.reqData.id + accountInfo.google_id = result.reqData.id end LocalData:setLastLoginInfo(loginType, result.reqData.id, result.reqData.token) LocalData:setAccountInfo(accountInfo) diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index ab85face..db3706d2 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -1118,6 +1118,11 @@ function BattleController:dealGridBreak(posId, condition, time, breakedMap, sequ table.insert(aniUnit.aniPosList, id) end end + + ---- 技能效果特效 + aniUnit.effectSfxName = entity:getEffectSfx() + aniUnit.effectSfxFlow = entity:getEffectSfxFlow() + aniUnit.effectSfxDir = entity:getEffectParams()[1] end end aniUnit.bftcTime = entity:getBftcTime() @@ -1175,7 +1180,10 @@ function BattleController:getEliminattionAniInfo(posId, timeIdx) isIdle = false, callback = nil, overCallback = nil, - bftcTime = 0 + bftcTime = 0, + effectSfxName = nil, + effectSfxFlow = nil, + effectSfxDir = nil, } end 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 e148bbc6..16166bb4 100644 --- a/lua/app/module/battle/skill/battle_grid_effect_handle.lua +++ b/lua/app/module/battle/skill/battle_grid_effect_handle.lua @@ -30,7 +30,13 @@ local function _crossSpread(entity, gridEntities, battleController, onlyCheck) for _, posId in ipairs(tempList) do local gridEntity = gridEntities[posId] if gridEntity:isEmptyIdle() then - battleController.battleData:setGridType(posId, entity:getGridType() or BattleConst.GRID_TYPE.JELLY) + if battleController.battleUI and entity:getEffectSfx() then + battleController.battleUI:showGridEffectSfx(posId, entity:getEffectSfx(), function() + battleController.battleData:setGridType(posId, entity:getGridType() or BattleConst.GRID_TYPE.JELLY) + end) + else + battleController.battleData:setGridType(posId, entity:getGridType() or BattleConst.GRID_TYPE.JELLY) + end succ = true break end diff --git a/lua/app/module/maincity/maincity_manager.lua b/lua/app/module/maincity/maincity_manager.lua index f4ab3c67..1873819a 100644 --- a/lua/app/module/maincity/maincity_manager.lua +++ b/lua/app/module/maincity/maincity_manager.lua @@ -80,9 +80,9 @@ function MaincityManager:getModuleInSideBarWhere(moduleKey) return nil end - if self.mainCityUI:isInSideBarLeft(moduleKey) then + if mainUI:isInSideBarLeft(moduleKey) then return -1 - elseif self.mainCityUI:isInSideBarRight(moduleKey) then + elseif mainUI:isInSideBarRight(moduleKey) then return 1 else return 0 @@ -95,7 +95,7 @@ function MaincityManager:isActivSideBarModule(moduleKey) return nil end - return self.mainCityUI:isActivSideBarModule(moduleKey) + return mainUI:isActivSideBarModule(moduleKey) end return MaincityManager \ No newline at end of file diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index 4cd96629..9ec99363 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -938,17 +938,8 @@ function BattleUI:eliminationAni(aniSequence, effectGridMap, callback) end) end - if info.breakSfxName then - breakSfxNameIndexMap[info.breakSfxName] = (breakSfxNameIndexMap[info.breakSfxName] or 0) + 1 - local breakIndex = breakSfxNameIndexMap[info.breakSfxName] - self.eliminationAniSeq:InsertCallback(time, function() - self:getSfxGridBreak(info.breakSfxName, breakIndex, function(obj) - local pos = ModuleManager.BattleManager:getPosInfo(info.posId) - obj:setLocalPosition(pos.x, pos.y, 0) - obj:play() - end) - end) - end + self:dealGridBreakSfx(time, info, breakSfxNameIndexMap) + self:dealGridEffectSfx(time, info, breakSfxNameIndexMap, entity) time = time + (info.bftcTime or 0) if info.isIdle then @@ -1030,6 +1021,80 @@ function BattleUI:eliminationAni(aniSequence, effectGridMap, callback) end self:refreshSkill() + self:resetParentAllSfxGridBreak() + self.eliminationAniSeq = nil + end) +end + +function BattleUI:dealGridBreakSfx(time, info, breakSfxNameIndexMap) + if info.breakSfxName then + breakSfxNameIndexMap[info.breakSfxName] = (breakSfxNameIndexMap[info.breakSfxName] or 0) + 1 + local breakIndex = breakSfxNameIndexMap[info.breakSfxName] + self.eliminationAniSeq:InsertCallback(time, function() + self:getSfxGridBreak(info.breakSfxName, breakIndex, function(obj) + local pos = ModuleManager.BattleManager:getPosInfo(info.posId) + obj:setLocalPosition(pos.x, pos.y, 0) + obj:play() + end) + end) + end +end + +function BattleUI:dealGridEffectSfx(time, info, breakSfxNameIndexMap, entity) + if not self.eliminationAniSeq then + return + end + + self.flowEffects = table.clearOrCreate(self.flowEffects) + if info.effectSfxName then + breakSfxNameIndexMap[info.effectSfxName] = (breakSfxNameIndexMap[info.effectSfxName] or 0) + 1 + local breakIndex = breakSfxNameIndexMap[info.effectSfxName] + self.eliminationAniSeq:InsertCallback(time, function() + self:getSfxGridBreak(info.effectSfxName, breakIndex, function(obj) + if not self.eliminationAniSeq then -- 动画已结束 + obj:setActive(false) + return + end + if info.effectSfxFlow then + obj:setParent(entity:getCell():getBaseObject(), false) + obj:setLocalPosition(0, 0, 0) + obj:play() + table.insert(self.flowEffects, obj) + else + local pos = ModuleManager.BattleManager:getPosInfo(info.posId) + obj:setLocalPosition(pos.x, pos.y, 0) + obj:play() + end + + if info.effectSfxDir == GConst.BattleConst.BOARD_RANGE_TYPE.UP then + obj:setLocalEulerAngles(0, 0, 0) + elseif info.effectSfxDir == GConst.BattleConst.BOARD_RANGE_TYPE.DOWN then + obj:setLocalEulerAngles(0, 0, 180) + elseif info.effectSfxDir == GConst.BattleConst.BOARD_RANGE_TYPE.LEFT then + obj:setLocalEulerAngles(0, 0, 90) + elseif info.effectSfxDir == GConst.BattleConst.BOARD_RANGE_TYPE.RIGHT then + obj:setLocalEulerAngles(0, 0, -90) + else + obj:setLocalEulerAngles(0, 0, 0) + end + end) + end) + end +end + +function BattleUI:showGridEffectSfx(posId, sfxName, callback) + self:getSfxGridEffect(sfxName, function(info) + info.isIdle = false + local pos = ModuleManager.BattleManager:getPosInfo(posId) + info.obj:setLocalPosition(pos.x, pos.y, 0) + info.obj:setActive(true) + info.obj:playComplete(function() + info.isIdle = true + info.obj:setActive(false) + if callback then + callback() + end + end) end) end @@ -1635,12 +1700,53 @@ function BattleUI:hideAllSfxGridBreak() for breakSfxPath, map in pairs(self.root.gridBreakSfxObjs) do for index, info in pairs(map) do if info.obj then + info.obj:setParent(self.gridNode, false) info.obj:setActive(false) end end end end +function BattleUI:resetParentAllSfxGridBreak() + for _, obj in ipairs(self.flowEffects) do + obj:setActive(false) + obj:setParent(self.gridNode, true) + end +end + +function BattleUI:getSfxGridEffect(effectSfxPath, func) + if not effectSfxPath then + return + end + + if not self.root.gridEffectSfx then + self.root.gridEffectSfx = {} + end + if not self.root.gridEffectSfx[effectSfxPath] then + self.root.gridEffectSfx[effectSfxPath] = {} + end + local count = 0 + for index, info in pairs(self.root.gridEffectSfx[effectSfxPath]) do + if info.isIdle then + func(self.root.gridEffectSfx[effectSfxPath][index]) + return + end + count = count + 1 + end + + local index = count + 1 + self.root.gridEffectSfx[effectSfxPath][index] = { + isLoaded = true, + } + EffectManager:loadUIEffectAsync(effectSfxPath, self, self.gridNode, GConst.UI_EFFECT_ORDER.LEVEL5, function(obj) + self.root.gridEffectSfx[effectSfxPath][index].obj = obj + self.root.gridEffectSfx[effectSfxPath][index].isIdle = true + if func then + func(self.root.gridEffectSfx[effectSfxPath][index]) + end + end) +end + function BattleUI:getSfxSmoke(index, func) self.hidingAllSfxSmoke = false @@ -1843,6 +1949,18 @@ function BattleUI:initUISfxs() end end + if self.root.gridEffectSfx then + for breakSfxPath, list in pairs(self.root.gridEffectSfx) do + for index, info in pairs(list) do + if info.obj then + info.obj:setActive(true) + info.obj:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_EFFECT_HELPER):SetSortingOrder(self:getUIOrder(), GConst.UI_EFFECT_ORDER.LEVEL5) + info.obj:setActive(false) + end + end + end + end + if self.root.lineSfxObjs then for index, info in pairs(self.root.lineSfxObjs) do if info.obj then @@ -2199,6 +2317,11 @@ function BattleUI:clear() self.bossEnterAniSeq:Kill() self.bossEnterAniSeq = nil end + + if self.showGridEffectSfxSid then + self:unscheduleGlobal(self.showGridEffectSfxSid) + self.showGridEffectSfxSid = nil + end end return BattleUI \ 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 4ad6684a..da58cc07 100644 --- a/lua/app/userdata/battle/battle_grid_entity.lua +++ b/lua/app/userdata/battle/battle_grid_entity.lua @@ -414,4 +414,23 @@ function BattleGridEntity:getBftcTime() return self:getGridTypeConfig().bftc_time or 0 end +function BattleGridEntity:getEffectSfx() + local sfxName = self:getGridTypeConfig().effect_sfx + if not sfxName then + return + end + + if not self.cacheEffectSfxPaths then + self.cacheEffectSfxPaths = {} + end + if not self.cacheEffectSfxPaths[sfxName] then + self.cacheEffectSfxPaths[sfxName] = "assets/prefabs/effects/battle/" .. sfxName .. ".prefab" + end + return self.cacheEffectSfxPaths[sfxName] +end + +function BattleGridEntity:getEffectSfxFlow() + return self:getGridTypeConfig().sfx_flow +end + return BattleGridEntity \ No newline at end of file