-
-
Notifications
You must be signed in to change notification settings - Fork 805
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
6,244 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
60 changes: 60 additions & 0 deletions
60
Assets/Demos/UIEffectTweenerControl/UIEffectTweenerControl.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,60 @@ | ||
using Coffee.UIEffects; | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
|
||
[RequireComponent(typeof(UIEffectTweener))] | ||
public class UIEffectTweenerControl : MonoBehaviour | ||
{ | ||
[SerializeField] | ||
private Text m_Info; | ||
|
||
[SerializeField] | ||
private Slider m_SeekBar; | ||
|
||
[SerializeField] | ||
private GameObject m_SeekBarBgInterval1; | ||
|
||
[SerializeField] | ||
private GameObject m_SeekBarBgDuration2; | ||
|
||
[SerializeField] | ||
private GameObject m_SeekBarBgInterval2; | ||
|
||
private UIEffectTweener _tweener; | ||
private UIEffectTweener tweener => _tweener != null ? _tweener : GetComponent<UIEffectTweener>(); | ||
|
||
private void Update() | ||
{ | ||
if (m_Info) | ||
{ | ||
var tw = tweener; | ||
m_Info.text = | ||
$"{tw.time:F2}/{tw.totalTime:F2} ({tw.rate:F2}), {tw.direction}, isTweening={tw.isTweening}, isDelaying={tw.isDelaying}, isPaused={tw.isPaused}"; | ||
} | ||
|
||
if (m_SeekBar) | ||
{ | ||
m_SeekBar.value = tweener.time / tweener.totalTime; | ||
} | ||
|
||
if (m_SeekBarBgInterval1) | ||
{ | ||
m_SeekBarBgInterval1.SetActive(UIEffectTweener.WrapMode.Loop <= tweener.wrapMode); | ||
} | ||
|
||
if (m_SeekBarBgDuration2) | ||
{ | ||
m_SeekBarBgDuration2.SetActive(UIEffectTweener.WrapMode.PingPongOnce <= tweener.wrapMode); | ||
} | ||
|
||
if (m_SeekBarBgInterval2) | ||
{ | ||
m_SeekBarBgInterval2.SetActive(UIEffectTweener.WrapMode.PingPongLoop <= tweener.wrapMode); | ||
} | ||
} | ||
|
||
public void SetWrapMode(int value) | ||
{ | ||
tweener.wrapMode = (UIEffectTweener.WrapMode)value; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/Demos/UIEffectTweenerControl/UIEffectTweenerControl.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.