From b7614062f057bdcc0449f5d918bde438ebf3e90f Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Tue, 30 May 2023 17:42:02 +0800 Subject: [PATCH 1/2] =?UTF-8?q?boss=E5=85=A5=E5=9C=BA=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/bf/unity/ui_spine_object.lua | 31 ++++++++++++++++++++ lua/app/global/global_const.lua | 1 + lua/app/ui/battle/battle_ui.lua | 42 ++++++++++++++++++++-------- 3 files changed, 62 insertions(+), 12 deletions(-) diff --git a/lua/app/bf/unity/ui_spine_object.lua b/lua/app/bf/unity/ui_spine_object.lua index 05011a8a..414a5ce1 100644 --- a/lua/app/bf/unity/ui_spine_object.lua +++ b/lua/app/bf/unity/ui_spine_object.lua @@ -51,6 +51,37 @@ function UISpineObject:playAnim(animName, loop, forceRefresh, forceGetSG) end end +function UISpineObject:getAnimationKeyFrameTime(animName) + if not self.animationKeyFrameTime then + self.animationKeyFrameTime = {} + end + local timeList = self.animationKeyFrameTime[animName] + if not timeList then + timeList = {} + self.animationKeyFrameTime[animName] = timeList + if not self.uiSpineHelper then + self.uiSpineHelper = self:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_UI_SPINE_HELPER) + if self.uiSpineHelper == nil then + self.uiSpineHelper = self:addComponent(GConst.TYPEOF_UNITY_CLASS.BF_UI_SPINE_HELPER) + end + end + local list = self.uiSpineHelper:GetAnimationKeyFrameTime(animName) + local count = list.Count + if count > 0 then + for i = 1, count do + table.insert(timeList, list[i - 1]) + end + end + end + return timeList +end + +function UISpineObject:clearAnimationKeyFrameTime() + for aniName, _ in pairs(self.animationKeyFrameTime) do + self.animationKeyFrameTime[aniName] = nil + end +end + --未验证TODO function UISpineObject:rePlayAnim(animName, loop, forceRefresh) self:getAnimationState() diff --git a/lua/app/global/global_const.lua b/lua/app/global/global_const.lua index b25e8a54..83dc1200 100644 --- a/lua/app/global/global_const.lua +++ b/lua/app/global/global_const.lua @@ -148,6 +148,7 @@ GConst.TYPEOF_UNITY_CLASS = { BF_UI_ERASER_TEXTURE = typeof(CS.BF.UIEraserTexture), BF_UNITY_SLIDER = typeof(CS.BF.BFUnitySlider), BF_ELIMINATION_TOUCH_EVENT = typeof(CS.BF.EliminationTouchEvent), + BF_UI_SPINE_HELPER = typeof(CS.BF.UISpineHelper), } -- lua 组件 diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index f6cd5280..825376c6 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -15,6 +15,7 @@ local CacheVector2 = CS.UnityEngine.Vector2(0, 0) local CACHE_SKILL_POS_1 = {x = 10, y = 360} local CACHE_SKILL_POS_2 = {x = 10, y = 420} local BATTLE_COMMON_PATH = "assets/arts/textures/background/battle_common/%s.png" +local BOARD_SFX_ORDER = 13 function BattleUI:getPrefabPath() return "assets/prefabs/ui/battle/battle_ui.prefab" @@ -1562,7 +1563,7 @@ function BattleUI:getSfxLine(index, func) self.root.lineSfxObjs[index] = { isLoaded = true } - EffectManager:loadUIEffectAsync(GConst.BattleConst.LINE_SFX, self, self.gridNode, 11, function(obj) + EffectManager:loadUIEffectAsync(GConst.BattleConst.LINE_SFX, self, self.gridNode, BOARD_SFX_ORDER, function(obj) self.root.lineSfxObjs[index].obj = obj if self.hidingAllSfxLine then obj:setActive(false) @@ -1653,7 +1654,7 @@ function BattleUI:getSfxSmoke(index, func) self.root.smokeSfxObjs[index] = { isLoaded = true } - EffectManager:loadUIEffectAsync(GConst.BattleConst.LINK_SMOKE, self, self.gridNode, 11, function(obj) + EffectManager:loadUIEffectAsync(GConst.BattleConst.LINK_SMOKE, self, self.gridNode, BOARD_SFX_ORDER, function(obj) self.root.smokeSfxObjs[index].obj = obj obj:setLocalScale(1.5, 1.5, 1.5) if self.hidingAllSfxSmoke then @@ -1843,7 +1844,7 @@ function BattleUI:initUISfxs() for index, info in pairs(self.root.lineSfxObjs) do if info.obj then info.obj:setActive(true) - info.obj:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_EFFECT_HELPER):SetSortingOrder(self:getUIOrder(), 11) + info.obj:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_EFFECT_HELPER):SetSortingOrder(self:getUIOrder(), BOARD_SFX_ORDER) info.obj:setActive(false) end end @@ -1853,7 +1854,7 @@ function BattleUI:initUISfxs() for index, info in pairs(self.root.smokeSfxObjs) do if info.obj then info.obj:setActive(true) - info.obj:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_EFFECT_HELPER):SetSortingOrder(self:getUIOrder(), 11) + info.obj:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_EFFECT_HELPER):SetSortingOrder(self:getUIOrder(), BOARD_SFX_ORDER) info.obj:setActive(false) end end @@ -2035,7 +2036,7 @@ end function BattleUI:initBossEnterAni() local uiMap = self.root:genAllChildren() self.bossEnterNode = uiMap["battle_ui.bg_2.boss_enter_node"] - self.bossEnterImg = uiMap["battle_ui.bg_2.boss_enter_node.img"] + self.bossEnterImg = uiMap["battle_ui.bg_2.boss_enter_node.ui_spine_obj"] self.bossName = uiMap["battle_ui.bg_2.boss_enter_node.boss_name"] self.bossEnterNodeCanvasGroup = self.bossEnterNode:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP) self.bossEnterNode:setVisible(false) @@ -2051,9 +2052,15 @@ function BattleUI:showBossEnterAni(bornTime, bossName, monsterComp, callback) end self.bossEnterNode:setVisible(true) self.bossEnterImg:setVisible(false) - self.bossName:setText(GConst.EMPTY_STRING) + self.bossName:setText(bossName) + self.bossName:setAnchoredPositionX(-800) self.bossEnterNodeCanvasGroup.alpha = 0 monsterComp:getBaseObject():setLocalPosition(DEFAULT_X, 0, 0) + local keyFrameTimes = self.bossEnterImg:getAnimationKeyFrameTime("idle") + local keyFrameTime = 0 + if keyFrameTimes then + keyFrameTime = keyFrameTimes[1] or 0 + end if self.bossEnterAniSeq then self.bossEnterAniSeq:Kill() self.bossEnterAniSeq = nil @@ -2062,23 +2069,34 @@ function BattleUI:showBossEnterAni(bornTime, bossName, monsterComp, callback) self.bossEnterAniSeq:Append(self.bossEnterNodeCanvasGroup:DOFade(1, 0.2)) self.bossEnterAniSeq:AppendCallback(function() self.bossEnterImg:setVisible(true) + self.bossEnterImg:playAnim("idle", false, true) monsterComp:initPosition() monsterComp:getBaseObject():setParent(self.maxLayerNode, false) if callback then callback() end - self.battleController:showBuffTips(GConst.BattleConst.SIDE_DEF, true) end) - self.bossEnterAniSeq:AppendInterval(bornTime) - self.bossEnterAniSeq:AppendCallback(function() - self.bossName:setText(bossName) - end) - self.bossEnterAniSeq:AppendInterval(0.5) + self.bossEnterAniSeq:AppendInterval(2) self.bossEnterAniSeq:Append(self.bossEnterNodeCanvasGroup:DOFade(0, 0.2)) self.bossEnterAniSeq:AppendCallback(function() monsterComp:getBaseObject():setParent(self:getBattleNode(), false) self.bossEnterNode:setVisible(false) + self.battleController:showBuffTips(GConst.BattleConst.SIDE_DEF, true) end) + + if keyFrameTime > 0 then + local addTime = 1 + self.bossEnterAniSeq:InsertCallback(keyFrameTime + 0.2, function() + self.bossName:setText(bossName) + self.battleController:setTimeScale(0) + end) + self.bossEnterAniSeq:Insert(keyFrameTime + 0.2, self.bossName:getTransform():DOAnchorPosX(-212, 0.2)) + self.bossEnterAniSeq:InsertCallback(keyFrameTime + 0.2 + addTime, function() + self.battleController:setTimeScale(DataManager.BattleData:getTimeScale()) + end) + else + self.bossEnterAniSeq:Insert(0.2, self.bossName:getTransform():DOAnchorPosX(-212, 0.2)) + end end function BattleUI:clear() From 676ea6bfe83d8e7d7f4bb6f1a14b0be2bee735ba Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Tue, 30 May 2023 18:12:39 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=98=BE=E7=A4=BAbug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/module/daily_challenge/daily_challenge_manager.lua | 3 +++ lua/app/ui/battle/battle_pause_ui.lua | 2 +- lua/app/ui/daily_challenge/daily_challenge_task_ui.lua | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lua/app/module/daily_challenge/daily_challenge_manager.lua b/lua/app/module/daily_challenge/daily_challenge_manager.lua index 66ed2688..860eb114 100644 --- a/lua/app/module/daily_challenge/daily_challenge_manager.lua +++ b/lua/app/module/daily_challenge/daily_challenge_manager.lua @@ -140,6 +140,9 @@ function DailyChallengeManager:dealTaskProgress(battleController) totalDmg = totalDmg + info.Damage end end + if totalDmg <= 0 then + totalDmg = 1 + end for matchType, damage in pairs(damageMatchTypeMap) do damageMatchTypeMap[matchType] = math.floor(damage / totalDmg * GConst.BattleConst.DEFAULT_FACTOR + 0.000001) diff --git a/lua/app/ui/battle/battle_pause_ui.lua b/lua/app/ui/battle/battle_pause_ui.lua index da06dd67..27745681 100644 --- a/lua/app/ui/battle/battle_pause_ui.lua +++ b/lua/app/ui/battle/battle_pause_ui.lua @@ -121,7 +121,7 @@ function BattlePauseUI:refreshDailyChallengeNode() uiMap["battle_pause_ui.daily_challenge_node.task"]:addClickListener(function() ModuleManager.DailyChallengeManager:showBattleTaskUI() end) - uiMap["battle_pause_ui.daily_challenge_node.buff_title"]:setText(I18N:getGlobalText(I18N.GlobalConst.BUFF_NAME)) + uiMap["battle_pause_ui.daily_challenge_node.buff_title"]:setText(I18N:getGlobalText(I18N.GlobalConst.BUFF_DESC)) uiMap["battle_pause_ui.daily_challenge_node.task_desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.TASK_NAME)) end diff --git a/lua/app/ui/daily_challenge/daily_challenge_task_ui.lua b/lua/app/ui/daily_challenge/daily_challenge_task_ui.lua index 1d61f857..2f6755d5 100644 --- a/lua/app/ui/daily_challenge/daily_challenge_task_ui.lua +++ b/lua/app/ui/daily_challenge/daily_challenge_task_ui.lua @@ -18,14 +18,14 @@ function DailyChallengeTaskUI:ctor() return end - local progress = ModuleManager.DailyChallengeManager:dealTaskProgress(battleController) + local taskProgress = ModuleManager.DailyChallengeManager:dealTaskProgress(battleController) local tasks = DataManager.DailyChallengeData:getTasks() for index, info in ipairs(tasks) do local id = info.task_id - local progress = progress[id] + local progress = taskProgress[id] if progress then if type(progress) == "table" then - self.taskCurProgress[id] = progress[info.param] + self.taskCurProgress[id] = progress[info.param] or 0 else self.taskCurProgress[id] = progress end