SK_LongZhu
DESKTOP-RH64908\Administrator 2025-08-19 18:24:03 +08:00
parent d5e5b30b4a
commit ce3f739698
1 changed files with 425 additions and 427 deletions

View File

@ -1,5 +1,4 @@

local Bezier = require("Base.Bezier")
local Bezier = require("Base.Bezier")
local SkillLogicConfig = ConfigManager.GetConfig(ConfigName.SkillLogicConfig)
local BuffEffectConfig = ConfigManager.GetConfig(ConfigName.BuffEffectConfig)
local skillConfig = ConfigManager.GetConfig(ConfigName.SkillConfig)
@ -100,7 +99,9 @@ function SkillCaster:OnSkillCast(skill)
--LogError(tostring(postion))
--LogError(tostring(Vector3.New(postion.x-(self.owner.camp==0 and posx or(-posx)),postion.y+posy,postion.z)))
LogError("===========================:" .. self.owner.RoleLiveGO.name)
self.owner.RoleLiveGO.transform:DOMove(Vector3.New(postion.x-(self.owner.camp==0 and posx or(-posx)),postion.y+posy,startPos.z), combat.AttackDisplaceTime/1000, false):OnComplete(function ()
self.owner.RoleLiveGO.transform:DOMove(
Vector3.New(postion.x - (self.owner.camp == 0 and posx or (-posx)), postion.y + posy, startPos.z),
combat.AttackDisplaceTime / 1000, false):OnComplete(function()
local Canvas = self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas")
if Canvas == nil then
Canvas = self.owner.RoleLiveGO.transform.parent.parent.gameObject:GetComponent("Canvas")
@ -126,20 +127,22 @@ function SkillCaster:OnSkillCast(skill)
--LogError("技能位移Id"..combat.Id.."开始时间"..os.date())
LogError("技能位移Id" .. combat.Id .. "开始时间" .. self.owner.RoleLiveGO.name)
self.owner.RoleLiveGO.transform:DOMove(Vector3.New(t.GameObject.transform.position.x-(self.owner.camp==0 and displaceoffset[1] or(-displaceoffset[1])),t.GameObject.transform.position.y+displaceoffset[2],t.GameObject.transform.position.z), combat.AttackDisplaceTime/1000, false):OnComplete(function ()
self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder= self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder+50
self.owner.RoleLiveGO.transform:DOMove(
Vector3.New(
t.GameObject.transform.position.x -
(self.owner.camp == 0 and displaceoffset[1] or (-displaceoffset[1])),
t.GameObject.transform.position.y + displaceoffset[2], t.GameObject.transform.position.z),
combat.AttackDisplaceTime / 1000, false):OnComplete(function()
self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder = self
.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder + 50
if self.owner.OnSkillPlay then
self.owner:OnSkillPlay(localtype, combat)
--LogError("技能位移Id"..combat.Id.."结束时间"..os.date())
end
end)
end
end
else
if self.owner.RoleLiveGO and self.owner.OnSkillPlay then
self.owner:OnSkillPlay(localtype, combat)
@ -181,11 +184,9 @@ function SkillCaster:OnSkillCast(skill)
if combat.BeforeEffectDelay then
self.owner:DelayFunc(combat.BeforeEffectDelay / 1000, function()
self:CheckSkillForoleEffect(combat, skill)
end)
else
self:CheckSkillForoleEffect(combat, skill)
end
end
@ -196,7 +197,9 @@ function SkillCaster:OnSkillCast(skill)
end)
-- LogError("Time点2"..os.date())
-- LogError("Time点2.5"..os.date())
self.owner:DelayFunc(combat.ActionTime/1000+0+(combat.EffectType==8 and 0 or combat.BulletTime/1000), function()
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()
-- LogError("ActionTime"..combat.ActionTime/1000)
-- 继续战斗放在特效加载之后,避免特效加载时间对战斗时间得影响
@ -212,13 +215,23 @@ function SkillCaster:OnSkillCast(skill)
-- 调用上层接口
if self.owner.RoleLiveGO and combat.AttackDisplacement == 1 then
LogError("技能返回位移Id"..combat.Id.."开始时间"..os.date().."=="..self.owner.RoleLiveGO.name)
self.owner:DelayFunc(combat.AttackDisplaceBackTime/1000+((type(combat.SkillNumbetTime[1][1]) == "userdata" or combat.SkillNumbetTime[1][1]==0) and 0 or combat.SkillNumbetTime[#combat.SkillNumbetTime][2])/1000, function()
self.owner.RoleLiveGO.transform:DOMove(startPos, combat.AttackDisplaceTime/1000, false):OnComplete(function ()
LogError("技能返回位移Id"..combat.Id.."开始时间"..os.date().."=="..self.owner.RoleLiveGO.name)
local Canvas = self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas")
LogError("技能返回位移Id" .. combat.Id .. "开始时间" .. os.date() .. "==" .. self.owner.RoleLiveGO
.name)
self.owner:DelayFunc(
combat.AttackDisplaceBackTime / 1000 +
((type(combat.SkillNumbetTime[1][1]) == "userdata" or combat.SkillNumbetTime[1][1] == 0) and 0 or combat.SkillNumbetTime[#combat.SkillNumbetTime][2]) /
1000, function()
self.owner.RoleLiveGO.transform:DOMove(startPos, combat.AttackDisplaceTime / 1000,
false)
:OnComplete(function()
LogError("技能返回位移Id" ..
combat.Id .. "开始时间" .. os.date() .. "==" .. self.owner.RoleLiveGO.name)
local Canvas = self.owner.RoleLiveGO.transform.parent.gameObject
:GetComponent(
"Canvas")
if Canvas == nil then
Canvas = self.owner.RoleLiveGO.transform.parent.parent.gameObject:GetComponent("Canvas")
Canvas = self.owner.RoleLiveGO.transform.parent.parent.gameObject
:GetComponent("Canvas")
end
Canvas.sortingOrder = Canvas.sortingOrder - 50
self.owner.GameObject:SetActive(true)
@ -228,7 +241,6 @@ function SkillCaster:OnSkillCast(skill)
self.owner:OnSkillEnd()
end
end)
end)
else
--self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder= self.owner.RoleLiveGO.transform.parent.gameObject:GetComponent("Canvas").sortingOrder-50
@ -252,17 +264,11 @@ function SkillCaster:OnSkillCast(skill)
elseif combat.VerticalDrawing == 2 then
self:PlaySkillCastingEffect(combat, skill, function()
_PlaySkill()
end)
end
end)
end
function SkillCaster:PlaySkillCastingEffect(combat, skill, func)
-- 播放casting
self.castingEfectNode:SetActive(false)
@ -324,13 +330,13 @@ function SkillCaster:PlaySkillCastingEffect(combat, skill, func)
end
end)
if func then func() func = nil end
if func then
func()
func = nil
end
end)
end
--横版需要改动
local FullEffectPosition = {
-- My_All = Vector3.New(0, -566, 0),
@ -395,8 +401,8 @@ function SkillCaster:GetEffectPosition(skill)
end
return FullEffectPosition.My_All
end
function SkillCaster:GetMovePosition(skill)
function SkillCaster:GetMovePosition(skill)
local chooseId = skill:GetDirectChooseId()
local chooseLimit = math.floor(chooseId / 10000) % 10
local targets = skill:GetDirectTargets()
@ -430,15 +436,19 @@ function SkillCaster:GetMovePosition(skill)
--return targetPos <= 3 and MoveMentPosition.Enemy_Front or MoveMentPosition.Enemy_Behind
end
elseif chooseLimit == 3 then --队列
local eid = BattleManager.GetCombatIdBySkin(skill.id, self.owner.skinId)
local combat = BattleManager.GetSkillCombat(eid)
local col = (targetPos - 1) % 3 + 1
if targetPos <= 3 then
if targetPos <= 3 or combat.BeforeEffectType ~= 1 then
return targetCamp == 0 and MoveMentPosition["My_COL_" .. col] or MoveMentPosition["Enemy_COL_" .. col]
else
return targetCamp == 0 and (MoveMentPosition["My_COL_"..col] + Vector3.New(-1,0,0)) or (MoveMentPosition["Enemy_COL_"..col] + Vector3.New(1,0,0))
return targetCamp == 0 and (MoveMentPosition["My_COL_" .. col] + Vector3.New(-1, 0, 0)) or
(MoveMentPosition["Enemy_COL_" .. col] + Vector3.New(1, 0, 0))
end
end
return MoveMentPosition.My_All
end
-- function SkillCaster:GetSkillChooseLimit
-- 检测特效旋转
function SkillCaster:CheckRotate(go, orientation)
@ -487,7 +497,6 @@ function SkillCaster:CheckFullSceenSkill(combat, skill,skillduration)
elseif combat.EffectType == 2 then
local path = combat.Bullet
if path then
local pos = self:GetEffectPosition(skill)
if not pos then
return
@ -514,8 +523,6 @@ function SkillCaster:CheckFullSceenSkill(combat, skill,skillduration)
end
BattleManager.AddDelayRecycleRes(path, go, combat.BulletTime == 0 and 4 or combat.BulletTime / 1000)
end
end
-- 全屏弹道特效
elseif combat.EffectType == 3 then
@ -586,9 +593,9 @@ function SkillCaster:CheckFullSceenSkill(combat, skill,skillduration)
-- compnet.transform.sizeDelta = Vector2.New(1000, 1000)
self.owner:PlaySpineAnim(compnet, 0, "play_skill_self", true)
end
BattleManager.AddDelayRecycleRes(combat.Bullet, go2, combat.BulletTime==0 and 4 or combat.BulletTime/1000)
BattleManager.AddDelayRecycleRes(combat.Bullet, go2, combat.BulletTime == 0 and 4 or
combat.BulletTime / 1000)
end
end
-- 全屏特效屏幕中心
@ -658,13 +665,10 @@ function SkillCaster:CheckFullSceenSkill(combat, skill,skillduration)
end
BattleManager.AddDelayRecycleRes(combat.Bullet, go2, skillduration / 1000)
end
end
-- 射线特效(丢子弹?)
elseif combat.EffectType == 7 then
local targets = skill:GetDirectTargets()
for _, target in ipairs(targets) do
local tv = self.owner.RootPanel.GetRoleView(target)
@ -704,7 +708,6 @@ function SkillCaster:CheckFullSceenSkill(combat, skill,skillduration)
--
BattleManager.AddDelayRecycleRes(combat.Bullet, go2, combat.BulletTime / 1000 + 0.2) -- 额外增加0.2秒显示时间
end
end
--近战特效
-- elseif combat.EffectType == 8 then
@ -788,7 +791,6 @@ function SkillCaster:CheckFullSceenSkill(combat, skill,skillduration)
elseif combat.EffectType == 9 then
local path = combat.Bullet
if path then
local pos = self:GetEffectPosition(skill)
if not pos then
return
@ -821,7 +823,6 @@ function SkillCaster:CheckFullSceenSkill(combat, skill,skillduration)
-- 取消高亮
self.owner:DelayFunc(combat.HightLightTime / 1000, function()
self:CheckSkillHitEffect("skill", combat, skill)
end)
-- 判断是否震屏
@ -834,7 +835,6 @@ function SkillCaster:CheckFullSceenSkill(combat, skill,skillduration)
end
function SkillCaster:CalRoleRotate(baseRole, targetRole)
local basePos = baseRole.GameObject.transform.position
local targetPos = targetRole.GameObject.transform.position
@ -855,7 +855,6 @@ function SkillCaster:CalRoleRotate(baseRole, targetRole)
return Vector3.zero
end
function SkillCaster:CheckRoleDistance(baseRoot, role1, role2)
local pos1 = baseRoot.transform:InverseTransformPoint(role1.GameObject.transform.position)
local pos2 = baseRoot.transform:InverseTransformPoint(role2.GameObject.transform.position)
@ -876,7 +875,8 @@ function SkillCaster:CheckSkillForoleEffect(combat, skill)
end
local go
local path = combat.BeforeBullet
local offset = combat.BeforeOffset and Vector3.New(combat.BeforeOffset[1], combat.BeforeOffset[2], 0) or Vector3.zero
local offset = combat.BeforeOffset and Vector3.New(combat.BeforeOffset[1], combat.BeforeOffset[2], 0) or Vector3
.zero
local pos = Vector3.zero
-- 挂在人身上,以人物中心为原点
@ -940,7 +940,8 @@ function SkillCaster:CheckSkillHitEffect(checkType, combat, skill)
-- 特效的偏移量
local offset = combat.HitOffset and Vector3.New(combat.HitOffset[1], combat.HitOffset[2], 0) or Vector3.zero
local sortingOrder = tv.role.camp == 0 and tv.GameObject:GetComponent("Canvas").sortingOrder + 21 or BattleManager.GetBattleSorting() + 20
local sortingOrder = tv.role.camp == 0 and tv.GameObject:GetComponent("Canvas").sortingOrder + 21 or
BattleManager.GetBattleSorting() + 20
local go = BattleManager.LoadAsset(combat.Hit, sortingOrder)
go.transform:SetParent(self.effectRoot.transform)
-- 检测特效旋转
@ -951,14 +952,15 @@ function SkillCaster:CheckSkillHitEffect(checkType, combat, skill)
go.transform.localPosition = tpos + offset
go:SetActive(true)
BattleManager.AddDelayRecycleRes(combat.Hit, go, 5)
end
elseif checkType == "hit" then
-- 被击中时检测,如果是目标命中
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 scale = combat.HitScale and Vector3.New(combat.HitScale[1]/1000, combat.HitScale[2]/1000, 0) or Vector3.One
local sortingOrder = self.owner.role.camp == 0 and self.owner.GameObject:GetComponent("Canvas").sortingOrder + 21 or BattleManager.GetBattleSorting() + 20
local scale = combat.HitScale and Vector3.New(combat.HitScale[1] / 1000, combat.HitScale[2] / 1000, 0) or
Vector3.One
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.SingleHitEffectRoot.transform)
if go2 then
-- 检测特效旋转
@ -973,7 +975,8 @@ function SkillCaster:CheckSkillHitEffect(checkType, combat, skill)
if self:CheckRotate(go2, combat.HitOrientation) then
offset = -offset
end
go2.transform.localPosition = Vector3.zero--self.GameObject.transform.localPosition + Vector3.New(0, self.BuffFloatingCount * 180, 0)
go2.transform.localPosition = Vector3
.zero --self.GameObject.transform.localPosition + Vector3.New(0, self.BuffFloatingCount * 180, 0)
go2.transform.anchoredPosition = offset --Vector2.zero
-- go2.transform:SetParent(self.effectRoot.transform)
go2.transform.localScale = scale
@ -985,12 +988,9 @@ function SkillCaster:CheckSkillHitEffect(checkType, combat, skill)
LogError("HitTime")
end
end
end
-- 检测是否需要震动屏幕
function SkillCaster:checkShake(combat)
-- self.owner.Floater:SetPosition(self.owner.GameObject.transform.position)
@ -1015,7 +1015,6 @@ local plist = {
-- 播放弹道特效
function SkillCaster:RoleViewBullet(combat, target)
if not self.owner.RootPanel.GetRoleView(target) then return end
if not combat then return end
@ -1086,5 +1085,4 @@ function SkillCaster:RoleViewBullet(combat, target)
-- end)
end
return SkillCaster