mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2025-12-22 02:06:06 +08:00
Modules Panel now doesn't close when upgrade compilation ends
This commit is contained in:
parent
2887a8b4a5
commit
1f5e48d269
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -37,6 +37,7 @@ namespace DG.Tweening.Core
|
||||
DemigiantDirectory
|
||||
}
|
||||
public SettingsLocation storeSettingsLocation = SettingsLocation.AssetsDirectory;
|
||||
public bool showModulesPanel;
|
||||
|
||||
// Editor-Only ► DOTween Inspector
|
||||
public bool showPlayingTweens, showPausedTweens;
|
||||
|
||||
@ -32,7 +32,7 @@ namespace DG.Tweening
|
||||
public class DOTween
|
||||
{
|
||||
/// <summary>DOTween's version</summary>
|
||||
public static readonly string Version = "1.2.015"; // Last version before modules: 1.1.755
|
||||
public static readonly string Version = "1.2.020"; // Last version before modules: 1.1.755
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// Options ////////////////////////////////////
|
||||
|
||||
@ -29,7 +29,6 @@ namespace DG.DOTweenEditor.UI
|
||||
bool _setupRequired;
|
||||
|
||||
int _selectedTab;
|
||||
bool _isModulesMode;
|
||||
string[] _tabLabels = new[] { "Setup", "Preferences" };
|
||||
string[] _settingsLocation = new[] {"Assets > Resources", "DOTween > Resources", "Demigiant > Resources"};
|
||||
|
||||
@ -87,9 +86,12 @@ namespace DG.DOTweenEditor.UI
|
||||
_setupRequired = EditorUtils.DOTweenSetupRequired();
|
||||
}
|
||||
|
||||
void OnDisable()
|
||||
void OnDestroy()
|
||||
{
|
||||
_isModulesMode = false;
|
||||
if (_src != null) {
|
||||
_src.showModulesPanel = false;
|
||||
EditorUtility.SetDirty(_src);
|
||||
}
|
||||
}
|
||||
|
||||
void OnGUI()
|
||||
@ -110,10 +112,11 @@ namespace DG.DOTweenEditor.UI
|
||||
GUILayout.Space(40);
|
||||
GUILayout.EndHorizontal();
|
||||
} else {
|
||||
if (_isModulesMode) {
|
||||
if (DOTweenUtilityWindowModules.Draw()) {
|
||||
if (_src.showModulesPanel) {
|
||||
if (DOTweenUtilityWindowModules.Draw(this)) {
|
||||
_setupRequired = EditorUtils.DOTweenSetupRequired();
|
||||
_isModulesMode = false;
|
||||
_src.showModulesPanel = false;
|
||||
EditorUtility.SetDirty(_src);
|
||||
}
|
||||
} else {
|
||||
Rect areaRect = new Rect(0, 0, _headerSize.x, 30);
|
||||
@ -129,6 +132,8 @@ namespace DG.DOTweenEditor.UI
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (GUI.changed) EditorUtility.SetDirty(_src);
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
@ -155,7 +160,8 @@ namespace DG.DOTweenEditor.UI
|
||||
// DOTweenDefines.Setup();
|
||||
// _setupRequired = EditorUtils.DOTweenSetupRequired();
|
||||
DOTweenUtilityWindowModules.Refresh();
|
||||
_isModulesMode = true;
|
||||
_src.showModulesPanel = true;
|
||||
EditorUtility.SetDirty(_src);
|
||||
EditorUtils.DeleteLegacyNoModulesDOTweenFiles();
|
||||
EditorUtils.DeleteDOTweenUpgradeManagerFiles();
|
||||
return;
|
||||
@ -253,8 +259,6 @@ namespace DG.DOTweenEditor.UI
|
||||
_src.defaultEasePeriod = EditorGUILayout.FloatField("Ease Period", _src.defaultEasePeriod);
|
||||
_src.defaultAutoKill = EditorGUILayout.Toggle("AutoKill", _src.defaultAutoKill);
|
||||
_src.defaultLoopType = (LoopType)EditorGUILayout.EnumPopup("Loop Type", _src.defaultLoopType);
|
||||
|
||||
if (UnityEngine.GUI.changed) EditorUtility.SetDirty(_src);
|
||||
}
|
||||
|
||||
// ===================================================================================
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
// License Copyright (c) Daniele Giardini
|
||||
// This work is subject to the terms at http://dotween.demigiant.com/license.php
|
||||
|
||||
using DG.Tweening.Core;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
@ -10,6 +11,7 @@ namespace DG.DOTweenEditor.UI
|
||||
{
|
||||
public static class DOTweenUtilityWindowModules
|
||||
{
|
||||
static bool _refreshed;
|
||||
static bool _hasAudioModule;
|
||||
static bool _hasPhysicsModule;
|
||||
static bool _hasPhysics2DModule;
|
||||
@ -19,8 +21,13 @@ namespace DG.DOTweenEditor.UI
|
||||
static bool _hasTextMeshProModule;
|
||||
static bool _hasTk2DModule;
|
||||
|
||||
static EditorWindow _editor;
|
||||
static bool _isWaitingForCompilation;
|
||||
|
||||
public static void Refresh()
|
||||
{
|
||||
_refreshed = true;
|
||||
|
||||
_hasAudioModule = EditorUtils.HasGlobalDefine(DOTweenDefines.GlobalDefine_AudioModule);
|
||||
_hasPhysicsModule = EditorUtils.HasGlobalDefine(DOTweenDefines.GlobalDefine_PhysicsModule);
|
||||
_hasPhysics2DModule = EditorUtils.HasGlobalDefine(DOTweenDefines.GlobalDefine_Physics2DModule);
|
||||
@ -32,10 +39,16 @@ namespace DG.DOTweenEditor.UI
|
||||
}
|
||||
|
||||
// Returns TRUE if it should be closed
|
||||
public static bool Draw()
|
||||
public static bool Draw(EditorWindow editor)
|
||||
{
|
||||
_editor = editor;
|
||||
if (!_refreshed) Refresh();
|
||||
|
||||
GUILayout.Label("Add/Remove Modules", EditorGUIUtils.titleStyle);
|
||||
|
||||
if (EditorApplication.isCompiling) WaitForCompilation();
|
||||
|
||||
EditorGUI.BeginDisabledGroup(EditorApplication.isCompiling);
|
||||
GUILayout.BeginVertical(UnityEngine.GUI.skin.box);
|
||||
GUILayout.Label("Unity", EditorGUIUtils.boldLabelStyle);
|
||||
_hasAudioModule = EditorGUILayout.Toggle("Audio", _hasAudioModule);
|
||||
@ -58,14 +71,12 @@ namespace DG.DOTweenEditor.UI
|
||||
Apply();
|
||||
return true;
|
||||
}
|
||||
if (GUILayout.Button("Cancel")) return true;
|
||||
if (GUILayout.Button("Cancel")) {
|
||||
return true;
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
EditorGUI.EndDisabledGroup();
|
||||
|
||||
// EditorGUILayout.HelpBox(
|
||||
// "NOTE: if you get \"PlayerSettings Validation\" or [CS0618] errors when you press apply don't worry:" +
|
||||
// " it's ok and it allows the setup to work on all possible Unity versions",
|
||||
// MessageType.Warning
|
||||
// );
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -91,5 +102,26 @@ namespace DG.DOTweenEditor.UI
|
||||
else EditorUtils.RemoveGlobalDefine(defineId);
|
||||
}
|
||||
}
|
||||
|
||||
static void WaitForCompilation()
|
||||
{
|
||||
if (!_isWaitingForCompilation) {
|
||||
_isWaitingForCompilation = true;
|
||||
EditorApplication.update += WaitForCompilation_Update;
|
||||
WaitForCompilation_Update();
|
||||
}
|
||||
|
||||
EditorGUILayout.HelpBox("Waiting for Unity to finish the compilation process...", MessageType.Info);
|
||||
}
|
||||
|
||||
static void WaitForCompilation_Update()
|
||||
{
|
||||
if (!EditorApplication.isCompiling) {
|
||||
EditorApplication.update -= WaitForCompilation_Update;
|
||||
_isWaitingForCompilation = false;
|
||||
Refresh();
|
||||
}
|
||||
_editor.Repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
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