战斗新增修改spine动画缩放

xiejun 2023-11-08 16:35:53 +08:00
parent 26d8bab9e3
commit ba00dc1132
5 changed files with 32 additions and 19 deletions

View File

@ -1060,6 +1060,7 @@ function this.GetSkillCombat(id)
CloseRangeHit=combat.CloseRangeHit,
AttackDisplaceoffset=combat.AttackDisplaceoffset,
CloseRangeHitOffset=combat.CloseRangeHitOffset,
CloseRangeHitScale=combat.CloseRangeHitScale,
}
end
return _CombatList[id]

View File

@ -1879,4 +1879,15 @@ function BattleUtil.CompareValue(v1, v2, comType)
return v1 <= v2
end
return true
end
function BattleUtil.IsUserDataNull( userData)
if (userData == nil) then -- 如果 userdata 是 nil则为空
return true
else
local metatable = getmetatable(userData)
return metatable == "null_userdata_metatable" -- 否则检查元表
end
end

View File

@ -109,11 +109,11 @@ function EnemyView:onCreate(go, role, position, root, isBoss,enemyId)
local combat = BattleManager.GetSkillCombat(combatId)
self.SkillAttackDisplaceoffset=combat.AttackDisplaceoffset
if combat.CloseRangeHit~=nil and combat.CloseRangeHit~="" then
self.RoleSkillLiveGo=poolManager:LoadLive(combat.CloseRangeHit, go.transform.parent, Vector3.one, Vector3.zero)
self.RoleSkillLiveGo=poolManager:LoadLive(combat.CloseRangeHit, go.transform.parent, combat.CloseRangeHitScale==nil and Vector3.one or Vector3.New( combat.CloseRangeHitScale[1]/1000, combat.CloseRangeHitScale[2]/1000,1), Vector3.zero)
self.RoleSkillLiveGoTran = self.RoleSkillLiveGo:GetComponent("RectTransform")
self.RoleSkillLiveGoTran:SetParent(self.RoleLiveGO.transform)
self.RoleSkillLiveGoTran.anchoredPosition = Vector2.New(self.outOffset[1], self.outOffset[2])-- * 0.5
self.RoleSkillLiveGoTran.localScale = Vector3.one
--self.RoleSkillLiveGoTran.localScale = Vector3.one
self.RoleSkillLiveGoTran.sizeDelta = Vector2.New(1000, 1000)
self.RoleSkillLiveGoGraphic = self.RoleSkillLiveGo:GetComponent("SkeletonGraphic")
self.RoleSkillLiveGoGraphic.AnimationState:SetAnimation(0, "idle", true)
@ -122,7 +122,7 @@ function EnemyView:onCreate(go, role, position, root, isBoss,enemyId)
local combat2 = BattleManager.GetSkillCombat(combatId2)
self.superSkillAttackDisplaceoffset=combat2.AttackDisplaceoffset
if combat2.CloseRangeHit~=nil and combat2.CloseRangeHit~="" then
self.RoleSkillLiveGo2=poolManager:LoadLive(combat2.CloseRangeHit, go.transform.parent, Vector3.one, Vector3.zero)
self.RoleSkillLiveGo2=poolManager:LoadLive(combat2.CloseRangeHit, go.transform.parent, combat2.CloseRangeHitScale==nil and Vector3.one or Vector3.New( combat2.CloseRangeHitScale[1]/1000, combat2.CloseRangeHitScale[2]/1000,1), Vector3.zero)
self.RoleSkillLiveGoTran2 = self.RoleSkillLiveGo2:GetComponent("RectTransform")
self.RoleSkillLiveGoTran2:SetParent(self.RoleLiveGO.transform)
-- self.RoleSkillLiveGoTran2.anchoredPosition = Vector2.New(self.outOffset[1], self.outOffset[2])-- * 0.5
@ -132,7 +132,7 @@ function EnemyView:onCreate(go, role, position, root, isBoss,enemyId)
self.RoleSkillLiveGoTran2.localPosition = Vector2.New(0, 0)-- * 0.5
end
self.RoleSkillLiveGoTran2.localScale = Vector3.one
-- self.RoleSkillLiveGoTran2.localScale = Vector3.one
self.RoleSkillLiveGoTran2.sizeDelta = Vector2.New(1000, 1000)
self.RoleSkillLiveGoGraphic2 = self.RoleSkillLiveGo2:GetComponent("SkeletonGraphic")
-- local t= self.RoleLiveGOGraphic.SkeletonData.animations

View File

@ -156,11 +156,11 @@ function PlayerView:onCreate(go, role, position, root)
self.combat = BattleManager.GetSkillCombat(combatId)
self.SkillAttackDisplaceoffset=self.combat.AttackDisplaceoffset
if self.combat.CloseRangeHit~=nil and self.combat.CloseRangeHit~="" then
self.RoleSkillLiveGo=poolManager:LoadLive(self.combat.CloseRangeHit, go.transform.parent, Vector3.one, Vector3.zero)
self.RoleSkillLiveGo=poolManager:LoadLive(self.combat.CloseRangeHit, go.transform.parent,self.combat.CloseRangeHitScale==nil and Vector3.one or Vector3.New( self.combat.CloseRangeHitScale[1]/1000, self.combat.CloseRangeHitScale[2]/1000,1), Vector3.zero)
self.RoleSkillLiveGoTran = self.RoleSkillLiveGo:GetComponent("RectTransform")
self.RoleSkillLiveGoTran:SetParent(self.RoleLiveGO.transform)
self.RoleSkillLiveGoTran.anchoredPosition = Vector2.New(self.outOffset[1], self.outOffset[2])-- * 0.5
self.RoleSkillLiveGoTran.localScale = Vector3.one
-- self.RoleSkillLiveGoTran.localScale = Vector3.one
self.RoleSkillLiveGoTran.sizeDelta = Vector2.New(1000, 1000)
self.RoleSkillLiveGoGraphic = self.RoleSkillLiveGo:GetComponent("SkeletonGraphic")
self.RoleSkillLiveGoGraphic.AnimationState:SetAnimation(0, "idle", true)
@ -174,7 +174,7 @@ function PlayerView:onCreate(go, role, position, root)
if self.combat2.CloseRangeHit~=nil and self.combat2.CloseRangeHit~="" then
self.superSkillAttackDisplaceoffset=self.combat2.AttackDisplaceoffset
self.RoleSkillLiveGo2=poolManager:LoadLive(self.combat2.CloseRangeHit, go.transform.parent, Vector3.one, Vector3.zero)
self.RoleSkillLiveGo2=poolManager:LoadLive(self.combat2.CloseRangeHit, go.transform.parent, self.combat2.CloseRangeHitScale==nil and Vector3.one or Vector3.New( self.combat2.CloseRangeHitScale[1]/1000, self.combat2.CloseRangeHitScale[2]/1000,1), Vector3.zero)
self.RoleSkillLiveGoTran2 = self.RoleSkillLiveGo2:GetComponent("RectTransform")
self.RoleSkillLiveGoTran2:SetParent(self.RoleLiveGO.transform)
-- self.RoleSkillLiveGoTran2.anchoredPosition = Vector2.New(self.outOffset[1], self.outOffset[2])-- * 0.5
@ -183,7 +183,7 @@ function PlayerView:onCreate(go, role, position, root)
else
self.RoleSkillLiveGoTran2.localPosition = Vector2.New(0, 0)-- * 0.5
end
self.RoleSkillLiveGoTran2.localScale = Vector3.one
--self.RoleSkillLiveGoTran2.localScale = Vector3.one
self.RoleSkillLiveGoTran2.sizeDelta = Vector2.New(1000, 1000)
self.RoleSkillLiveGoGraphic2 = self.RoleSkillLiveGo2:GetComponent("SkeletonGraphic")
-- local t= self.RoleLiveGOGraphic.SkeletonData.animations

View File

@ -47,7 +47,7 @@ function SkillCaster:OnSkillCast(skill)
if self.owner.OnSkillCastStart then
self.owner:OnSkillCastStart(skill)
end
LogError("Time点1"..os.date())
self.owner.RootPanel.SetRoleHighLight(self.owner, skill:GetDirectTargets(), function()
-- local duration = combat.KeyFrame/1000
@ -92,7 +92,7 @@ function SkillCaster:OnSkillCast(skill)
end
else
if self.owner.OnSkillPlay then
self.owner:OnSkillPlay(type,combat)
self.owner:OnSkillPlay(localtype,combat)
end
end
-- 播放
@ -119,7 +119,7 @@ function SkillCaster:OnSkillCast(skill)
end
else
if self.owner.OnSkillPlay then
self.owner:OnSkillPlay(type,combat)
self.owner:OnSkillPlay(localtype,combat)
end
end
if self.owner.role.type == BattleUnitType.Role then
@ -133,12 +133,13 @@ function SkillCaster:OnSkillCast(skill)
end
end
LogError("startreturn"..os.date())
--self.actionTime换成combatactiontime
local skillduration=600
self.owner:DelayFunc(combat.KeyFrame/1000, function()
self:CheckFullSceenSkill(combat, skill,skillduration)
end)
LogError("Time点2"..os.date())
self.owner:DelayFunc(combat.ActionTime/1000+0+(combat.EffectType==8 and 0 or combat.BulletTime/1000), function()
-- self.owner:DelayFunc((combat.SkillNumbetTime[1][1]==0 and combat.ActionTime or combat.SkillNumbetTime[#combat.SkillNumbetTime][2])/1000, function()
@ -163,7 +164,7 @@ function SkillCaster:OnSkillCast(skill)
self.owner:OnSkillEnd()
end
end)
LogError("return"..os.date())
LogError("Time点3"..os.date())
end)
else
self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder= self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder-50
@ -500,7 +501,7 @@ function SkillCaster:CheckFullSceenSkill(combat, skill,skillduration)
if compnet~=nil then
-- compnet.transform.localScale = Vector3.one * 3
-- compnet.transform.sizeDelta = Vector2.New(1000, 1000)
self.owner:PlaySpineAnim (compnet,0,"animation",true)
self.owner:PlaySpineAnim (compnet,0,"attack",true)
end
BattleManager.AddDelayRecycleRes(combat.Bullet, go2, skillduration/1000)
@ -668,10 +669,10 @@ function SkillCaster:CheckFullSceenSkill(combat, skill,skillduration)
end
-- 取消高亮
-- self.owner:DelayFunc(combat.KeyFrame/1000, function()
-- self:CheckSkillHitEffect("skill", combat, skill)
self.owner:DelayFunc(combat.KeyFrame/1000, function()
self:CheckSkillHitEffect("skill", combat, skill)
-- end)
end)
-- 判断是否震屏
-- bulletTime +
@ -804,8 +805,8 @@ function SkillCaster:CheckSkillHitEffect(checkType, combat, skill)
if combat.HitEffectType == 1 and combat.Hit then
local offset = combat.HitOffset and Vector3.New(combat.HitOffset[1], combat.HitOffset[2], 0) or Vector3.zero
local sortingOrder = self.owner.role.camp == 0 and self.owner.GameObject:GetComponent("Canvas").sortingOrder + 21 or BattleManager.GetBattleSorting() + 20
local go2 = BattleManager.LoadAsset(combat.Hit, sortingOrder)
-- local sortingOrder = self.owner.role.camp == 0 and self.owner.GameObject:GetComponent("Canvas").sortingOrder + 21 or BattleManager.GetBattleSorting() + 20
local go2 = BattleManager.LoadSpineAsset(combat.Hit, self.owner.GameObject.transform.parent)
go2.transform:SetParent(self.owner.GameObject.transform.parent)
-- 检测特效旋转
if self:CheckRotate(go2, combat.HitOrientation) then