From 1394f8630dbdcd3f87ab79a7392c048d92b60e39 Mon Sep 17 00:00:00 2001 From: puxuan <413323644@qq.com> Date: Tue, 21 Oct 2025 16:06:59 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A9=E8=B5=8B=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/ui/talent/cell/talent_cell.lua | 4 ++ lua/app/ui/talent/talent_main_ui.lua | 72 ++++++++++++++++++++++++-- 2 files changed, 71 insertions(+), 5 deletions(-) diff --git a/lua/app/ui/talent/cell/talent_cell.lua b/lua/app/ui/talent/cell/talent_cell.lua index c4c68c4d..58afa3b8 100644 --- a/lua/app/ui/talent/cell/talent_cell.lua +++ b/lua/app/ui/talent/cell/talent_cell.lua @@ -44,4 +44,8 @@ function TalentCell:setActive(active) self.baseObject:setActive(active) end +function TalentCell:setLocalScale(scaleX, scaleY, scaleZ) + self.baseObject:setLocalScale(scaleX, scaleY, scaleZ) +end + return TalentCell \ No newline at end of file diff --git a/lua/app/ui/talent/talent_main_ui.lua b/lua/app/ui/talent/talent_main_ui.lua index 3285df90..d4ad179f 100644 --- a/lua/app/ui/talent/talent_main_ui.lua +++ b/lua/app/ui/talent/talent_main_ui.lua @@ -9,6 +9,12 @@ function TalentMainUI:isFullScreen() return false end +function TalentMainUI:onClose() + if self.aniSeq then + self.aniSeq:Kill() + end +end + function TalentMainUI:getCurrencyParams() if self.currencyParams == nil then self.currencyParams = { @@ -36,8 +42,13 @@ function TalentMainUI:onLoadRootComplete() self.descTx = uiMap["talent_ui.desc_tx"] self.upNode = uiMap["talent_ui.up_node"] self.upTalentCell = uiMap["talent_ui.up_node.node.talent_cell"]:addLuaComponent(TALENT_CELL) + self.flyTalentCell = uiMap["talent_ui.talent_node.talent_cell"]:addLuaComponent(TALENT_CELL) + self.flyTalentNode = uiMap["talent_ui.talent_node"] + self.flyTalentNode:setActive(false) self.upDescTx = uiMap["talent_ui.up_node.desc_tx"] self.upNode:setActive(false) + self.touchNode = uiMap["talent_ui.touch_node"] + self.touchNode:setActive(false) self.vfx01s = {} self.vfx02s = {} for i = 1, 3 do @@ -66,16 +77,29 @@ function TalentMainUI:onLoadRootComplete() return end ModuleManager.TalentManager:talentUpgrade() + -- self.id = math.random(1, 16) + -- self.flyTalentCell:refresh(self.id, self.list[self.id], true) + -- local cell = self.scrollRect:getListCellByIndex(self.id) + -- -- self.scrollRect:moveToIndex(self.id) + -- self.flyEndPos = GFunc.getTargetAnchoredPosition(cell:getBaseObject(), self.root) + -- self:fly() end) self.upNode:addClickListener(function() self.upNode:setActive(false) - DataManager.HeroData:calcPower() + if self.id then + local cell = self.scrollRect:getListCellByIndex(self.id) + if self.id < 5 or self.id > 12 then + self.scrollRect:moveToIndex(self.id) + end + self.flyEndPos = GFunc.getTargetAnchoredPosition(cell:getBaseObject(), self.root) + self:fly() + end end) self:bind(DataManager.TalentData, "isDirty", function() self:onUpgrade() - self:onRefresh() + -- self:onRefresh() end) end @@ -108,9 +132,12 @@ function TalentMainUI:onUpgrade() end self.upNode:setActive(true) self.upTalentCell:refresh(upData.id, self.list[upData.id], true) + self.flyTalentCell:refresh(upData.id, self.list[upData.id]) + self.flyTalentNode:setActive(false) + self.id = upData.id - local attr, num = DataManager.TalentData:getAttrById(upData.id) - local str = I18N:getText("talent", upData.id, "desc") + local attr, num = DataManager.TalentData:getAttrById(self.id) + local str = I18N:getText("talent", self.id, "desc") if attr and #attr > 0 then str = str .. GFunc.getFinalAttrValue(attr[1].type, attr[1].num) elseif self.id == DataManager.TalentData.SELECT_SKILL_ID then @@ -127,7 +154,7 @@ function TalentMainUI:onUpgrade() self.upDescTx:setActive(true) end, 0.5) - local qlt = self.list[upData.id].qlt + local qlt = self.list[self.id].qlt for i = 1, 3 do if i == qlt then self.vfx01s[i]:setActive(true) @@ -139,4 +166,39 @@ function TalentMainUI:onUpgrade() end end +function TalentMainUI:disableTouch() + self.touchNode:setActive(true) +end + +function TalentMainUI:enableTouch() + self.touchNode:setActive(false) +end + +function TalentMainUI:fly() + if self.aniSeq then + self.aniSeq:Kill() + end + self:disableTouch() + self.flyTalentNode:setActive(true) + local scale = 0.56 + local beginPos = {x = 0, y = 98} + self.flyTalentNode:setAnchoredPosition(beginPos.x, beginPos.y) + local maxDis = 1000 + local dis = BF.Vector2Distance(beginPos, self.flyEndPos) + local time = dis/maxDis + local aniSeq = self.flyTalentNode:createBindTweenSequence() + -- local transform = self.flyTalentCell:getBaseObject():getTransform() + aniSeq:Append(self.flyTalentNode:getTransform():DOScale(BF.Vector3(scale, scale, scale), 0.5):SetEase(CS.DG.Tweening.Ease.InCubic)) + aniSeq:Append(self.flyTalentNode:getTransform():DOAnchorPos(self.flyEndPos, time):SetEase(CS.DG.Tweening.Ease.InCubic)) + -- aniSeq:Join(transform:DOScale(BF.Vector3(0.1, 0.1, 0.1), time):SetEase(CS.DG.Tweening.Ease.InCubic)) + aniSeq:AppendCallback(function() + self.flyTalentNode:setActive(false) + self.flyTalentNode:setLocalScale(1, 1, 1) + self:onRefresh() + DataManager.HeroData:calcPower() + self:enableTouch() + end) + self.aniSeq = aniSeq +end + return TalentMainUI \ No newline at end of file