1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2025-12-20 17:26:03 +08:00

Deleteing DOTween.dll will now remove all DOTween scripting define symbols

This commit is contained in:
Demigiant 2017-04-21 13:31:58 +02:00
parent f02edc07d0
commit 6c30ac79df
43 changed files with 44 additions and 18 deletions

View File

@ -32,7 +32,7 @@ namespace DG.Tweening
public class DOTween
{
/// <summary>DOTween's version</summary>
public static readonly string Version = "1.1.580";
public static readonly string Version = "1.1.590";
///////////////////////////////////////////////
// Options ////////////////////////////////////

View File

@ -83,6 +83,23 @@ namespace DG.DOTweenEditor
SetupComplete(addonsDir, proAddonsDir, totImported);
}
// Uses reflection to call DOTweenPro's AddGlobalDefine method (because older version of Unity didn't have it)
public static void ProEditor_AddGlobalDefine(string id)
{
if (!EditorUtils.hasPro || ProEditorAssembly() == null) return;
Type type = _proEditorAssembly.GetType("DG.DOTweenEditor.Core.ProEditorUtils");
type.GetMethod("AddGlobalDefine", BindingFlags.Public | BindingFlags.Static).Invoke(null, new object[] { id });
}
// Uses reflection to call DOTweenPro's RemoveGlobalDefine method (because older version of Unity didn't have it)
public static void ProEditor_RemoveGlobalDefine(string id)
{
if (!EditorUtils.hasPro || ProEditorAssembly() == null) return;
Type type = _proEditorAssembly.GetType("DG.DOTweenEditor.Core.ProEditorUtils");
type.GetMethod("RemoveGlobalDefine", BindingFlags.Public | BindingFlags.Static).Invoke(null, new object[] { id });
}
static void SetupComplete(string addonsDir, string proAddonsDir, int totImported)
{
int totRemoved = 0;
@ -186,21 +203,5 @@ namespace DG.DOTweenEditor
if (_proEditorAssembly == null) _proEditorAssembly = Assembly.LoadFile(EditorUtils.dotweenProDir + "Editor" + EditorUtils.pathSlash + "DOTweenProEditor.dll");
return _proEditorAssembly;
}
// Uses reflection to call DOTweenPro's AddGlobalDefine method (because older version of Unity didn't have it)
static void ProEditor_AddGlobalDefine(string id)
{
if (!EditorUtils.hasPro || ProEditorAssembly() == null) return;
Type type = _proEditorAssembly.GetType("DG.DOTweenEditor.Core.ProEditorUtils");
type.GetMethod("AddGlobalDefine", BindingFlags.Public | BindingFlags.Static).Invoke(null, new object[] { id });
}
// Uses reflection to call DOTweenPro's RemoveGlobalDefine method (because older version of Unity didn't have it)
static void ProEditor_RemoveGlobalDefine(string id)
{
if (!EditorUtils.hasPro || ProEditorAssembly() == null) return;
Type type = _proEditorAssembly.GetType("DG.DOTweenEditor.Core.ProEditorUtils");
type.GetMethod("RemoveGlobalDefine", BindingFlags.Public | BindingFlags.Static).Invoke(null, new object[] { id });
}
}
}

View File

@ -11,7 +11,32 @@ using UnityEngine;
namespace DG.DOTweenEditor
{
public class UtilityWindowProcessor : AssetPostprocessor
public class UtilityWindowModificationProcessor : 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 DOTweenPro.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;
// DOTween found: remove scripting define symbols
DOTweenSetupMenuItem.ProEditor_RemoveGlobalDefine("DOTWEEN_TK2D");
DOTweenSetupMenuItem.ProEditor_RemoveGlobalDefine("DOTWEEN_TMP");
return AssetDeleteResult.DidNotDelete;
}
}
public class UtilityWindowPostProcessor : AssetPostprocessor
{
static bool _setupDialogRequested; // Used to prevent OnPostProcessAllAssets firing twice (because of a Unity bug/feature)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.