void OnGUI() { if (!Init()) { GUILayout.Space(8); GUILayout.Label("Completing import process..."); return; } Connect(); EditorGUIUtils.SetGUIStyles(_footerSize); if (Application.isPlaying) { GUILayout.Space(40); GUILayout.BeginHorizontal(); GUILayout.Space(40); GUILayout.Label("DOTween Utility Panel\nis disabled while in Play Mode", EditorGUIUtils.wrapCenterLabelStyle, GUILayout.ExpandWidth(true)); GUILayout.Space(40); GUILayout.EndHorizontal(); } else { _scrollVal = GUILayout.BeginScrollView(_scrollVal); if (_src.modules.showPanel) { if (DOTweenUtilityWindowModules.Draw(this, _src)) { _setupRequired = EditorUtils.DOTweenSetupRequired(); _src.modules.showPanel = false; EditorUtility.SetDirty(_src); } } else { Rect areaRect = new Rect(0, 0, _headerSize.x, 30); _selectedTab = GUI.Toolbar(areaRect, _selectedTab, _tabLabels); switch (_selectedTab) { case 1: float labelW = EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 160; DrawPreferencesGUI(); EditorGUIUtility.labelWidth = labelW; break; default: DrawSetupGUI(); break; } } GUILayout.EndScrollView(); } if (GUI.changed) { EditorUtility.SetDirty(_src); } }
private void OnGUI() { if (!this.Init()) { GUILayout.Space(8f); GUILayout.Label("Completing import process..."); } else { this.Connect(false); EditorGUIUtils.SetGUIStyles(new Vector2?(this._footerSize)); if (Application.isPlaying) { GUILayout.Space(40f); GUILayout.BeginHorizontal(); GUILayout.Space(40f); GUILayout.Label("DOTween Utility Panel\nis disabled while in Play Mode", EditorGUIUtils.wrapCenterLabelStyle, new GUILayoutOption[1] { GUILayout.ExpandWidth(true) }); GUILayout.Space(40f); GUILayout.EndHorizontal(); } else if (this._src.modules.showPanel) { if (DOTweenUtilityWindowModules.Draw((EditorWindow)this, this._src)) { this._setupRequired = EditorUtils.DOTweenSetupRequired(); this._src.modules.showPanel = false; EditorUtility.SetDirty((UnityEngine.Object) this._src); } } else { this._selectedTab = GUI.Toolbar(new Rect(0.0f, 0.0f, this._headerSize.x, 30f), this._selectedTab, this._tabLabels); if (this._selectedTab == 1) { double labelWidth = (double)EditorGUIUtility.labelWidth; EditorGUIUtility.labelWidth = 160f; this.DrawPreferencesGUI(); EditorGUIUtility.labelWidth = (float)labelWidth; } else { this.DrawSetupGUI(); } } if (!GUI.changed) { return; } EditorUtility.SetDirty((UnityEngine.Object) this._src); } }
override public void OnInspectorGUI() { EditorGUIUtils.SetGUIStyles(); int totActiveTweens = TweenManager.totActiveTweens; int totPlayingTweens = TweenManager.TotalPlayingTweens(); int totPausedTweens = totActiveTweens - totPlayingTweens; int totActiveDefaultTweens = TweenManager.totActiveDefaultTweens; int totActiveLateTweens = TweenManager.totActiveLateTweens; GUILayout.Space(4); GUILayout.Label(_title, TweenManager.isDebugBuild ? EditorGUIUtils.redLabelStyle : EditorGUIUtils.boldLabelStyle); GUILayout.Space(6); GUILayout.BeginHorizontal(); if (GUILayout.Button("Documentation")) { Application.OpenURL("http://dotween.demigiant.com/documentation.php"); } if (GUILayout.Button("Check Updates")) { Application.OpenURL("http://dotween.demigiant.com/download.php?v=" + DOTween.Version); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button(_settings.showPlayingTweens ? "Hide Playing Tweens" : "Show Playing Tweens")) { _settings.showPlayingTweens = !_settings.showPlayingTweens; EditorUtility.SetDirty(_settings); } if (GUILayout.Button(_settings.showPausedTweens ? "Hide Paused Tweens" : "Show Paused Tweens")) { _settings.showPausedTweens = !_settings.showPausedTweens; EditorUtility.SetDirty(_settings); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Play all")) { DOTween.PlayAll(); } if (GUILayout.Button("Pause all")) { DOTween.PauseAll(); } if (GUILayout.Button("Kill all")) { DOTween.KillAll(); } 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) .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); _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()); GUILayout.Space(8); _strBuilder.Remove(0, _strBuilder.Length); _strBuilder.Append("SETTINGS ▼"); _strBuilder.Append("\nSafe Mode: ").Append(DOTween.useSafeMode ? "ON" : "OFF"); _strBuilder.Append("\nLog Behaviour: ").Append(DOTween.logBehaviour); _strBuilder.Append("\nShow Unity Editor Report: ").Append(DOTween.showUnityEditorReport); _strBuilder.Append("\nTimeScale (Unity/DOTween): ").Append(Time.timeScale).Append("/").Append(DOTween.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); GUILayout.Space(8); _strBuilder.Remove(0, _strBuilder.Length); _strBuilder.Append("DEFAULTS ▼"); _strBuilder.Append("\ndefaultRecyclable: ").Append(DOTween.defaultRecyclable); _strBuilder.Append("\ndefaultUpdateType: ").Append(DOTween.defaultUpdateType); _strBuilder.Append("\ndefaultTSIndependent: ").Append(DOTween.defaultTimeScaleIndependent); _strBuilder.Append("\ndefaultAutoKill: ").Append(DOTween.defaultAutoKill); _strBuilder.Append("\ndefaultAutoPlay: ").Append(DOTween.defaultAutoPlay); _strBuilder.Append("\ndefaultEaseType: ").Append(DOTween.defaultEaseType); _strBuilder.Append("\ndefaultLoopType: ").Append(DOTween.defaultLoopType); GUILayout.Label(_strBuilder.ToString()); GUILayout.Space(10); }
override public void OnInspectorGUI() { _isRuntime = EditorApplication.isPlaying; ConnectToSource(); EditorGUIUtils.SetGUIStyles(); // Header img GUILayout.Space(4); GUILayout.BeginHorizontal(); Rect headeR = GUILayoutUtility.GetRect(0, 93, 18, 18); GUI.DrawTexture(headeR, _headerImg, ScaleMode.ScaleToFit, true); GUILayout.Label(_isRuntime ? "RUNTIME MODE" : "EDITOR MODE"); GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); int totActiveTweens = TweenManager.totActiveTweens; int totPlayingTweens = TweenManager.TotalPlayingTweens(); 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); if (!_isRuntime) { GUI.backgroundColor = new Color(0f, 0.31f, 0.48f); GUI.contentColor = Color.white; GUILayout.Label( "This component is <b>added automatically</b> by DOTween at runtime." + "\nAdding it yourself is <b>not recommended</b> unless you really know what you're doing:" + " you'll have to be sure it's <b>never destroyed</b> and that it's present <b>in every scene</b>.", EditorGUIUtils.infoboxStyle ); GUI.backgroundColor = GUI.contentColor = GUI.contentColor = Color.white; } GUILayout.Space(6); GUILayout.BeginHorizontal(); if (GUILayout.Button("Documentation")) { Application.OpenURL("http://dotween.demigiant.com/documentation.php"); } if (GUILayout.Button("Check Updates")) { Application.OpenURL("http://dotween.demigiant.com/download.php?v=" + DOTween.Version); } GUILayout.EndHorizontal(); if (_isRuntime) { GUILayout.BeginHorizontal(); if (GUILayout.Button(_settings.showPlayingTweens ? "Hide Playing Tweens" : "Show Playing Tweens")) { _settings.showPlayingTweens = !_settings.showPlayingTweens; EditorUtility.SetDirty(_settings); } if (GUILayout.Button(_settings.showPausedTweens ? "Hide Paused Tweens" : "Show Paused Tweens")) { _settings.showPausedTweens = !_settings.showPausedTweens; EditorUtility.SetDirty(_settings); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Play all")) { DOTween.PlayAll(); } if (GUILayout.Button("Pause all")) { DOTween.PauseAll(); } if (GUILayout.Button("Kill all")) { DOTween.KillAll(); } GUILayout.EndHorizontal(); GUILayout.Space(8); 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("/").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); _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); _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); }