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

Refactoring and preparing to include DOTweenUpgradeManager library

This commit is contained in:
Demigiant 2018-07-16 18:34:38 +02:00
parent 927c38fa61
commit 431cf32a39
12 changed files with 182 additions and 180 deletions

View File

@ -1,7 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using DG.Tweening;
using DG.Tweening.CustomYieldInstructions;
using UnityEngine;
public class CustomYieldInstructions : BrainBase

View File

@ -32,7 +32,7 @@ namespace DG.Tweening
public class DOTween
{
/// <summary>DOTween's version</summary>
public static readonly string Version = "1.2.000"; // Last version before modules: 1.1.755
public static readonly string Version = "1.2.001"; // Last version before modules: 1.1.755
///////////////////////////////////////////////
// Options ////////////////////////////////////

View File

@ -6,7 +6,6 @@
using System;
using System.IO;
using DG.DOTweenEditor.Core;
using UnityEditor;
using UnityEngine;
@ -15,7 +14,7 @@ namespace DG.DOTweenEditor
/// <summary>
/// Not used as menu item anymore, but as a utiity function
/// </summary>
static class DOTweenSetup
static class DOTweenDefines
{
// Modules
public const string GlobalDefine_AudioModule = "DOTAUDIO";

View File

@ -73,14 +73,15 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Core\DelayedCall.cs" />
<Compile Include="Core\EditorGUIUtils.cs" />
<Compile Include="Core\EditorUtils.cs" />
<Compile Include="DOTweenInspector.cs" />
<Compile Include="DOTweenModulesSetupGUI.cs" />
<Compile Include="DOTweenSettingsInspector.cs" />
<Compile Include="DOTweenSetup.cs" />
<Compile Include="DOTweenUtilityWindow.cs" />
<Compile Include="DelayedCall.cs" />
<Compile Include="UI\EditorGUIUtils.cs" />
<Compile Include="EditorUtils.cs" />
<Compile Include="UI\DOTweenInspector.cs" />
<Compile Include="UI\DOTweenUtilityWindowModules.cs" />
<Compile Include="DOTweenProcessors.cs" />
<Compile Include="UI\DOTweenSettingsInspector.cs" />
<Compile Include="DOTweenDefines.cs" />
<Compile Include="UI\DOTweenUtilityWindow.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>

View File

@ -0,0 +1,94 @@
// Author: Daniele Giardini - http://www.demigiant.com
// Created: 2018/07/16 18:07
// License Copyright (c) Daniele Giardini
// This work is subject to the terms at http://dotween.demigiant.com/license.php
using System.IO;
using DG.DOTweenEditor.UI;
using DG.Tweening;
using UnityEditor;
using UnityEngine;
namespace DG.DOTweenEditor
{
public class UtilityWindowModificationProcessor : UnityEditor.AssetModificationProcessor
{
// Checks if deleted folder contains DOTween Pro and in case removes scripting define symbols
static AssetDeleteResult OnWillDeleteAsset(string asset, RemoveAssetOptions options)
{
// Check if asset is a directory
string dir = EditorUtils.ADBPathToFullPath(asset);
if (!Directory.Exists(dir)) return AssetDeleteResult.DidNotDelete;
// Check if directory contains DOTween.dll
string[] files = Directory.GetFiles(dir, "DOTween.dll", SearchOption.AllDirectories);
int len = files.Length;
bool containsDOTween = false;
for (int i = 0; i < len; ++i) {
if (!files[i].EndsWith("DOTween.dll")) continue;
containsDOTween = true;
break;
}
if (!containsDOTween) return AssetDeleteResult.DidNotDelete;
Debug.Log("::: DOTween deleted");
// DOTween is being deleted: deal with it
// Remove EditorPrefs
EditorPrefs.DeleteKey(Application.dataPath + DOTweenUtilityWindow.Id);
EditorPrefs.DeleteKey(Application.dataPath + DOTweenUtilityWindow.IdPro);
// Remove scripting define symbols
DOTweenDefines.RemoveAllDefines();
//
EditorUtility.DisplayDialog("DOTween Deleted",
"DOTween was deleted and all of its scripting define symbols removed." +
"\n\nThis might show an error depending on your previous setup." +
" If this happens, please close and reopen Unity or reimport DOTween.",
"Ok"
);
return AssetDeleteResult.DidNotDelete;
}
}
public class UtilityWindowPostProcessor : AssetPostprocessor
{
static bool _setupDialogRequested; // Used to prevent OnPostProcessAllAssets firing twice (because of a Unity bug/feature)
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
{
Debug.Log("OnPostprocessAllAssets");
if (_setupDialogRequested) return;
string[] dotweenEntries = System.Array.FindAll(importedAssets, name => name.Contains("DOTween") && !name.EndsWith(".meta") && !name.EndsWith(".jpg") && !name.EndsWith(".png"));
bool dotweenImported = dotweenEntries.Length > 0;
if (dotweenImported) {
// Delete old DOTween files
EditorUtils.DeleteLegacyNoModulesDOTweenFiles();
// Delete old DemiLib configuration
EditorUtils.DeleteOldDemiLibCore();
// Remove old legacy defines
DOTweenDefines.RemoveAllLegacyDefines();
//
bool differentCoreVersion = EditorPrefs.GetString(Application.dataPath + DOTweenUtilityWindow.Id) != Application.dataPath + DOTween.Version;
bool differentProVersion = EditorUtils.hasPro && EditorPrefs.GetString(Application.dataPath + DOTweenUtilityWindow.IdPro) != Application.dataPath + EditorUtils.proVersion;
bool setupRequired = differentCoreVersion || differentProVersion;
if (setupRequired) {
_setupDialogRequested = true;
EditorPrefs.SetString(Application.dataPath + DOTweenUtilityWindow.Id, Application.dataPath + DOTween.Version);
if (EditorUtils.hasPro) EditorPrefs.SetString(Application.dataPath + DOTweenUtilityWindow.IdPro, Application.dataPath + EditorUtils.proVersion);
EditorUtility.DisplayDialog("DOTween",
differentCoreVersion
? "New version of DOTween imported." +
"\n\nSelect \"Setup DOTween...\" in DOTween's Utility Panel to add/remove Modules."
: "New version of DOTween Pro imported." +
" \n\nSelect \"Setup DOTween...\" in DOTween's Utility Panel to add/remove external Modules (TextMesh Pro/2DToolkit/etc).",
"Ok"
);
DOTweenUtilityWindow.Open();
// Opening window after a postProcess doesn't work on Unity 3 so check that
// string[] vs = Application.unityVersion.Split("."[0]);
// int majorVersion = System.Convert.ToInt32(vs[0]);
// if (majorVersion >= 4) EditorUtils.DelayedCall(0.5f, DOTweenUtilityWindow.Open);
// EditorUtils.DelayedCall(8, ()=> _setupDialogRequested = false);
}
}
}
}
}

View File

@ -5,7 +5,7 @@ using System;
using UnityEditor;
using UnityEngine;
namespace DG.DOTweenEditor.Core
namespace DG.DOTweenEditor
{
public class DelayedCall
{

View File

@ -2,15 +2,14 @@
// Created: 2014/12/24 13:50
using System;
using System.Collections;
using System.Reflection;
using System.IO;
using System.Reflection;
using System.Text;
using DG.Tweening;
using UnityEditor;
using UnityEngine;
namespace DG.DOTweenEditor.Core
namespace DG.DOTweenEditor
{
public static class EditorUtils
{
@ -96,28 +95,29 @@ namespace DG.DOTweenEditor.Core
{
string adbDOTweenDir = FullPathToADBPath(dotweenDir);
AssetDatabase.StartAssetEditing();
Debug.Log(adbDOTweenDir + "DOTween43.dll");
DeleteAssetsIfExist(new[] {
adbDOTweenDir + "/DOTween43.dll",
adbDOTweenDir + "/DOTween43.xml",
adbDOTweenDir + "/DOTween43.dll.mdb",
adbDOTweenDir + "/DOTween43.dll.addon",
adbDOTweenDir + "/DOTween43.xml.addon",
adbDOTweenDir + "/DOTween43.dll.mdb.addon",
adbDOTweenDir + "/DOTween46.dll",
adbDOTweenDir + "/DOTween46.xml",
adbDOTweenDir + "/DOTween46.dll.mdb",
adbDOTweenDir + "/DOTween46.dll.addon",
adbDOTweenDir + "/DOTween46.xml.addon",
adbDOTweenDir + "/DOTween46.dll.mdb.addon",
adbDOTweenDir + "/DOTween50.dll",
adbDOTweenDir + "/DOTween50.xml",
adbDOTweenDir + "/DOTween50.dll.mdb",
adbDOTweenDir + "/DOTween50.dll.addon",
adbDOTweenDir + "/DOTween50.xml.addon",
adbDOTweenDir + "/DOTween50.dll.mdb.addon",
adbDOTweenDir + "DOTween43.dll",
adbDOTweenDir + "DOTween43.xml",
adbDOTweenDir + "DOTween43.dll.mdb",
adbDOTweenDir + "DOTween43.dll.addon",
adbDOTweenDir + "DOTween43.xml.addon",
adbDOTweenDir + "DOTween43.dll.mdb.addon",
adbDOTweenDir + "DOTween46.dll",
adbDOTweenDir + "DOTween46.xml",
adbDOTweenDir + "DOTween46.dll.mdb",
adbDOTweenDir + "DOTween46.dll.addon",
adbDOTweenDir + "DOTween46.xml.addon",
adbDOTweenDir + "DOTween46.dll.mdb.addon",
adbDOTweenDir + "DOTween50.dll",
adbDOTweenDir + "DOTween50.xml",
adbDOTweenDir + "DOTween50.dll.mdb",
adbDOTweenDir + "DOTween50.dll.addon",
adbDOTweenDir + "DOTween50.xml.addon",
adbDOTweenDir + "DOTween50.dll.mdb.addon",
//
adbDOTweenDir + "/DOTweenTextMeshPro.cs.addon",
adbDOTweenDir + "/DOTweenTk2d.cs.addon",
adbDOTweenDir + "DOTweenTextMeshPro.cs.addon",
adbDOTweenDir + "DOTweenTk2d.cs.addon",
});
AssetDatabase.StopAssetEditing();
}

View File

@ -4,17 +4,13 @@
// License Copyright (c) Daniele Giardini.
// This work is subject to the terms at http://dotween.demigiant.com/license.php
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using DG.DOTweenEditor.Core;
using DG.Tweening;
using DG.Tweening.Core;
using UnityEditor;
using UnityEngine;
namespace DG.DOTweenEditor
namespace DG.DOTweenEditor.UI
{
[CustomEditor(typeof(DOTweenComponent))]
public class DOTweenInspector : Editor

View File

@ -3,9 +3,8 @@
using DG.Tweening.Core;
using UnityEditor;
using UnityEngine;
namespace DG.DOTweenEditor
namespace DG.DOTweenEditor.UI
{
[CustomEditor(typeof(DOTweenSettings))]
public class DOTweenSettingsInspector : Editor
@ -22,11 +21,11 @@ namespace DG.DOTweenEditor
override public void OnInspectorGUI()
{
GUI.enabled = false;
UnityEngine.GUI.enabled = false;
DrawDefaultInspector();
GUI.enabled = true;
UnityEngine.GUI.enabled = true;
}
}
}

View File

@ -2,100 +2,14 @@
// Created: 2014/12/24 13:37
using System.IO;
using System.Reflection;
using DG.DOTweenEditor.Core;
using DG.Tweening;
using DG.Tweening.Core;
using DG.Tweening.Core.Enums;
using UnityEditor;
using UnityEngine;
namespace DG.DOTweenEditor
namespace DG.DOTweenEditor.UI
{
public class UtilityWindowModificationProcessor : UnityEditor.AssetModificationProcessor
{
// Checks if deleted folder contains DOTween Pro and in case removes scripting define symbols
static AssetDeleteResult OnWillDeleteAsset(string asset, RemoveAssetOptions options)
{
// Check if asset is a directory
string dir = EditorUtils.ADBPathToFullPath(asset);
if (!Directory.Exists(dir)) return AssetDeleteResult.DidNotDelete;
// Check if directory contains DOTween.dll
string[] files = Directory.GetFiles(dir, "DOTween.dll", SearchOption.AllDirectories);
int len = files.Length;
bool containsDOTween = false;
for (int i = 0; i < len; ++i) {
if (!files[i].EndsWith("DOTween.dll")) continue;
containsDOTween = true;
break;
}
if (!containsDOTween) return AssetDeleteResult.DidNotDelete;
Debug.Log("::: DOTween deleted");
// DOTween is being deleted: deal with it
// Remove EditorPrefs
EditorPrefs.DeleteKey(Application.dataPath + DOTweenUtilityWindow.Id);
EditorPrefs.DeleteKey(Application.dataPath + DOTweenUtilityWindow.IdPro);
// Remove scripting define symbols
DOTweenSetup.RemoveAllDefines();
//
EditorUtility.DisplayDialog("DOTween Deleted",
"DOTween was deleted and all of its scripting define symbols removed." +
"\n\nThis might show an error depending on your previous setup." +
" If this happens, please close and reopen Unity or reimport DOTween.",
"Ok"
);
return AssetDeleteResult.DidNotDelete;
}
}
public class UtilityWindowPostProcessor : AssetPostprocessor
{
static bool _setupDialogRequested; // Used to prevent OnPostProcessAllAssets firing twice (because of a Unity bug/feature)
static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
{
Debug.Log("::::::::::::::::::::: OnPostprocessAllAssets :::::::::::::::::::::::::::::");
if (_setupDialogRequested) return;
string[] dotweenEntries = System.Array.FindAll(importedAssets, name => name.Contains("DOTween") && !name.EndsWith(".meta") && !name.EndsWith(".jpg") && !name.EndsWith(".png"));
bool dotweenImported = dotweenEntries.Length > 0;
Debug.Log("::: DOTween imported: " + dotweenImported);
if (dotweenImported) {
// Delete old DOTween files
EditorUtils.DeleteLegacyNoModulesDOTweenFiles();
// Delete old DemiLib configuration
EditorUtils.DeleteOldDemiLibCore();
// Remove old legacy defines
DOTweenSetup.RemoveAllLegacyDefines();
//
bool differentCoreVersion = EditorPrefs.GetString(Application.dataPath + DOTweenUtilityWindow.Id) != Application.dataPath + DOTween.Version;
bool differentProVersion = EditorUtils.hasPro && EditorPrefs.GetString(Application.dataPath + DOTweenUtilityWindow.IdPro) != Application.dataPath + EditorUtils.proVersion;
bool setupRequired = differentCoreVersion || differentProVersion;
Debug.Log("::: Setup required: " + setupRequired + " - " + differentCoreVersion + "/" + differentProVersion);
if (setupRequired) {
_setupDialogRequested = true;
EditorPrefs.SetString(Application.dataPath + DOTweenUtilityWindow.Id, Application.dataPath + DOTween.Version);
if (EditorUtils.hasPro) EditorPrefs.SetString(Application.dataPath + DOTweenUtilityWindow.IdPro, Application.dataPath + EditorUtils.proVersion);
// DOTweenSetup.AddAllUnityDefines();
EditorUtility.DisplayDialog("DOTween",
differentCoreVersion
? "New version of DOTween imported." +
"\n\nSelect \"Setup DOTween...\" in DOTween's Utility Panel to add/remove Modules."
: "New version of DOTween Pro imported." +
" \n\nSelect \"Setup DOTween...\" in DOTween's Utility Panel to add/remove external Modules (TextMesh Pro/2DToolkit/etc).",
"Ok"
);
DOTweenUtilityWindow.Open();
// Opening window after a postProcess doesn't work on Unity 3 so check that
// string[] vs = Application.unityVersion.Split("."[0]);
// int majorVersion = System.Convert.ToInt32(vs[0]);
// if (majorVersion >= 4) EditorUtils.DelayedCall(0.5f, DOTweenUtilityWindow.Open);
// EditorUtils.DelayedCall(8, ()=> _setupDialogRequested = false);
}
}
}
}
class DOTweenUtilityWindow : EditorWindow
{
[MenuItem("Tools/Demigiant/" + _Title)]
@ -196,10 +110,10 @@ namespace DG.DOTweenEditor
GUILayout.EndHorizontal();
} else {
if (_isModulesMode) {
if (DOTweenModulesSetupGUI.Draw()) _isModulesMode = false;
if (DOTweenUtilityWindowModules.Draw()) _isModulesMode = false;
} else {
Rect areaRect = new Rect(0, 0, _headerSize.x, 30);
_selectedTab = GUI.Toolbar(areaRect, _selectedTab, _tabLabels);
_selectedTab = UnityEngine.GUI.Toolbar(areaRect, _selectedTab, _tabLabels);
switch (_selectedTab) {
case 1:
@ -219,28 +133,30 @@ namespace DG.DOTweenEditor
void DrawSetupGUI()
{
Rect areaRect = new Rect(0, 30, _headerSize.x, _headerSize.y);
GUI.DrawTexture(areaRect, _headerImg, ScaleMode.StretchToFill, false);
UnityEngine.GUI.DrawTexture(areaRect, _headerImg, ScaleMode.StretchToFill, false);
GUILayout.Space(areaRect.y + _headerSize.y + 2);
GUILayout.Label(_innerTitle, DOTween.isDebugBuild ? EditorGUIUtils.redLabelStyle : EditorGUIUtils.boldLabelStyle);
if (_setupRequired) {
GUI.backgroundColor = Color.red;
GUILayout.BeginVertical(GUI.skin.box);
UnityEngine.GUI.backgroundColor = Color.red;
GUILayout.BeginVertical(UnityEngine.GUI.skin.box);
GUILayout.Label("DOTWEEN SETUP REQUIRED", EditorGUIUtils.setupLabelStyle);
GUILayout.EndVertical();
GUI.backgroundColor = Color.white;
UnityEngine.GUI.backgroundColor = Color.white;
} else GUILayout.Space(8);
GUI.color = Color.green;
UnityEngine.GUI.color = Color.green;
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
if (GUILayout.Button("<b>Setup DOTween...</b>\n(add/remove Modules)", EditorGUIUtils.btSetup)) {
// DOTweenSetup.Setup();
// DOTweenDefines.Setup();
// _setupRequired = EditorUtils.DOTweenSetupRequired();
DOTweenModulesSetupGUI.Refresh();
DOTweenUtilityWindowModules.Refresh();
_isModulesMode = true;
EditorUtils.DeleteLegacyNoModulesDOTweenFiles();
return;
}
GUILayout.FlexibleSpace();
GUI.color = Color.white;
UnityEngine.GUI.color = Color.white;
GUILayout.EndHorizontal();
GUILayout.Space(8);
@ -333,7 +249,7 @@ namespace DG.DOTweenEditor
_src.defaultAutoKill = EditorGUILayout.Toggle("AutoKill", _src.defaultAutoKill);
_src.defaultLoopType = (LoopType)EditorGUILayout.EnumPopup("Loop Type", _src.defaultLoopType);
if (GUI.changed) EditorUtility.SetDirty(_src);
if (UnityEngine.GUI.changed) EditorUtility.SetDirty(_src);
}
// ===================================================================================

View File

@ -3,14 +3,12 @@
// License Copyright (c) Daniele Giardini
// This work is subject to the terms at http://dotween.demigiant.com/license.php
using DG.DOTweenEditor.Core;
using UnityEditor;
using UnityEngine;
using EditorUtils = DG.DOTweenEditor.Core.EditorUtils;
namespace DG.DOTweenEditor
namespace DG.DOTweenEditor.UI
{
public static class DOTweenModulesSetupGUI
public static class DOTweenUtilityWindowModules
{
static bool _hasAudioModule;
static bool _hasPhysicsModule;
@ -23,14 +21,14 @@ namespace DG.DOTweenEditor
public static void Refresh()
{
_hasAudioModule = EditorUtils.HasGlobalDefine(DOTweenSetup.GlobalDefine_AudioModule);
_hasPhysicsModule = EditorUtils.HasGlobalDefine(DOTweenSetup.GlobalDefine_PhysicsModule);
_hasPhysics2DModule = EditorUtils.HasGlobalDefine(DOTweenSetup.GlobalDefine_Physics2DModule);
_hasSpriteModule = EditorUtils.HasGlobalDefine(DOTweenSetup.GlobalDefine_SpriteModule);
_hasUIModule = EditorUtils.HasGlobalDefine(DOTweenSetup.GlobalDefine_UIModule);
_hasAudioModule = EditorUtils.HasGlobalDefine(DOTweenDefines.GlobalDefine_AudioModule);
_hasPhysicsModule = EditorUtils.HasGlobalDefine(DOTweenDefines.GlobalDefine_PhysicsModule);
_hasPhysics2DModule = EditorUtils.HasGlobalDefine(DOTweenDefines.GlobalDefine_Physics2DModule);
_hasSpriteModule = EditorUtils.HasGlobalDefine(DOTweenDefines.GlobalDefine_SpriteModule);
_hasUIModule = EditorUtils.HasGlobalDefine(DOTweenDefines.GlobalDefine_UIModule);
_hasTextMeshProModule = EditorUtils.HasGlobalDefine(DOTweenSetup.GlobalDefine_TextMeshPro);
_hasTk2DModule = EditorUtils.HasGlobalDefine(DOTweenSetup.GlobalDefine_TK2D);
_hasTextMeshProModule = EditorUtils.HasGlobalDefine(DOTweenDefines.GlobalDefine_TextMeshPro);
_hasTk2DModule = EditorUtils.HasGlobalDefine(DOTweenDefines.GlobalDefine_TK2D);
}
// Returns TRUE if it should be closed
@ -38,7 +36,7 @@ namespace DG.DOTweenEditor
{
GUILayout.Label("Add/Remove Modules", EditorGUIUtils.titleStyle);
GUILayout.BeginVertical(GUI.skin.box);
GUILayout.BeginVertical(UnityEngine.GUI.skin.box);
GUILayout.Label("Unity", EditorGUIUtils.boldLabelStyle);
_hasAudioModule = EditorGUILayout.Toggle("Audio", _hasAudioModule);
_hasPhysicsModule = EditorGUILayout.Toggle("Physics", _hasPhysicsModule);
@ -47,7 +45,7 @@ namespace DG.DOTweenEditor
_hasUIModule = EditorGUILayout.Toggle("UI", _hasUIModule);
EditorGUILayout.EndVertical();
if (EditorUtils.hasPro) {
GUILayout.BeginVertical(GUI.skin.box);
GUILayout.BeginVertical(UnityEngine.GUI.skin.box);
GUILayout.Label("External Assets (Pro)", EditorGUIUtils.boldLabelStyle);
_hasTk2DModule = EditorGUILayout.Toggle("2D Toolkit", _hasTk2DModule);
_hasTextMeshProModule = EditorGUILayout.Toggle("TextMesh Pro", _hasTextMeshProModule);
@ -73,15 +71,15 @@ namespace DG.DOTweenEditor
static void Apply()
{
ModifyDefineIfChanged(_hasAudioModule, DOTweenSetup.GlobalDefine_AudioModule);
ModifyDefineIfChanged(_hasPhysicsModule, DOTweenSetup.GlobalDefine_PhysicsModule);
ModifyDefineIfChanged(_hasPhysics2DModule, DOTweenSetup.GlobalDefine_Physics2DModule);
ModifyDefineIfChanged(_hasSpriteModule, DOTweenSetup.GlobalDefine_SpriteModule);
ModifyDefineIfChanged(_hasUIModule, DOTweenSetup.GlobalDefine_UIModule);
ModifyDefineIfChanged(_hasAudioModule, DOTweenDefines.GlobalDefine_AudioModule);
ModifyDefineIfChanged(_hasPhysicsModule, DOTweenDefines.GlobalDefine_PhysicsModule);
ModifyDefineIfChanged(_hasPhysics2DModule, DOTweenDefines.GlobalDefine_Physics2DModule);
ModifyDefineIfChanged(_hasSpriteModule, DOTweenDefines.GlobalDefine_SpriteModule);
ModifyDefineIfChanged(_hasUIModule, DOTweenDefines.GlobalDefine_UIModule);
if (EditorUtils.hasPro) {
ModifyDefineIfChanged(_hasTextMeshProModule, DOTweenSetup.GlobalDefine_TextMeshPro);
ModifyDefineIfChanged(_hasTk2DModule, DOTweenSetup.GlobalDefine_TK2D);
ModifyDefineIfChanged(_hasTextMeshProModule, DOTweenDefines.GlobalDefine_TextMeshPro);
ModifyDefineIfChanged(_hasTk2DModule, DOTweenDefines.GlobalDefine_TK2D);
}
}

View File

@ -6,7 +6,7 @@ using DG.Tweening;
using UnityEditor;
using UnityEngine;
namespace DG.DOTweenEditor.Core
namespace DG.DOTweenEditor.UI
{
public static class EditorGUIUtils
{
@ -101,16 +101,16 @@ namespace DG.DOTweenEditor.Core
// A button which works as a toggle
public static bool ToggleButton(bool toggled, GUIContent content, GUIStyle guiStyle = null, params GUILayoutOption[] options)
{
Color orColor = GUI.backgroundColor;
GUI.backgroundColor = toggled ? Color.green : Color.white;
Color orColor = UnityEngine.GUI.backgroundColor;
UnityEngine.GUI.backgroundColor = toggled ? Color.green : Color.white;
bool clicked = guiStyle == null
? GUILayout.Button(content, options)
: GUILayout.Button(content, guiStyle, options);
if (clicked) {
toggled = !toggled;
GUI.changed = true;
UnityEngine.GUI.changed = true;
}
GUI.backgroundColor = orColor;
UnityEngine.GUI.backgroundColor = orColor;
return toggled;
}
@ -120,7 +120,7 @@ namespace DG.DOTweenEditor.Core
_additionalStylesSet = true;
Vector2 footerSizeV = (Vector2)footerSize;
btImgStyle = new GUIStyle(GUI.skin.button);
btImgStyle = new GUIStyle(UnityEngine.GUI.skin.button);
btImgStyle.normal.background = null;
btImgStyle.imagePosition = ImagePosition.ImageOnly;
btImgStyle.padding = new RectOffset(0, 0, 0, 0);
@ -131,18 +131,18 @@ namespace DG.DOTweenEditor.Core
if (!_stylesSet) {
_stylesSet = true;
boldLabelStyle = new GUIStyle(GUI.skin.label);
boldLabelStyle = new GUIStyle(UnityEngine.GUI.skin.label);
boldLabelStyle.fontStyle = FontStyle.Bold;
redLabelStyle = new GUIStyle(GUI.skin.label);
redLabelStyle = new GUIStyle(UnityEngine.GUI.skin.label);
redLabelStyle.normal.textColor = Color.red;
setupLabelStyle = new GUIStyle(boldLabelStyle);
setupLabelStyle.alignment = TextAnchor.MiddleCenter;
wrapCenterLabelStyle = new GUIStyle(GUI.skin.label);
wrapCenterLabelStyle = new GUIStyle(UnityEngine.GUI.skin.label);
wrapCenterLabelStyle.wordWrap = true;
wrapCenterLabelStyle.alignment = TextAnchor.MiddleCenter;
btBigStyle = new GUIStyle(GUI.skin.button);
btBigStyle = new GUIStyle(UnityEngine.GUI.skin.button);
btBigStyle.padding = new RectOffset(0, 0, 10, 10);
btSetup = new GUIStyle(btBigStyle);
@ -152,12 +152,12 @@ namespace DG.DOTweenEditor.Core
//
titleStyle = new GUIStyle(GUI.skin.label) {
titleStyle = new GUIStyle(UnityEngine.GUI.skin.label) {
fontSize = 12,
fontStyle = FontStyle.Bold
};
handlelabelStyle = new GUIStyle(GUI.skin.label) {
handlelabelStyle = new GUIStyle(UnityEngine.GUI.skin.label) {
normal = { textColor = Color.white },
alignment = TextAnchor.MiddleLeft
};
@ -166,20 +166,20 @@ namespace DG.DOTweenEditor.Core
fontStyle = FontStyle.Bold
};
wordWrapLabelStyle = new GUIStyle(GUI.skin.label);
wordWrapLabelStyle = new GUIStyle(UnityEngine.GUI.skin.label);
wordWrapLabelStyle.wordWrap = true;
wordWrapItalicLabelStyle = new GUIStyle(wordWrapLabelStyle);
wordWrapItalicLabelStyle.fontStyle = FontStyle.Italic;
logoIconStyle = new GUIStyle(GUI.skin.box);
logoIconStyle = new GUIStyle(UnityEngine.GUI.skin.box);
logoIconStyle.active.background = logoIconStyle.normal.background = null;
logoIconStyle.margin = new RectOffset(0, 0, 0, 0);
logoIconStyle.padding = new RectOffset(0, 0, 0, 0);
//
sideBtStyle = new GUIStyle(GUI.skin.button);
sideBtStyle = new GUIStyle(UnityEngine.GUI.skin.button);
sideBtStyle.margin.top = 1;
sideBtStyle.padding = new RectOffset(0, 0, 2, 2);
@ -187,14 +187,14 @@ namespace DG.DOTweenEditor.Core
sideLogoIconBoldLabelStyle.alignment = TextAnchor.MiddleLeft;
sideLogoIconBoldLabelStyle.padding.top = 2;
wordWrapTextArea = new GUIStyle(GUI.skin.textArea);
wordWrapTextArea = new GUIStyle(UnityEngine.GUI.skin.textArea);
wordWrapTextArea.wordWrap = true;
popupButton = new GUIStyle(EditorStyles.popup);
popupButton.fixedHeight = 18;
popupButton.margin.top += 1;
btIconStyle = new GUIStyle(GUI.skin.button);
btIconStyle = new GUIStyle(UnityEngine.GUI.skin.button);
btIconStyle.padding.left -= 2;
btIconStyle.fixedWidth = 24;
btIconStyle.stretchWidth = false;