From a4254e28cb0f859f5a40deda5ad93d63923a6f57 Mon Sep 17 00:00:00 2001 From: gaoxin Date: Mon, 2 Nov 2020 11:54:48 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=88=98=E6=96=97=E3=80=91=E7=81=B5?= =?UTF-8?q?=E5=85=BD=E6=8A=80=E8=83=BD=E5=89=8D=E6=91=87=E7=89=B9=E6=95=88?= =?UTF-8?q?=E6=92=AD=E6=94=BE=E4=BD=8D=E7=BD=AE=E8=B0=83=E6=95=B4=EF=BC=8C?= =?UTF-8?q?=E7=81=B5=E5=85=BD=E6=8A=80=E8=83=BD=E6=9D=A1=E4=BB=B6=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E7=B1=BB=E5=9E=8B3=EF=BC=8C=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=81=B5=E5=85=BD=E7=AB=8B=E7=BB=98=E4=B8=8D=E4=BC=9A=E5=9B=9E?= =?UTF-8?q?=E6=94=B6=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Prefabs/UI/Battle/BattlePanel.prefab | 61 ++++++++++++++++--- .../~Lua/Modules/Battle/Logic/BattleLogic.lua | 1 - .../Logic/Monster/MonsterSkill/MCondition.lua | 16 ++++- .../~Lua/Modules/Battle/Logic/Role/Skill.lua | 2 +- .../Modules/Battle/Logic/SkillManager.lua | 1 - .../~Lua/Modules/Battle/View/BattleView.lua | 10 +++ .../Modules/Battle/View/Unit/MonsterView.lua | 16 ++--- .../Modules/Battle/View/Unit/SkillCaster.lua | 38 ++++++++---- 8 files changed, 111 insertions(+), 34 deletions(-) diff --git a/Assets/ManagedResources/Prefabs/UI/Battle/BattlePanel.prefab b/Assets/ManagedResources/Prefabs/UI/Battle/BattlePanel.prefab index 3642e4d6a1..bc12a27882 100644 --- a/Assets/ManagedResources/Prefabs/UI/Battle/BattlePanel.prefab +++ b/Assets/ManagedResources/Prefabs/UI/Battle/BattlePanel.prefab @@ -31044,7 +31044,7 @@ RectTransform: m_GameObject: {fileID: -4972557976968538313} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 0.88, y: 0.88, z: 0.88} + m_LocalScale: {x: 0.8, y: 0.8, z: 0.88} m_Children: [] m_Father: {fileID: 692595718783767060} m_RootOrder: 4 @@ -31424,7 +31424,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0} m_AnchorMax: {x: 1, y: 0} - m_AnchoredPosition: {x: -55, y: 1070} + m_AnchoredPosition: {x: -55, y: 869.7999} m_SizeDelta: {x: 80, y: 80} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &3965231938052073796 @@ -42523,7 +42523,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0} m_AnchorMax: {x: 1, y: 0} - m_AnchoredPosition: {x: -55, y: 1186.9001} + m_AnchoredPosition: {x: -55, y: 986.7001} m_SizeDelta: {x: 80, y: 80} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &-5903772607965869559 @@ -42672,7 +42672,7 @@ RectTransform: m_GameObject: {fileID: -95478003423446612} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 0.88, y: 0.88, z: 0.88} + m_LocalScale: {x: 0.8, y: 0.8, z: 0.88} m_Children: [] m_Father: {fileID: -7942002335202367750} m_RootOrder: 1 @@ -96988,7 +96988,7 @@ RectTransform: m_GameObject: {fileID: 5551026719691139111} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 0.88, y: 0.88, z: 0.88} + m_LocalScale: {x: 0.8, y: 0.8, z: 0.88} m_Children: [] m_Father: {fileID: 3994331577905171257} m_RootOrder: 1 @@ -102684,8 +102684,8 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0} m_AnchorMax: {x: 1, y: 0} - m_AnchoredPosition: {x: -55, y: 951.2001} - m_SizeDelta: {x: 80, y: 80} + m_AnchoredPosition: {x: -55, y: 751} + m_SizeDelta: {x: 85, y: 85} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &6670039054794519703 CanvasRenderer: @@ -120989,6 +120989,32 @@ PrefabInstance: propertyPath: m_Pivot.y value: 0.5 objectReference: {fileID: 0} + - target: {fileID: 2781097023052378972, guid: 9c72861411653334d98f12e4dbdf4ded, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 351 + objectReference: {fileID: 0} + - target: {fileID: 2781097023052378972, guid: 9c72861411653334d98f12e4dbdf4ded, + type: 3} + propertyPath: m_SizeDelta.x + value: 484 + objectReference: {fileID: 0} + - target: {fileID: 2781097023052378972, guid: 9c72861411653334d98f12e4dbdf4ded, + type: 3} + propertyPath: m_SizeDelta.y + value: 636 + objectReference: {fileID: 0} + - target: {fileID: 2781097023052378979, guid: 9c72861411653334d98f12e4dbdf4ded, + type: 3} + propertyPath: m_Color.a + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2781097023052378979, guid: 9c72861411653334d98f12e4dbdf4ded, + type: 3} + propertyPath: m_Sprite + value: + objectReference: {fileID: 21300000, guid: 939310282ce1c2a4d9202a787f0f8407, + type: 3} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 9c72861411653334d98f12e4dbdf4ded, type: 3} --- !u!224 &2781097022139180250 stripped @@ -121129,6 +121155,27 @@ PrefabInstance: propertyPath: m_LocalRotation.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 4451514803643556220, guid: de916f6aab438ee4e811cad74ed73a7d, + type: 3} + propertyPath: m_SizeDelta.x + value: 484 + objectReference: {fileID: 0} + - target: {fileID: 4451514803643556220, guid: de916f6aab438ee4e811cad74ed73a7d, + type: 3} + propertyPath: m_SizeDelta.y + value: 636 + objectReference: {fileID: 0} + - target: {fileID: 4451514803643556223, guid: de916f6aab438ee4e811cad74ed73a7d, + type: 3} + propertyPath: m_Color.a + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 4451514803643556223, guid: de916f6aab438ee4e811cad74ed73a7d, + type: 3} + propertyPath: m_Sprite + value: + objectReference: {fileID: 21300000, guid: 939310282ce1c2a4d9202a787f0f8407, + type: 3} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: de916f6aab438ee4e811cad74ed73a7d, type: 3} --- !u!224 &4451514803276425241 stripped diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/BattleLogic.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/BattleLogic.lua index bdca4b3858..7e0b6617d7 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/BattleLogic.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/BattleLogic.lua @@ -405,7 +405,6 @@ end -- 战斗结束 function BattleLogic.BattleEnd(result) -- - LogError("战斗结束") BattleLogic.Event:DispatchEvent(BattleEventName.BeforeBattleEnd, result) -- BattleLogic.IsEnd = true diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Monster/MonsterSkill/MCondition.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Monster/MonsterSkill/MCondition.lua index 80f7cce939..a7e3eeff07 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Monster/MonsterSkill/MCondition.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Monster/MonsterSkill/MCondition.lua @@ -32,6 +32,20 @@ local _ConditionConfig = { return BattleUtil.CompareValue(curRound, comValue, comType) end, + [3] = function(skill, condition) --2:回合数 【比较类型】 N 且 概率为 N + local conId = condition[1] + local comType = condition[2] + local comValue = condition[3] + local rand = condition[3] + -- 获取当前回合 + local curRound = BattleLogic.GetCurRound() + local isRoundOk = BattleUtil.CompareValue(curRound, comValue, comType) + -- 判断概率 + local r = Random.Range01() + local isRandomOk = r <= rand/10000 + return isRoundOk and isRandomOk + end, + [4] = function(skill, condition) --4:行动单位的职业设定 【比较类型】 N local conId = condition[1] local comType = condition[2] @@ -39,7 +53,7 @@ local _ConditionConfig = { -- 当前释放技能的单位的职业 local professionId = skill.owner.professionId return professionId == comValue - end + end, } -- 条件检测 diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/Skill.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/Skill.lua index 795177ef33..6d74504f4a 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/Skill.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/Role/Skill.lua @@ -68,7 +68,7 @@ function Skill:Cast(func) BattleLogic.Event:DispatchEvent(BattleEventName.SkillCast, self) -- 只对效果1的目标发送事件,效果1是技能的直接伤害目标 self.effectCaster:ForeachTargets(function(role) - role.Event:DispatchEvent(BattleEventName.BeSkillCastEnd, self) + role.Event:DispatchEvent(BattleEventName.BeSkillCast, self) end) --技能的施法时间计算,根据当前目标id关联的持续时间,取其中时间最长的一个 local duration = self.hitTime + self.continueTime diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/SkillManager.lua b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/SkillManager.lua index e00971135d..d0cd284b1c 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/Logic/SkillManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/Logic/SkillManager.lua @@ -17,7 +17,6 @@ end -- function this.AddMonsterSkill(skill) - LogPink("灵兽技能加入"..skill.id) if skill.type == BattleSkillType.Monster then table.insert(this.MonsterSkillList, skill) end diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/View/BattleView.lua b/Assets/ManagedResources/~Lua/Modules/Battle/View/BattleView.lua index 8c8814539c..762e347499 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/View/BattleView.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/View/BattleView.lua @@ -199,6 +199,12 @@ function this:OnSortingOrderChange(battleSorting) for _, v in pairs(tbRoleDispose) do v:OnSortingOrderChange(battleSorting) end + for _, v in pairs(tbMonster) do + v:OnSortingOrderChange(battleSorting) + end + for _, v in pairs(tbMonsterDispose) do + v:OnSortingOrderChange(battleSorting) + end end @@ -876,6 +882,10 @@ function this:OnClose() v:Dispose() end tbRoleDispose = {} + for _, v in pairs(tbMonsterDispose) do + v:Dispose() + end + tbMonsterDispose = {} for k, v in pairs(delayRecycleList) do for i=1, #v do diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/MonsterView.lua b/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/MonsterView.lua index 5718b65194..c429bd7af1 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/MonsterView.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/MonsterView.lua @@ -53,12 +53,15 @@ function MonsterView:onCreate(go, role, position, root) -- casting技能立绘 self.RoleLiveGO2 = poolManager:LoadLive(self.livePath, self.skillCastRoot.gameObject.transform.parent, Vector3.one, Vector3.zero) self.RoleLiveGO2.transform:SetParent(self.skillCastRoot.gameObject.transform) - - self.RoleLiveGO2:GetComponent("RectTransform").anchoredPosition = Vector2.New(self.outOffset[1], self.outOffset[2]) + + local offset = self.camp == 0 and self.offset or self.outOffset + self.RoleLiveGO2:GetComponent("RectTransform").anchoredPosition = Vector2.New(offset[1], offset[2]) if self.camp==1 then self.RoleLiveGO2.transform.rotation=Vector3.New(0,180,0) end - self.RoleLiveGO2.transform.localScale = Vector3.one * self.enemy_liveScale --* 2 + + local scale = self.camp == 0 and self.play_liveScale or self.enemy_liveScale + self.RoleLiveGO2.transform.localScale = Vector3.one * scale --* 2 self.RoleLiveGO2:SetActive(false) self.RoleLiveGOGraphic2 = self.RoleLiveGO2:GetComponent("SkeletonGraphic") self.RoleLiveGOTran2 = self.RoleLiveGO2:GetComponent("RectTransform") @@ -153,17 +156,10 @@ end function MonsterView:onDispose() - self.GameObject.transform.parent.localScale = Vector3.one - - self.BuffCtrl:Dispose() -- - Util.SetSpineGray(self.RoleLiveGOGraphic, false) Util.SetSpineGray(self.RoleLiveGOGraphic2, false) - Util.SetColor(self.RoleLiveGOGraphic, Color.New(1, 1, 1, 1)) Util.SetColor(self.RoleLiveGOGraphic2, Color.New(1, 1, 1, 1)) - self.RoleLiveGOGraphic.freeze = false self.RoleLiveGOGraphic2.freeze = false - -- poolManager:UnLoadLive(self.livePath, self.RoleLiveGO) poolManager:UnLoadLive(self.livePath, self.RoleLiveGO2) -- 回收本节点 BattlePool.RecycleItem(self.GameObject, BATTLE_POOL_TYPE.ENEMY_ROLE) diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/SkillCaster.lua b/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/SkillCaster.lua index e1937d5ddb..e320d0fb42 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/SkillCaster.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/View/Unit/SkillCaster.lua @@ -51,8 +51,10 @@ function SkillCaster:OnSkillCast(skill) self.owner:OnSkillPlay() end -- 播放 - -- 这里相当于技能前摇,等待立绘播放到需要释放关键帧的时间时继续释放技能 - self:CheckSkillForoleEffect(combat, skill) + -- 这里相当于技能前摇,等待立绘播放到需要释放关键帧的时间时继续释放技能(人物前摇特效) + if self.owner.role.type == BattleUnitType.Role then + self:CheckSkillForoleEffect(combat, skill) + end self.owner:DelayFunc(self.actionTime, function() self:CheckFullSceenSkill(combat, skill) -- 继续战斗放在特效加载之后,避免特效加载时间对战斗时间得影响 @@ -79,7 +81,7 @@ function SkillCaster:OnSkillCast(skill) if combat.VerticalDrawing == 1 then _PlaySkill() elseif combat.VerticalDrawing == 2 then - self:PlaySkillCastingEffect(combat, function() + self:PlaySkillCastingEffect(combat, skill, function() _PlaySkill() end) end @@ -90,7 +92,7 @@ end -function SkillCaster:PlaySkillCastingEffect(combat, func) +function SkillCaster:PlaySkillCastingEffect(combat, skill, func) -- 播放casting self.castingEfectNode:SetActive(false) self.castingEfectNode:SetActive(true) @@ -108,6 +110,10 @@ function SkillCaster:PlaySkillCastingEffect(combat, func) SoundManager.PlaySound(combat.SkillNameVoice) end + -- 这里相当于技能前摇,等待立绘播放到需要释放关键帧的时间时继续释放技能(灵兽前摇特效) + if self.owner.role.type == BattleUnitType.Monster then + self:CheckSkillForoleEffect(combat, skill) + end -- 调用上层接口 if self.owner.OnSkillCastingStart then self.owner:OnSkillCastingStart() @@ -154,9 +160,9 @@ function SkillCaster:GetEffectSPostion(skill) if chooseLimit == 3 then local col = (targetPos-1) % 3 + 1 - return self.camp == 0 and FullEffectPosition["My_COL_"..col] or FullEffectPosition["Enemy_COL_"..col] + return self.owner.camp == 0 and FullEffectPosition["My_COL_"..col] or FullEffectPosition["Enemy_COL_"..col] else - return self.camp == 0 and FullEffectPosition.My_All or FullEffectPosition.Enemy_All + return self.owner.camp == 0 and FullEffectPosition.My_All or FullEffectPosition.Enemy_All end end @@ -193,8 +199,8 @@ function SkillCaster:CheckRotate(go, orientation) local isR = orientation[1] and orientation[1][1] or 0 local rt = orientation[2] rt = rt and Vector3.New(rt[1], rt[2], rt[3]) or Vector3.zero - if (self.camp == 0 and isR == 1) - or (self.camp == 1 and isR == 2) then + if (self.owner.camp == 0 and isR == 1) + or (self.owner.camp == 1 and isR == 2) then go.transform.localRotation = rt return true end @@ -332,12 +338,18 @@ function SkillCaster:CheckSkillForoleEffect(combat, skill) -- 挂在人身上,以人物中心为原点 if combat.BeforeEffectType == 1 then - local sortingOrder - if self.camp == 0 then - sortingOrder = self.owner.GameObject:GetComponent("Canvas").sortingOrder + if self.owner.role.type == BattleUnitType.Role then + local sortingOrder + if self.owner.cam == 0 then + sortingOrder = self.owner.GameObject:GetComponent("Canvas").sortingOrder + end + go = BattleManager.LoadAsset(path, sortingOrder) + go.transform:SetParent(self.owner.GameObject.transform) + elseif self.owner.role.type == BattleUnitType.Monster then + go = BattleManager.LoadAsset(path) + go.transform:SetParent(self.owner.RoleLiveGO2.gameObject.transform) end - go = BattleManager.LoadAsset(path, sortingOrder) - go.transform:SetParent(self.owner.GameObject.transform) + -- 屏幕中心 elseif combat.BeforeEffectType == 2 then local sortingOrder = self.effectRoot:GetComponent("Canvas").sortingOrder