From fd70f87d65b5e4da636107c38bad9b54b79daca6 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Tue, 25 Apr 2023 23:01:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A8=E7=94=BB=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/ui/battle/battle_ui.lua | 58 +++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index b77407ca..4106f357 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -11,8 +11,8 @@ local BOARD_POS_DOWN = BF.Vector2(0, -740) local BG_PATH = "assets/arts/textures/background/battle/%s.png" local CacheVector2 = CS.UnityEngine.Vector2(0, 0) -local CACHE_SKILL_POS_1 = {x = 0, y = 360} -local CACHE_SKILL_POS_2 = {x = 0, y = 420} +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" function BattleUI:getPrefabPath() @@ -1036,7 +1036,7 @@ function BattleUI:doCacheAni(skillInfo, callback) self.cacheSkillAniSeq:AppendCallback(function() self.boardCacheBox:setAnchoredPositionX(- w) end) - self.cacheSkillAniSeq:Append(self.boardCacheBox:getTransform():DOAnchorPosX(0, 0.5)) + for index, info in ipairs(skillInfo) do local entity = self.root.skillAniGridEntities[index] if entity then @@ -1053,8 +1053,24 @@ function BattleUI:doCacheAni(skillInfo, callback) gridEntity:getCell():getBaseObject():setAnchoredPositionX(DEFAULT_X) -- 放到屏幕外 end end) - local path = {pos, CACHE_SKILL_POS_2, CACHE_SKILL_POS_1} - self.cacheSkillAniSeq:Insert(0.5 + 0.5 * (index - 1) + 0.02, obj:getTransform():DOLocalPath(path, 1)) + + self.cacheSkillAniSeq:Insert(0.5 * (index - 1) + 0.02, obj:getTransform():DOAnchorPos(CACHE_SKILL_POS_2, 0.7)) + end + end + end + + self.cacheSkillAniSeq:Append(self.boardCacheBox:getTransform():DOAnchorPosX(0, 0.5)) + for index, info in ipairs(skillInfo) do + local entity = self.root.skillAniGridEntities[index] + if entity then + local cell = entity:getCell() + if cell then + local obj = cell:getBaseObject() + if index == 1 then + self.cacheSkillAniSeq:Append(obj:getTransform():DOAnchorPos(CACHE_SKILL_POS_1, 0.3)) + else + self.cacheSkillAniSeq:Join(obj:getTransform():DOAnchorPos(CACHE_SKILL_POS_1, 0.3)) + end end end end @@ -1109,21 +1125,37 @@ function BattleUI:doCachePopAni(skillInfo, callback) obj:setAnchoredPositionX(DEFAULT_X) end) self.cacheSkillAniSeq:InsertCallback(0.5 + 0.5 * (index - 1), function() - obj:setAnchoredPosition(0, 360) + obj:setAnchoredPosition(CACHE_SKILL_POS_1.x, CACHE_SKILL_POS_1. y) end) - local path = {CACHE_SKILL_POS_1, CACHE_SKILL_POS_2, pos} - self.cacheSkillAniSeq:Insert(0.5 + 0.5 * (index - 1) + 0.02, obj:getTransform():DOLocalPath(path, 0.5)) - self.cacheSkillAniSeq:InsertCallback(0.5 + 0.5 * (index - 1) + 0.52, function() - if self.battleController then - self.battleController:setGridSkillId(info.posId, info.skillId) - end - end) + self.cacheSkillAniSeq:Insert(0.5 + 0.5 * (index - 1) + 0.02, obj:getTransform():DOAnchorPos(CACHE_SKILL_POS_2, 0.3)) end end end self.cacheSkillAniSeq:Append(self.boardCacheBox:getTransform():DOAnchorPosX(w, 0.5)) + + for index, info in ipairs(skillInfo) do + local entity = self.root.skillAniGridEntities[index] + if entity then + local pos = ModuleManager.BattleManager:getPosInfo(info.posId) + local cell = entity:getCell() + if cell then + local obj = cell:getBaseObject() + if index == 1 then + self.cacheSkillAniSeq:Append(obj:getTransform():DOAnchorPos(pos, 0.7)) + else + self.cacheSkillAniSeq:Join(obj:getTransform():DOAnchorPos(pos, 0.7)) + end + end + end + end + self.cacheSkillAniSeq:AppendCallback(function() + for index, info in ipairs(skillInfo) do + if self.battleController then + self.battleController:setGridSkillId(info.posId, info.skillId) + end + end self.boardCacheNode:setVisible(false) self:enableUITouch() if callback then