mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2025-12-21 01:36:05 +08:00
DOTweenInspector now shows tweens IDs (if present) and is generally nicer
This commit is contained in:
parent
af057d7fcc
commit
e848c1343e
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -11,14 +11,15 @@ using UnityEngine.UI;
|
|||||||
|
|
||||||
public class TempTests : BrainBase
|
public class TempTests : BrainBase
|
||||||
{
|
{
|
||||||
public Transform target0, target1;
|
public Transform target;
|
||||||
|
|
||||||
IEnumerator Start()
|
void Start()
|
||||||
{
|
{
|
||||||
while (true) {
|
int tot = 10;
|
||||||
yield return null;
|
while (tot > 0) {
|
||||||
target0.DOMoveX(1, 0.1f);
|
target.DOMoveX(1, 5f).SetId("TW" + tot).SetLoops(-1, LoopType.Yoyo);
|
||||||
// target1.DOMoveX(1, 0.1f);
|
DOTween.Sequence().Append(target.DOMoveY(2, 3f).SetId("INN" + tot)).SetLoops(-1, LoopType.Yoyo).SetId("SEQ" + tot);
|
||||||
|
tot--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
@ -32,7 +32,7 @@ namespace DG.Tweening
|
|||||||
public class DOTween
|
public class DOTween
|
||||||
{
|
{
|
||||||
/// <summary>DOTween's version</summary>
|
/// <summary>DOTween's version</summary>
|
||||||
public static readonly string Version = "1.2.145"; // Last version before modules: 1.1.755
|
public static readonly string Version = "1.2.150"; // Last version before modules: 1.1.755
|
||||||
|
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// Options ////////////////////////////////////
|
// Options ////////////////////////////////////
|
||||||
|
|||||||
@ -17,9 +17,11 @@ namespace DG.DOTweenEditor.UI
|
|||||||
{
|
{
|
||||||
DOTweenSettings _settings;
|
DOTweenSettings _settings;
|
||||||
string _title;
|
string _title;
|
||||||
readonly StringBuilder _strBuilder = new StringBuilder();
|
readonly StringBuilder _strb = new StringBuilder();
|
||||||
bool _isRuntime;
|
bool _isRuntime;
|
||||||
Texture2D _headerImg;
|
Texture2D _headerImg;
|
||||||
|
string _playingTweensHex;
|
||||||
|
string _pausedTweensHex;
|
||||||
|
|
||||||
#region Unity + GUI
|
#region Unity + GUI
|
||||||
|
|
||||||
@ -28,14 +30,17 @@ namespace DG.DOTweenEditor.UI
|
|||||||
_isRuntime = EditorApplication.isPlaying;
|
_isRuntime = EditorApplication.isPlaying;
|
||||||
ConnectToSource(true);
|
ConnectToSource(true);
|
||||||
|
|
||||||
_strBuilder.Remove(0, _strBuilder.Length);
|
_strb.Length = 0;
|
||||||
_strBuilder.Append("DOTween v").Append(DOTween.Version);
|
_strb.Append("DOTween v").Append(DOTween.Version);
|
||||||
if (TweenManager.isDebugBuild) _strBuilder.Append(" [Debug build]");
|
if (TweenManager.isDebugBuild) _strb.Append(" [Debug build]");
|
||||||
else _strBuilder.Append(" [Release build]");
|
else _strb.Append(" [Release build]");
|
||||||
|
|
||||||
if (EditorUtils.hasPro) _strBuilder.Append("\nDOTweenPro v").Append(EditorUtils.proVersion);
|
if (EditorUtils.hasPro) _strb.Append("\nDOTweenPro v").Append(EditorUtils.proVersion);
|
||||||
else _strBuilder.Append("\nDOTweenPro not installed");
|
else _strb.Append("\nDOTweenPro not installed");
|
||||||
_title = _strBuilder.ToString();
|
_title = _strb.ToString();
|
||||||
|
|
||||||
|
_playingTweensHex = EditorGUIUtility.isProSkin ? "<color=#00c514>" : "<color=#005408>";
|
||||||
|
_pausedTweensHex = EditorGUIUtility.isProSkin ? "<color=#ff832a>" : "<color=#873600>";
|
||||||
}
|
}
|
||||||
|
|
||||||
override public void OnInspectorGUI()
|
override public void OnInspectorGUI()
|
||||||
@ -59,6 +64,8 @@ namespace DG.DOTweenEditor.UI
|
|||||||
int totPausedTweens = totActiveTweens - totPlayingTweens;
|
int totPausedTweens = totActiveTweens - totPlayingTweens;
|
||||||
int totActiveDefaultTweens = TweenManager.totActiveDefaultTweens;
|
int totActiveDefaultTweens = TweenManager.totActiveDefaultTweens;
|
||||||
int totActiveLateTweens = TweenManager.totActiveLateTweens;
|
int totActiveLateTweens = TweenManager.totActiveLateTweens;
|
||||||
|
int totActiveFixedTweens = TweenManager.totActiveFixedTweens;
|
||||||
|
int totActiveManualTweens = TweenManager.totActiveManualTweens;
|
||||||
|
|
||||||
GUILayout.Label(_title, TweenManager.isDebugBuild ? EditorGUIUtils.redLabelStyle : EditorGUIUtils.boldLabelStyle);
|
GUILayout.Label(_title, TweenManager.isDebugBuild ? EditorGUIUtils.redLabelStyle : EditorGUIUtils.boldLabelStyle);
|
||||||
|
|
||||||
@ -98,57 +105,74 @@ namespace DG.DOTweenEditor.UI
|
|||||||
GUILayout.EndHorizontal();
|
GUILayout.EndHorizontal();
|
||||||
|
|
||||||
GUILayout.Space(8);
|
GUILayout.Space(8);
|
||||||
_strBuilder.Length = 0;
|
GUILayout.Label("<b>Legend: </b> TW = Tweener, SE = Sequence", EditorGUIUtils.wordWrapRichTextLabelStyle);
|
||||||
_strBuilder.Append("Active tweens: ").Append(totActiveTweens)
|
|
||||||
.Append(" (").Append(TweenManager.totActiveTweeners)
|
|
||||||
.Append("/").Append(TweenManager.totActiveSequences).Append(")")
|
|
||||||
.Append("\nDefault/Late tweens: ").Append(totActiveDefaultTweens)
|
|
||||||
.Append("/").Append(totActiveLateTweens)
|
|
||||||
.Append("\nPlaying tweens: ").Append(totPlayingTweens);
|
|
||||||
if (_settings.showPlayingTweens) {
|
|
||||||
foreach (Tween t in TweenManager._activeTweens) {
|
|
||||||
if (t != null && t.isPlaying) _strBuilder.Append("\n - [").Append(t.tweenType).Append("] ").Append(t.target);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_strBuilder.Append("\nPaused tweens: ").Append(totPausedTweens);
|
|
||||||
if (_settings.showPausedTweens) {
|
|
||||||
foreach (Tween t in TweenManager._activeTweens) {
|
|
||||||
if (t != null && !t.isPlaying) _strBuilder.Append("\n - [").Append(t.tweenType).Append("] ").Append(t.target);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_strBuilder.Append("\nPooled tweens: ").Append(TweenManager.TotalPooledTweens())
|
|
||||||
.Append(" (").Append(TweenManager.totPooledTweeners)
|
|
||||||
.Append("/").Append(TweenManager.totPooledSequences).Append(")");
|
|
||||||
GUILayout.Label(_strBuilder.ToString());
|
|
||||||
|
|
||||||
GUILayout.Space(8);
|
GUILayout.Space(8);
|
||||||
_strBuilder.Remove(0, _strBuilder.Length);
|
_strb.Length = 0;
|
||||||
_strBuilder.Append("Tweens Capacity: ").Append(TweenManager.maxTweeners).Append("/").Append(TweenManager.maxSequences)
|
_strb.Append("Active tweens: ").Append(totActiveTweens)
|
||||||
.Append("\nMax Simultaneous Active Tweens: ").Append(DOTween.maxActiveTweenersReached).Append("/").Append(DOTween.maxActiveSequencesReached);
|
.Append(" (").Append(TweenManager.totActiveTweeners).Append(" TW, ")
|
||||||
GUILayout.Label(_strBuilder.ToString());
|
.Append(TweenManager.totActiveSequences).Append(" SE)")
|
||||||
|
.Append("\nDefault/Late/Fixed/Manual tweens: ").Append(totActiveDefaultTweens)
|
||||||
|
.Append("/").Append(totActiveLateTweens)
|
||||||
|
.Append("/").Append(totActiveFixedTweens)
|
||||||
|
.Append("/").Append(totActiveManualTweens)
|
||||||
|
.Append(_playingTweensHex).Append("\nPlaying tweens: ").Append(totPlayingTweens);
|
||||||
|
if (_settings.showPlayingTweens) {
|
||||||
|
foreach (Tween t in TweenManager._activeTweens) {
|
||||||
|
if (t == null || !t.isPlaying) continue;
|
||||||
|
_strb.Append("\n - [").Append(t.tweenType == TweenType.Tweener ? "TW" : "SE");
|
||||||
|
AppendTweenIdLabel(_strb, t);
|
||||||
|
_strb.Append("] ").Append(GetTargetTypeLabel(t.target));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_strb.Append("</color>");
|
||||||
|
_strb.Append(_pausedTweensHex).Append("\nPaused tweens: ").Append(totPausedTweens);
|
||||||
|
if (_settings.showPausedTweens) {
|
||||||
|
foreach (Tween t in TweenManager._activeTweens) {
|
||||||
|
if (t == null || t.isPlaying) continue;
|
||||||
|
_strb.Append("\n - [").Append(t.tweenType == TweenType.Tweener ? "TW" : "SE");
|
||||||
|
AppendTweenIdLabel(_strb, t);
|
||||||
|
_strb.Append("] ").Append(GetTargetTypeLabel(t.target));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_strb.Append("</color>");
|
||||||
|
_strb.Append("\nPooled tweens: ").Append(TweenManager.TotalPooledTweens())
|
||||||
|
.Append(" (").Append(TweenManager.totPooledTweeners).Append(" TW, ")
|
||||||
|
.Append(TweenManager.totPooledSequences).Append(" SE)");
|
||||||
|
GUILayout.Label(_strb.ToString(), EditorGUIUtils.wordWrapRichTextLabelStyle);
|
||||||
|
|
||||||
|
GUILayout.Space(8);
|
||||||
|
_strb.Remove(0, _strb.Length);
|
||||||
|
_strb.Append("Tweens Capacity: ").Append(TweenManager.maxTweeners).Append(" TW, ").Append(TweenManager.maxSequences).Append(" SE")
|
||||||
|
.Append("\nMax Simultaneous Active Tweens: ").Append(DOTween.maxActiveTweenersReached).Append(" TW, ")
|
||||||
|
.Append(DOTween.maxActiveSequencesReached).Append(" SE");
|
||||||
|
GUILayout.Label(_strb.ToString(), EditorGUIUtils.wordWrapRichTextLabelStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
GUILayout.Space(8);
|
GUILayout.Space(8);
|
||||||
_strBuilder.Remove(0, _strBuilder.Length);
|
_strb.Remove(0, _strb.Length);
|
||||||
_strBuilder.Append("SETTINGS ▼");
|
_strb.Append("<b>SETTINGS ▼</b>");
|
||||||
_strBuilder.Append("\nSafe Mode: ").Append((_isRuntime ? DOTween.useSafeMode : _settings.useSafeMode) ? "ON" : "OFF");
|
_strb.Append("\nSafe Mode: ").Append((_isRuntime ? DOTween.useSafeMode : _settings.useSafeMode) ? "ON" : "OFF");
|
||||||
_strBuilder.Append("\nLog Behaviour: ").Append(_isRuntime ? DOTween.logBehaviour : _settings.logBehaviour);
|
_strb.Append("\nLog Behaviour: ").Append(_isRuntime ? DOTween.logBehaviour : _settings.logBehaviour);
|
||||||
_strBuilder.Append("\nShow Unity Editor Report: ").Append(_isRuntime ? DOTween.showUnityEditorReport : _settings.showUnityEditorReport);
|
_strb.Append("\nShow Unity Editor Report: ").Append(_isRuntime ? DOTween.showUnityEditorReport : _settings.showUnityEditorReport);
|
||||||
_strBuilder.Append("\nTimeScale (Unity/DOTween): ").Append(Time.timeScale).Append("/").Append(_isRuntime ? DOTween.timeScale : _settings.timeScale);
|
_strb.Append("\nTimeScale (Unity/DOTween): ").Append(Time.timeScale).Append("/").Append(_isRuntime ? DOTween.timeScale : _settings.timeScale);
|
||||||
GUILayout.Label(_strBuilder.ToString());
|
GUILayout.Label(_strb.ToString(), EditorGUIUtils.wordWrapRichTextLabelStyle);
|
||||||
GUILayout.Label("NOTE: DOTween's TimeScale is not the same as Unity's Time.timeScale: it is actually multiplied by it except for tweens that are set to update independently", EditorGUIUtils.wordWrapItalicLabelStyle);
|
GUILayout.Label(
|
||||||
|
"NOTE: DOTween's TimeScale is not the same as Unity's Time.timeScale: it is actually multiplied by it except for tweens that are set to update independently",
|
||||||
|
EditorGUIUtils.wordWrapRichTextLabelStyle
|
||||||
|
);
|
||||||
|
|
||||||
GUILayout.Space(8);
|
GUILayout.Space(8);
|
||||||
_strBuilder.Remove(0, _strBuilder.Length);
|
_strb.Remove(0, _strb.Length);
|
||||||
_strBuilder.Append("DEFAULTS ▼");
|
_strb.Append("<b>DEFAULTS ▼</b>");
|
||||||
_strBuilder.Append("\ndefaultRecyclable: ").Append(_isRuntime ? DOTween.defaultRecyclable : _settings.defaultRecyclable);
|
_strb.Append("\ndefaultRecyclable: ").Append(_isRuntime ? DOTween.defaultRecyclable : _settings.defaultRecyclable);
|
||||||
_strBuilder.Append("\ndefaultUpdateType: ").Append(_isRuntime ? DOTween.defaultUpdateType : _settings.defaultUpdateType);
|
_strb.Append("\ndefaultUpdateType: ").Append(_isRuntime ? DOTween.defaultUpdateType : _settings.defaultUpdateType);
|
||||||
_strBuilder.Append("\ndefaultTSIndependent: ").Append(_isRuntime ? DOTween.defaultTimeScaleIndependent : _settings.defaultTimeScaleIndependent);
|
_strb.Append("\ndefaultTSIndependent: ").Append(_isRuntime ? DOTween.defaultTimeScaleIndependent : _settings.defaultTimeScaleIndependent);
|
||||||
_strBuilder.Append("\ndefaultAutoKill: ").Append(_isRuntime ? DOTween.defaultAutoKill : _settings.defaultAutoKill);
|
_strb.Append("\ndefaultAutoKill: ").Append(_isRuntime ? DOTween.defaultAutoKill : _settings.defaultAutoKill);
|
||||||
_strBuilder.Append("\ndefaultAutoPlay: ").Append(_isRuntime ? DOTween.defaultAutoPlay : _settings.defaultAutoPlay);
|
_strb.Append("\ndefaultAutoPlay: ").Append(_isRuntime ? DOTween.defaultAutoPlay : _settings.defaultAutoPlay);
|
||||||
_strBuilder.Append("\ndefaultEaseType: ").Append(_isRuntime ? DOTween.defaultEaseType : _settings.defaultEaseType);
|
_strb.Append("\ndefaultEaseType: ").Append(_isRuntime ? DOTween.defaultEaseType : _settings.defaultEaseType);
|
||||||
_strBuilder.Append("\ndefaultLoopType: ").Append(_isRuntime ? DOTween.defaultLoopType : _settings.defaultLoopType);
|
_strb.Append("\ndefaultLoopType: ").Append(_isRuntime ? DOTween.defaultLoopType : _settings.defaultLoopType);
|
||||||
GUILayout.Label(_strBuilder.ToString());
|
GUILayout.Label(_strb.ToString(), EditorGUIUtils.wordWrapRichTextLabelStyle);
|
||||||
|
|
||||||
GUILayout.Space(10);
|
GUILayout.Space(10);
|
||||||
}
|
}
|
||||||
@ -169,5 +193,25 @@ namespace DG.DOTweenEditor.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region Helpers
|
||||||
|
|
||||||
|
void AppendTweenIdLabel(StringBuilder strb, Tween t)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(t.stringId)) strb.Append(":<b>").Append(t.stringId).Append("</b>");
|
||||||
|
else if (t.intId != -999) strb.Append(":<b>").Append(t.intId).Append("</b>");
|
||||||
|
else if (t.id != null) strb.Append(":<b>").Append(t.id).Append("</b>");
|
||||||
|
}
|
||||||
|
|
||||||
|
string GetTargetTypeLabel(object tweenTarget)
|
||||||
|
{
|
||||||
|
if (tweenTarget == null) return null;
|
||||||
|
string s = tweenTarget.ToString();
|
||||||
|
int dotIndex = s.LastIndexOf('.');
|
||||||
|
if (dotIndex != -1) s = '(' + s.Substring(dotIndex + 1);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -21,6 +21,7 @@ namespace DG.DOTweenEditor.UI
|
|||||||
public static GUIStyle handlelabelStyle,
|
public static GUIStyle handlelabelStyle,
|
||||||
handleSelectedLabelStyle,
|
handleSelectedLabelStyle,
|
||||||
wordWrapLabelStyle,
|
wordWrapLabelStyle,
|
||||||
|
wordWrapRichTextLabelStyle,
|
||||||
wordWrapItalicLabelStyle,
|
wordWrapItalicLabelStyle,
|
||||||
titleStyle,
|
titleStyle,
|
||||||
logoIconStyle;
|
logoIconStyle;
|
||||||
@ -170,6 +171,10 @@ namespace DG.DOTweenEditor.UI
|
|||||||
wordWrapLabelStyle = new GUIStyle(UnityEngine.GUI.skin.label);
|
wordWrapLabelStyle = new GUIStyle(UnityEngine.GUI.skin.label);
|
||||||
wordWrapLabelStyle.wordWrap = true;
|
wordWrapLabelStyle.wordWrap = true;
|
||||||
|
|
||||||
|
wordWrapRichTextLabelStyle = new GUIStyle(UnityEngine.GUI.skin.label);
|
||||||
|
wordWrapRichTextLabelStyle.wordWrap = true;
|
||||||
|
wordWrapRichTextLabelStyle.richText = true;
|
||||||
|
|
||||||
wordWrapItalicLabelStyle = new GUIStyle(wordWrapLabelStyle);
|
wordWrapItalicLabelStyle = new GUIStyle(wordWrapLabelStyle);
|
||||||
wordWrapItalicLabelStyle.fontStyle = FontStyle.Italic;
|
wordWrapItalicLabelStyle.fontStyle = FontStyle.Italic;
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user