背景移动
This commit is contained in:
parent
726e4af821
commit
7118b8790a
@ -514,6 +514,8 @@ function BattleUnitComp:enterEnterBattlefieldState()
|
|||||||
self.targetX = BattleConst.INIT_POS_X
|
self.targetX = BattleConst.INIT_POS_X
|
||||||
self.moveDirection = -1
|
self.moveDirection = -1
|
||||||
end
|
end
|
||||||
|
local time = math.abs(self.targetX - self.positionX)/BattleConst.MOVE_SPEED
|
||||||
|
self.battleController:moveBattlefield(time)
|
||||||
else
|
else
|
||||||
self:playAnimation(SPINE_ANIMATION_NAME.BORN, false, false)
|
self:playAnimation(SPINE_ANIMATION_NAME.BORN, false, false)
|
||||||
self.waitTime = self:getAnimationDuration(SPINE_ANIMATION_NAME.BORN)
|
self.waitTime = self:getAnimationDuration(SPINE_ANIMATION_NAME.BORN)
|
||||||
|
|||||||
@ -179,6 +179,10 @@ function BattleController:setIsPauseHpProgress(value)
|
|||||||
self.battleUI:setIsPauseHpProgress(value)
|
self.battleUI:setIsPauseHpProgress(value)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleController:moveBattlefield(time)
|
||||||
|
self.battleUI:moveBattlefield(time)
|
||||||
|
end
|
||||||
|
|
||||||
function BattleController:prepareFight()
|
function BattleController:prepareFight()
|
||||||
local count = 0
|
local count = 0
|
||||||
local totalCount = 3
|
local totalCount = 3
|
||||||
|
|||||||
@ -66,6 +66,19 @@ function BattleUI:loadBg(bgName)
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleUI:moveBattlefield(time)
|
||||||
|
local width = self.bg:fastGetSizeDelta()
|
||||||
|
self.bg:setAnchoredPositionX(width/4)
|
||||||
|
if self.bgMoveTween == nil then
|
||||||
|
self.bgMoveTween = self.bg:getTransform():DOAnchorPosX(-width/4, time)
|
||||||
|
self.bgMoveTween:SetIntId(GConst.DOTWEEN_IDS.BATTLE)
|
||||||
|
self.bgMoveTween:SetAutoKill(false)
|
||||||
|
else
|
||||||
|
self.bgMoveTween:ChangeEndValue(width*3/4, time, true)
|
||||||
|
self.bgMoveTween:Restart()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function BattleUI:initSkill()
|
function BattleUI:initSkill()
|
||||||
if self.skillNodeCells then
|
if self.skillNodeCells then
|
||||||
return
|
return
|
||||||
@ -750,6 +763,10 @@ function BattleUI:clear()
|
|||||||
self.hpProgressYellowRightTween:Kill()
|
self.hpProgressYellowRightTween:Kill()
|
||||||
self.hpProgressYellowRightTween = nil
|
self.hpProgressYellowRightTween = nil
|
||||||
end
|
end
|
||||||
|
if self.bgMoveTween then
|
||||||
|
self.bgMoveTween:Kill()
|
||||||
|
self.bgMoveTween = nil
|
||||||
|
end
|
||||||
if self.battleNumberNode then
|
if self.battleNumberNode then
|
||||||
self.battleNumberNode:removeAllChildren()
|
self.battleNumberNode:removeAllChildren()
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user