天赋动画

This commit is contained in:
puxuan 2025-10-21 16:06:59 +08:00
parent 6f87b9f938
commit 1394f8630d
2 changed files with 71 additions and 5 deletions

View File

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

View File

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