1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2025-12-20 09:16:02 +08:00

DOTweenInspector now shows tweens IDs (if present) and is generally nicer

This commit is contained in:
Demigiant 2018-12-17 12:16:47 +01:00
parent af057d7fcc
commit e848c1343e
17 changed files with 109 additions and 59 deletions

View File

@ -11,14 +11,15 @@ using UnityEngine.UI;
public class TempTests : BrainBase
{
public Transform target0, target1;
public Transform target;
IEnumerator Start()
void Start()
{
while (true) {
yield return null;
target0.DOMoveX(1, 0.1f);
// target1.DOMoveX(1, 0.1f);
int tot = 10;
while (tot > 0) {
target.DOMoveX(1, 5f).SetId("TW" + tot).SetLoops(-1, LoopType.Yoyo);
DOTween.Sequence().Append(target.DOMoveY(2, 3f).SetId("INN" + tot)).SetLoops(-1, LoopType.Yoyo).SetId("SEQ" + tot);
tot--;
}
}
}

View File

@ -32,7 +32,7 @@ namespace DG.Tweening
public class DOTween
{
/// <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 ////////////////////////////////////

View File

@ -17,9 +17,11 @@ namespace DG.DOTweenEditor.UI
{
DOTweenSettings _settings;
string _title;
readonly StringBuilder _strBuilder = new StringBuilder();
readonly StringBuilder _strb = new StringBuilder();
bool _isRuntime;
Texture2D _headerImg;
string _playingTweensHex;
string _pausedTweensHex;
#region Unity + GUI
@ -28,14 +30,17 @@ namespace DG.DOTweenEditor.UI
_isRuntime = EditorApplication.isPlaying;
ConnectToSource(true);
_strBuilder.Remove(0, _strBuilder.Length);
_strBuilder.Append("DOTween v").Append(DOTween.Version);
if (TweenManager.isDebugBuild) _strBuilder.Append(" [Debug build]");
else _strBuilder.Append(" [Release build]");
_strb.Length = 0;
_strb.Append("DOTween v").Append(DOTween.Version);
if (TweenManager.isDebugBuild) _strb.Append(" [Debug build]");
else _strb.Append(" [Release build]");
if (EditorUtils.hasPro) _strBuilder.Append("\nDOTweenPro v").Append(EditorUtils.proVersion);
else _strBuilder.Append("\nDOTweenPro not installed");
_title = _strBuilder.ToString();
if (EditorUtils.hasPro) _strb.Append("\nDOTweenPro v").Append(EditorUtils.proVersion);
else _strb.Append("\nDOTweenPro not installed");
_title = _strb.ToString();
_playingTweensHex = EditorGUIUtility.isProSkin ? "<color=#00c514>" : "<color=#005408>";
_pausedTweensHex = EditorGUIUtility.isProSkin ? "<color=#ff832a>" : "<color=#873600>";
}
override public void OnInspectorGUI()
@ -59,6 +64,8 @@ namespace DG.DOTweenEditor.UI
int totPausedTweens = totActiveTweens - totPlayingTweens;
int totActiveDefaultTweens = TweenManager.totActiveDefaultTweens;
int totActiveLateTweens = TweenManager.totActiveLateTweens;
int totActiveFixedTweens = TweenManager.totActiveFixedTweens;
int totActiveManualTweens = TweenManager.totActiveManualTweens;
GUILayout.Label(_title, TweenManager.isDebugBuild ? EditorGUIUtils.redLabelStyle : EditorGUIUtils.boldLabelStyle);
@ -98,57 +105,74 @@ namespace DG.DOTweenEditor.UI
GUILayout.EndHorizontal();
GUILayout.Space(8);
_strBuilder.Length = 0;
_strBuilder.Append("Active tweens: ").Append(totActiveTweens)
.Append(" (").Append(TweenManager.totActiveTweeners)
.Append("/").Append(TweenManager.totActiveSequences).Append(")")
.Append("\nDefault/Late tweens: ").Append(totActiveDefaultTweens)
GUILayout.Label("<b>Legend: </b> TW = Tweener, SE = Sequence", EditorGUIUtils.wordWrapRichTextLabelStyle);
GUILayout.Space(8);
_strb.Length = 0;
_strb.Append("Active tweens: ").Append(totActiveTweens)
.Append(" (").Append(TweenManager.totActiveTweeners).Append(" TW, ")
.Append(TweenManager.totActiveSequences).Append(" SE)")
.Append("\nDefault/Late/Fixed/Manual tweens: ").Append(totActiveDefaultTweens)
.Append("/").Append(totActiveLateTweens)
.Append("\nPlaying tweens: ").Append(totPlayingTweens);
.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) _strBuilder.Append("\n - [").Append(t.tweenType).Append("] ").Append(t.target);
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));
}
}
_strBuilder.Append("\nPaused tweens: ").Append(totPausedTweens);
_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) _strBuilder.Append("\n - [").Append(t.tweenType).Append("] ").Append(t.target);
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));
}
}
_strBuilder.Append("\nPooled tweens: ").Append(TweenManager.TotalPooledTweens())
.Append(" (").Append(TweenManager.totPooledTweeners)
.Append("/").Append(TweenManager.totPooledSequences).Append(")");
GUILayout.Label(_strBuilder.ToString());
_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);
_strBuilder.Remove(0, _strBuilder.Length);
_strBuilder.Append("Tweens Capacity: ").Append(TweenManager.maxTweeners).Append("/").Append(TweenManager.maxSequences)
.Append("\nMax Simultaneous Active Tweens: ").Append(DOTween.maxActiveTweenersReached).Append("/").Append(DOTween.maxActiveSequencesReached);
GUILayout.Label(_strBuilder.ToString());
_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);
_strBuilder.Remove(0, _strBuilder.Length);
_strBuilder.Append("SETTINGS ▼");
_strBuilder.Append("\nSafe Mode: ").Append((_isRuntime ? DOTween.useSafeMode : _settings.useSafeMode) ? "ON" : "OFF");
_strBuilder.Append("\nLog Behaviour: ").Append(_isRuntime ? DOTween.logBehaviour : _settings.logBehaviour);
_strBuilder.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);
GUILayout.Label(_strBuilder.ToString());
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);
_strb.Remove(0, _strb.Length);
_strb.Append("<b>SETTINGS ▼</b>");
_strb.Append("\nSafe Mode: ").Append((_isRuntime ? DOTween.useSafeMode : _settings.useSafeMode) ? "ON" : "OFF");
_strb.Append("\nLog Behaviour: ").Append(_isRuntime ? DOTween.logBehaviour : _settings.logBehaviour);
_strb.Append("\nShow Unity Editor Report: ").Append(_isRuntime ? DOTween.showUnityEditorReport : _settings.showUnityEditorReport);
_strb.Append("\nTimeScale (Unity/DOTween): ").Append(Time.timeScale).Append("/").Append(_isRuntime ? DOTween.timeScale : _settings.timeScale);
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.wordWrapRichTextLabelStyle
);
GUILayout.Space(8);
_strBuilder.Remove(0, _strBuilder.Length);
_strBuilder.Append("DEFAULTS ▼");
_strBuilder.Append("\ndefaultRecyclable: ").Append(_isRuntime ? DOTween.defaultRecyclable : _settings.defaultRecyclable);
_strBuilder.Append("\ndefaultUpdateType: ").Append(_isRuntime ? DOTween.defaultUpdateType : _settings.defaultUpdateType);
_strBuilder.Append("\ndefaultTSIndependent: ").Append(_isRuntime ? DOTween.defaultTimeScaleIndependent : _settings.defaultTimeScaleIndependent);
_strBuilder.Append("\ndefaultAutoKill: ").Append(_isRuntime ? DOTween.defaultAutoKill : _settings.defaultAutoKill);
_strBuilder.Append("\ndefaultAutoPlay: ").Append(_isRuntime ? DOTween.defaultAutoPlay : _settings.defaultAutoPlay);
_strBuilder.Append("\ndefaultEaseType: ").Append(_isRuntime ? DOTween.defaultEaseType : _settings.defaultEaseType);
_strBuilder.Append("\ndefaultLoopType: ").Append(_isRuntime ? DOTween.defaultLoopType : _settings.defaultLoopType);
GUILayout.Label(_strBuilder.ToString());
_strb.Remove(0, _strb.Length);
_strb.Append("<b>DEFAULTS ▼</b>");
_strb.Append("\ndefaultRecyclable: ").Append(_isRuntime ? DOTween.defaultRecyclable : _settings.defaultRecyclable);
_strb.Append("\ndefaultUpdateType: ").Append(_isRuntime ? DOTween.defaultUpdateType : _settings.defaultUpdateType);
_strb.Append("\ndefaultTSIndependent: ").Append(_isRuntime ? DOTween.defaultTimeScaleIndependent : _settings.defaultTimeScaleIndependent);
_strb.Append("\ndefaultAutoKill: ").Append(_isRuntime ? DOTween.defaultAutoKill : _settings.defaultAutoKill);
_strb.Append("\ndefaultAutoPlay: ").Append(_isRuntime ? DOTween.defaultAutoPlay : _settings.defaultAutoPlay);
_strb.Append("\ndefaultEaseType: ").Append(_isRuntime ? DOTween.defaultEaseType : _settings.defaultEaseType);
_strb.Append("\ndefaultLoopType: ").Append(_isRuntime ? DOTween.defaultLoopType : _settings.defaultLoopType);
GUILayout.Label(_strb.ToString(), EditorGUIUtils.wordWrapRichTextLabelStyle);
GUILayout.Space(10);
}
@ -169,5 +193,25 @@ namespace DG.DOTweenEditor.UI
}
#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
}
}

View File

@ -21,6 +21,7 @@ namespace DG.DOTweenEditor.UI
public static GUIStyle handlelabelStyle,
handleSelectedLabelStyle,
wordWrapLabelStyle,
wordWrapRichTextLabelStyle,
wordWrapItalicLabelStyle,
titleStyle,
logoIconStyle;
@ -170,6 +171,10 @@ namespace DG.DOTweenEditor.UI
wordWrapLabelStyle = new GUIStyle(UnityEngine.GUI.skin.label);
wordWrapLabelStyle.wordWrap = true;
wordWrapRichTextLabelStyle = new GUIStyle(UnityEngine.GUI.skin.label);
wordWrapRichTextLabelStyle.wordWrap = true;
wordWrapRichTextLabelStyle.richText = true;
wordWrapItalicLabelStyle = new GUIStyle(wordWrapLabelStyle);
wordWrapItalicLabelStyle.fontStyle = FontStyle.Italic;

Binary file not shown.