From f029c1d4fdb2e4118d826c9c3486947ddb0551f3 Mon Sep 17 00:00:00 2001 From: Harald Csaszar Date: Fri, 24 Nov 2023 19:32:11 +0100 Subject: [PATCH] [unity] Code and method signature cleanup (made ApplyAnimation and AfterAnimationApplied public virtual). --- .../spine-unity/Components/SkeletonAnimation.cs | 11 +++++++---- .../spine-unity/Components/SkeletonGraphic.cs | 13 ++++++++----- .../spine-unity/Components/SkeletonMecanim.cs | 4 ++-- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs index da3c094fe8..032dd46f4e 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonAnimation.cs @@ -232,10 +232,8 @@ public void Update (float deltaTime) { return; UpdateAnimationStatus(deltaTime); - if (updateMode == UpdateMode.OnlyAnimationStatus) { - state.ApplyEventTimelinesOnly(skeleton, issueEvents: false); + if (updateMode == UpdateMode.OnlyAnimationStatus) return; - } ApplyAnimation(); } @@ -243,9 +241,14 @@ protected void UpdateAnimationStatus (float deltaTime) { deltaTime *= timeScale; state.Update(deltaTime); skeleton.Update(deltaTime); + + if (updateMode == UpdateMode.OnlyAnimationStatus) { + state.ApplyEventTimelinesOnly(skeleton, issueEvents: false); + return; + } } - protected void ApplyAnimation () { + public virtual void ApplyAnimation () { if (_BeforeApply != null) _BeforeApply(this); diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs index 9195d4e219..643fbf1799 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonGraphic.cs @@ -353,10 +353,8 @@ public virtual void Update (float deltaTime) { return; UpdateAnimationStatus(deltaTime); - if (updateMode == UpdateMode.OnlyAnimationStatus) { - state.ApplyEventTimelinesOnly(skeleton, issueEvents: false); + if (updateMode == UpdateMode.OnlyAnimationStatus) return; - } ApplyAnimation(); } @@ -382,9 +380,14 @@ protected void UpdateAnimationStatus (float deltaTime) { deltaTime *= timeScale; state.Update(deltaTime); skeleton.Update(deltaTime); + + if (updateMode == UpdateMode.OnlyAnimationStatus) { + state.ApplyEventTimelinesOnly(skeleton, issueEvents: false); + return; + } } - protected void ApplyAnimation () { + public virtual void ApplyAnimation () { if (BeforeApply != null) BeforeApply(this); @@ -396,7 +399,7 @@ protected void ApplyAnimation () { AfterAnimationApplied(); } - public void AfterAnimationApplied () { + public virtual void AfterAnimationApplied () { if (UpdateLocal != null) UpdateLocal(this); diff --git a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs index 31d85ee69e..ef193c2a95 100644 --- a/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs +++ b/spine-unity/Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs @@ -127,7 +127,7 @@ protected void UpdateAnimation (float deltaTime) { ApplyAnimation(); } - protected void ApplyAnimation () { + public virtual void ApplyAnimation () { if (_BeforeApply != null) _BeforeApply(this); @@ -152,7 +152,7 @@ protected void ApplyAnimation () { AfterAnimationApplied(); } - public void AfterAnimationApplied () { + public virtual void AfterAnimationApplied () { if (_UpdateLocal != null) _UpdateLocal(this);