-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from brunomikoski/feature/bruno/custom-set-steps
add: more meta changes
- Loading branch information
Showing
11 changed files
with
367 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
Scripts/Runtime/Core/Steps/SetTargetGraphicPropertiesStep.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#if DOTWEEN_ENABLED | ||
using System; | ||
using DG.Tweening; | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
|
||
namespace BrunoMikoski.AnimationSequencer | ||
{ | ||
[Serializable] | ||
public sealed class SetTargetGraphicPropertiesStep : AnimationStepBase | ||
{ | ||
[SerializeField] | ||
private Graphic targetGraphic; | ||
|
||
[SerializeField] | ||
private Color targetColor = Color.white; | ||
|
||
private Color originalColor; | ||
|
||
public override string DisplayName => "Set Target Graphic Properties"; | ||
public override void AddTweenToSequence(Sequence animationSequence) | ||
{ | ||
Sequence behaviourSequence = DOTween.Sequence(); | ||
behaviourSequence.SetDelay(Delay); | ||
|
||
behaviourSequence.AppendCallback(() => | ||
{ | ||
originalColor = targetGraphic.color; | ||
targetGraphic.color = targetColor; | ||
}); | ||
if (FlowType == FlowType.Join) | ||
animationSequence.Join(behaviourSequence); | ||
else | ||
animationSequence.Append(behaviourSequence); | ||
} | ||
|
||
public override void ResetToInitialState() | ||
{ | ||
targetGraphic.color = originalColor; | ||
} | ||
|
||
|
||
public override string GetDisplayNameForEditor(int index) | ||
{ | ||
string display = "NULL"; | ||
if (targetGraphic != null) | ||
display = targetGraphic.name; | ||
|
||
return $"{index}. Set {display} Properties"; | ||
} | ||
} | ||
} | ||
#endif |
3 changes: 3 additions & 0 deletions
3
Scripts/Runtime/Core/Steps/SetTargetGraphicPropertiesStep.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
83 changes: 83 additions & 0 deletions
83
Scripts/Runtime/Core/Steps/SetTargetImagePropertiesStep.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#if DOTWEEN_ENABLED | ||
using System; | ||
using DG.Tweening; | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
|
||
namespace BrunoMikoski.AnimationSequencer | ||
{ | ||
[Serializable] | ||
public sealed class SetTargetImagePropertiesStep : AnimationStepBase | ||
{ | ||
[SerializeField] | ||
private Image targetGraphic; | ||
|
||
[SerializeField] | ||
private Color targetColor = Color.white; | ||
[SerializeField] | ||
private Sprite targetSprite; | ||
[SerializeField] | ||
private Material targetMaterial; | ||
|
||
private Color originalColor = Color.white; | ||
private Material originalMaterial; | ||
private Sprite originalSprite; | ||
|
||
public override string DisplayName => "Set Target Image Properties"; | ||
public override void AddTweenToSequence(Sequence animationSequence) | ||
{ | ||
Sequence behaviourSequence = DOTween.Sequence(); | ||
behaviourSequence.SetDelay(Delay); | ||
|
||
behaviourSequence.AppendCallback(() => | ||
{ | ||
|
||
if (targetColor != targetGraphic.color) | ||
{ | ||
originalColor = targetGraphic.color; | ||
targetGraphic.color = targetColor; | ||
} | ||
|
||
if (targetSprite != null) | ||
{ | ||
originalSprite = targetGraphic.sprite; | ||
targetGraphic.sprite = targetSprite; | ||
} | ||
|
||
if (targetMaterial != null) | ||
{ | ||
originalMaterial = targetGraphic.material; | ||
targetGraphic.material = targetMaterial; | ||
} | ||
|
||
|
||
}); | ||
|
||
if (FlowType == FlowType.Join) | ||
animationSequence.Join(behaviourSequence); | ||
else | ||
animationSequence.Append(behaviourSequence); | ||
} | ||
|
||
public override void ResetToInitialState() | ||
{ | ||
targetGraphic.color = originalColor; | ||
|
||
if(originalSprite != null) | ||
targetGraphic.sprite = originalSprite; | ||
|
||
if (originalMaterial != null) | ||
targetGraphic.material = targetMaterial; | ||
} | ||
|
||
public override string GetDisplayNameForEditor(int index) | ||
{ | ||
string display = "NULL"; | ||
if (targetGraphic != null) | ||
display = targetGraphic.name; | ||
|
||
return $"{index}. Set {display}(Image) Properties"; | ||
} | ||
} | ||
} | ||
#endif |
3 changes: 3 additions & 0 deletions
3
Scripts/Runtime/Core/Steps/SetTargetImagePropertiesStep.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
123 changes: 123 additions & 0 deletions
123
Scripts/Runtime/Core/Steps/SetTargetRectTransformPropertiesStep.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
#if DOTWEEN_ENABLED | ||
using System; | ||
using DG.Tweening; | ||
using UnityEngine; | ||
|
||
namespace BrunoMikoski.AnimationSequencer | ||
{ | ||
[Serializable] | ||
public sealed class SetTargetRectTransformPropertiesStep : AnimationStepBase | ||
{ | ||
public override string DisplayName => "Set Target RectTransform Properties"; | ||
[SerializeField] | ||
private RectTransform targetRectTransform; | ||
|
||
[SerializeField] | ||
private bool useLocal; | ||
[SerializeField] | ||
private Vector3 position; | ||
[SerializeField] | ||
private Vector3 eulerAngles; | ||
[SerializeField] | ||
private Vector3 scale = Vector3.one; | ||
|
||
[SerializeField] | ||
private Vector2 anchorMin = new Vector2(0.5f, 0.5f); | ||
[SerializeField] | ||
private Vector2 anchorMax = new Vector2(0.5f, 0.5f); | ||
[SerializeField] | ||
private Vector2 anchoredPosition; | ||
[SerializeField] | ||
private Vector2 sizeDelta; | ||
[SerializeField] | ||
private Vector2 pivot = new Vector2(0.5f, 0.5f); | ||
|
||
private Vector3 originalPosition; | ||
private Vector3 originalEulerAngles; | ||
private Vector3 originalScale; | ||
private Vector2 originalAnchorMin; | ||
private Vector2 originalAnchorMax; | ||
private Vector2 originalAnchoredPosition; | ||
private Vector2 originalSizeDelta; | ||
private Vector2 originalPivot; | ||
|
||
public override void AddTweenToSequence(Sequence animationSequence) | ||
{ | ||
Sequence behaviourSequence = DOTween.Sequence(); | ||
behaviourSequence.SetDelay(Delay); | ||
|
||
behaviourSequence.AppendCallback(() => | ||
{ | ||
if (useLocal) | ||
{ | ||
originalPosition = targetRectTransform.localPosition; | ||
originalEulerAngles = targetRectTransform.localEulerAngles; | ||
|
||
targetRectTransform.localPosition = position; | ||
targetRectTransform.localEulerAngles = eulerAngles; | ||
} | ||
else | ||
{ | ||
originalPosition = targetRectTransform.position; | ||
originalEulerAngles = targetRectTransform.eulerAngles; | ||
|
||
targetRectTransform.position = position; | ||
targetRectTransform.eulerAngles = eulerAngles; | ||
} | ||
|
||
|
||
targetRectTransform.anchorMin = anchorMin; | ||
targetRectTransform.anchorMax = anchorMax; | ||
targetRectTransform.anchoredPosition = anchoredPosition; | ||
targetRectTransform.sizeDelta = sizeDelta; | ||
targetRectTransform.pivot = pivot; | ||
|
||
|
||
originalAnchorMin = targetRectTransform.anchorMin; | ||
originalAnchorMax = targetRectTransform.anchorMax; | ||
originalAnchoredPosition = targetRectTransform.anchoredPosition; | ||
originalSizeDelta = targetRectTransform.sizeDelta; | ||
originalPivot = targetRectTransform.pivot; | ||
|
||
originalScale = targetRectTransform.localScale; | ||
targetRectTransform.localScale = scale; | ||
}); | ||
if (FlowType == FlowType.Join) | ||
animationSequence.Join(behaviourSequence); | ||
else | ||
animationSequence.Append(behaviourSequence); | ||
} | ||
|
||
public override void ResetToInitialState() | ||
{ | ||
if (useLocal) | ||
{ | ||
targetRectTransform.localPosition = originalPosition; | ||
targetRectTransform.localEulerAngles = originalEulerAngles; | ||
} | ||
else | ||
{ | ||
targetRectTransform.position = originalPosition; | ||
targetRectTransform.eulerAngles = originalEulerAngles; | ||
} | ||
targetRectTransform.localScale = originalScale; | ||
|
||
targetRectTransform.anchorMin = originalAnchorMin; | ||
targetRectTransform.anchorMax = originalAnchorMax; | ||
targetRectTransform.anchoredPosition = originalAnchoredPosition; | ||
targetRectTransform.sizeDelta = originalSizeDelta; | ||
targetRectTransform.pivot = originalPivot; | ||
} | ||
|
||
public override string GetDisplayNameForEditor(int index) | ||
{ | ||
string display = "NULL"; | ||
if (targetRectTransform != null) | ||
display = targetRectTransform.name; | ||
|
||
return $"{index}. Set {display}(RectTransform) Properties"; | ||
} | ||
|
||
} | ||
} | ||
#endif |
3 changes: 3 additions & 0 deletions
3
Scripts/Runtime/Core/Steps/SetTargetRectTransformPropertiesStep.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.