1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2025-12-21 01:36:05 +08:00

[BUGFIX] Fixed some module dependencies not being rewritten correctly + Changing modules now outputs an info log

This commit is contained in:
Demigiant 2018-08-03 12:15:34 +02:00
parent 7458d5b28f
commit d8d57ac71a
19 changed files with 87 additions and 62 deletions

View File

@ -30,8 +30,6 @@ Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
CompatibilityMode|Any CPU = CompatibilityMode|Any CPU CompatibilityMode|Any CPU = CompatibilityMode|Any CPU
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Release_IncludeRigidbody|Any CPU = Release_IncludeRigidbody|Any CPU
Release_NoRigidbody|Any CPU = Release_NoRigidbody|Any CPU
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
@ -39,70 +37,42 @@ Global
{DE17C145-3E8D-45D6-BBB6-D06BD7D80A55}.CompatibilityMode|Any CPU.Build.0 = CompatibilityMode|Any CPU {DE17C145-3E8D-45D6-BBB6-D06BD7D80A55}.CompatibilityMode|Any CPU.Build.0 = CompatibilityMode|Any CPU
{DE17C145-3E8D-45D6-BBB6-D06BD7D80A55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {DE17C145-3E8D-45D6-BBB6-D06BD7D80A55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DE17C145-3E8D-45D6-BBB6-D06BD7D80A55}.Debug|Any CPU.Build.0 = Debug|Any CPU {DE17C145-3E8D-45D6-BBB6-D06BD7D80A55}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE17C145-3E8D-45D6-BBB6-D06BD7D80A55}.Release_IncludeRigidbody|Any CPU.ActiveCfg = Release_IncludeRigidbody|Any CPU
{DE17C145-3E8D-45D6-BBB6-D06BD7D80A55}.Release_IncludeRigidbody|Any CPU.Build.0 = Release_IncludeRigidbody|Any CPU
{DE17C145-3E8D-45D6-BBB6-D06BD7D80A55}.Release_NoRigidbody|Any CPU.ActiveCfg = Release_IncludeRigidbody|Any CPU
{DE17C145-3E8D-45D6-BBB6-D06BD7D80A55}.Release_NoRigidbody|Any CPU.Build.0 = Release_IncludeRigidbody|Any CPU
{DE17C145-3E8D-45D6-BBB6-D06BD7D80A55}.Release|Any CPU.ActiveCfg = Release|Any CPU {DE17C145-3E8D-45D6-BBB6-D06BD7D80A55}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DE17C145-3E8D-45D6-BBB6-D06BD7D80A55}.Release|Any CPU.Build.0 = Release|Any CPU {DE17C145-3E8D-45D6-BBB6-D06BD7D80A55}.Release|Any CPU.Build.0 = Release|Any CPU
{421ACC19-8922-4E98-8921-B52240CE172A}.CompatibilityMode|Any CPU.ActiveCfg = CompatibilityMode|Any CPU {421ACC19-8922-4E98-8921-B52240CE172A}.CompatibilityMode|Any CPU.ActiveCfg = CompatibilityMode|Any CPU
{421ACC19-8922-4E98-8921-B52240CE172A}.CompatibilityMode|Any CPU.Build.0 = CompatibilityMode|Any CPU {421ACC19-8922-4E98-8921-B52240CE172A}.CompatibilityMode|Any CPU.Build.0 = CompatibilityMode|Any CPU
{421ACC19-8922-4E98-8921-B52240CE172A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {421ACC19-8922-4E98-8921-B52240CE172A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{421ACC19-8922-4E98-8921-B52240CE172A}.Debug|Any CPU.Build.0 = Debug|Any CPU {421ACC19-8922-4E98-8921-B52240CE172A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{421ACC19-8922-4E98-8921-B52240CE172A}.Release_IncludeRigidbody|Any CPU.ActiveCfg = Release_IncludeRigidbody|Any CPU
{421ACC19-8922-4E98-8921-B52240CE172A}.Release_IncludeRigidbody|Any CPU.Build.0 = Release_IncludeRigidbody|Any CPU
{421ACC19-8922-4E98-8921-B52240CE172A}.Release_NoRigidbody|Any CPU.ActiveCfg = Release_IncludeRigidbody|Any CPU
{421ACC19-8922-4E98-8921-B52240CE172A}.Release_NoRigidbody|Any CPU.Build.0 = Release_IncludeRigidbody|Any CPU
{421ACC19-8922-4E98-8921-B52240CE172A}.Release|Any CPU.ActiveCfg = Release|Any CPU {421ACC19-8922-4E98-8921-B52240CE172A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{421ACC19-8922-4E98-8921-B52240CE172A}.Release|Any CPU.Build.0 = Release|Any CPU {421ACC19-8922-4E98-8921-B52240CE172A}.Release|Any CPU.Build.0 = Release|Any CPU
{20D2E542-D14F-4678-9C38-F3C0ECF6A2F6}.CompatibilityMode|Any CPU.ActiveCfg = CompatibilityMode|Any CPU {20D2E542-D14F-4678-9C38-F3C0ECF6A2F6}.CompatibilityMode|Any CPU.ActiveCfg = CompatibilityMode|Any CPU
{20D2E542-D14F-4678-9C38-F3C0ECF6A2F6}.CompatibilityMode|Any CPU.Build.0 = CompatibilityMode|Any CPU {20D2E542-D14F-4678-9C38-F3C0ECF6A2F6}.CompatibilityMode|Any CPU.Build.0 = CompatibilityMode|Any CPU
{20D2E542-D14F-4678-9C38-F3C0ECF6A2F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {20D2E542-D14F-4678-9C38-F3C0ECF6A2F6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{20D2E542-D14F-4678-9C38-F3C0ECF6A2F6}.Debug|Any CPU.Build.0 = Debug|Any CPU {20D2E542-D14F-4678-9C38-F3C0ECF6A2F6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{20D2E542-D14F-4678-9C38-F3C0ECF6A2F6}.Release_IncludeRigidbody|Any CPU.ActiveCfg = Release_IncludeRigidbody|Any CPU
{20D2E542-D14F-4678-9C38-F3C0ECF6A2F6}.Release_IncludeRigidbody|Any CPU.Build.0 = Release_IncludeRigidbody|Any CPU
{20D2E542-D14F-4678-9C38-F3C0ECF6A2F6}.Release_NoRigidbody|Any CPU.ActiveCfg = Release_IncludeRigidbody|Any CPU
{20D2E542-D14F-4678-9C38-F3C0ECF6A2F6}.Release_NoRigidbody|Any CPU.Build.0 = Release_IncludeRigidbody|Any CPU
{20D2E542-D14F-4678-9C38-F3C0ECF6A2F6}.Release|Any CPU.ActiveCfg = Release|Any CPU {20D2E542-D14F-4678-9C38-F3C0ECF6A2F6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{20D2E542-D14F-4678-9C38-F3C0ECF6A2F6}.Release|Any CPU.Build.0 = Release|Any CPU {20D2E542-D14F-4678-9C38-F3C0ECF6A2F6}.Release|Any CPU.Build.0 = Release|Any CPU
{978C0952-38D0-4C22-B96C-823EAFEDF0FA}.CompatibilityMode|Any CPU.ActiveCfg = CompatibilityMode|Any CPU {978C0952-38D0-4C22-B96C-823EAFEDF0FA}.CompatibilityMode|Any CPU.ActiveCfg = CompatibilityMode|Any CPU
{978C0952-38D0-4C22-B96C-823EAFEDF0FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {978C0952-38D0-4C22-B96C-823EAFEDF0FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{978C0952-38D0-4C22-B96C-823EAFEDF0FA}.Release_IncludeRigidbody|Any CPU.ActiveCfg = Release_IncludeRigidbody|Any CPU
{978C0952-38D0-4C22-B96C-823EAFEDF0FA}.Release_NoRigidbody|Any CPU.ActiveCfg = Release_IncludeRigidbody|Any CPU
{978C0952-38D0-4C22-B96C-823EAFEDF0FA}.Release|Any CPU.ActiveCfg = Release|Any CPU {978C0952-38D0-4C22-B96C-823EAFEDF0FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{279545AE-D268-42F0-A4C6-AA5BA15FB9BE}.CompatibilityMode|Any CPU.ActiveCfg = CompatibilityMode|Any CPU {279545AE-D268-42F0-A4C6-AA5BA15FB9BE}.CompatibilityMode|Any CPU.ActiveCfg = CompatibilityMode|Any CPU
{279545AE-D268-42F0-A4C6-AA5BA15FB9BE}.CompatibilityMode|Any CPU.Build.0 = CompatibilityMode|Any CPU {279545AE-D268-42F0-A4C6-AA5BA15FB9BE}.CompatibilityMode|Any CPU.Build.0 = CompatibilityMode|Any CPU
{279545AE-D268-42F0-A4C6-AA5BA15FB9BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {279545AE-D268-42F0-A4C6-AA5BA15FB9BE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{279545AE-D268-42F0-A4C6-AA5BA15FB9BE}.Debug|Any CPU.Build.0 = Debug|Any CPU {279545AE-D268-42F0-A4C6-AA5BA15FB9BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{279545AE-D268-42F0-A4C6-AA5BA15FB9BE}.Release_IncludeRigidbody|Any CPU.ActiveCfg = Release_IncludeRigidbody|Any CPU
{279545AE-D268-42F0-A4C6-AA5BA15FB9BE}.Release_IncludeRigidbody|Any CPU.Build.0 = Release_IncludeRigidbody|Any CPU
{279545AE-D268-42F0-A4C6-AA5BA15FB9BE}.Release_NoRigidbody|Any CPU.ActiveCfg = Release_IncludeRigidbody|Any CPU
{279545AE-D268-42F0-A4C6-AA5BA15FB9BE}.Release_NoRigidbody|Any CPU.Build.0 = Release_IncludeRigidbody|Any CPU
{279545AE-D268-42F0-A4C6-AA5BA15FB9BE}.Release|Any CPU.ActiveCfg = Release|Any CPU {279545AE-D268-42F0-A4C6-AA5BA15FB9BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{279545AE-D268-42F0-A4C6-AA5BA15FB9BE}.Release|Any CPU.Build.0 = Release|Any CPU {279545AE-D268-42F0-A4C6-AA5BA15FB9BE}.Release|Any CPU.Build.0 = Release|Any CPU
{AC1E5A23-CE58-419C-B165-EB1CD39AB433}.CompatibilityMode|Any CPU.ActiveCfg = CompatibilityMode|Any CPU {AC1E5A23-CE58-419C-B165-EB1CD39AB433}.CompatibilityMode|Any CPU.ActiveCfg = CompatibilityMode|Any CPU
{AC1E5A23-CE58-419C-B165-EB1CD39AB433}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AC1E5A23-CE58-419C-B165-EB1CD39AB433}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{AC1E5A23-CE58-419C-B165-EB1CD39AB433}.Release_IncludeRigidbody|Any CPU.ActiveCfg = Release_IncludeRigidbody|Any CPU
{AC1E5A23-CE58-419C-B165-EB1CD39AB433}.Release_NoRigidbody|Any CPU.ActiveCfg = Release_IncludeRigidbody|Any CPU
{AC1E5A23-CE58-419C-B165-EB1CD39AB433}.Release|Any CPU.ActiveCfg = Release|Any CPU {AC1E5A23-CE58-419C-B165-EB1CD39AB433}.Release|Any CPU.ActiveCfg = Release|Any CPU
{930C3B07-B00A-44B8-A8E5-452A8FD125C7}.CompatibilityMode|Any CPU.ActiveCfg = CompatibilityMode|Any CPU {930C3B07-B00A-44B8-A8E5-452A8FD125C7}.CompatibilityMode|Any CPU.ActiveCfg = CompatibilityMode|Any CPU
{930C3B07-B00A-44B8-A8E5-452A8FD125C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {930C3B07-B00A-44B8-A8E5-452A8FD125C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{930C3B07-B00A-44B8-A8E5-452A8FD125C7}.Release_IncludeRigidbody|Any CPU.ActiveCfg = Release_IncludeRigidbody|Any CPU
{930C3B07-B00A-44B8-A8E5-452A8FD125C7}.Release_NoRigidbody|Any CPU.ActiveCfg = Release_IncludeRigidbody|Any CPU
{930C3B07-B00A-44B8-A8E5-452A8FD125C7}.Release|Any CPU.ActiveCfg = Release|Any CPU {930C3B07-B00A-44B8-A8E5-452A8FD125C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0B529A90-0B97-4840-BEB6-4A6700B46655}.CompatibilityMode|Any CPU.ActiveCfg = Release|Any CPU {0B529A90-0B97-4840-BEB6-4A6700B46655}.CompatibilityMode|Any CPU.ActiveCfg = Release|Any CPU
{0B529A90-0B97-4840-BEB6-4A6700B46655}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {0B529A90-0B97-4840-BEB6-4A6700B46655}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0B529A90-0B97-4840-BEB6-4A6700B46655}.Release_IncludeRigidbody|Any CPU.ActiveCfg = Release|Any CPU
{0B529A90-0B97-4840-BEB6-4A6700B46655}.Release_NoRigidbody|Any CPU.ActiveCfg = Release|Any CPU
{0B529A90-0B97-4840-BEB6-4A6700B46655}.Release|Any CPU.ActiveCfg = Release|Any CPU {0B529A90-0B97-4840-BEB6-4A6700B46655}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6BC7290B-999D-4688-959C-868306C1F52B}.CompatibilityMode|Any CPU.ActiveCfg = Release|Any CPU {6BC7290B-999D-4688-959C-868306C1F52B}.CompatibilityMode|Any CPU.ActiveCfg = Release|Any CPU
{6BC7290B-999D-4688-959C-868306C1F52B}.CompatibilityMode|Any CPU.Build.0 = Release|Any CPU {6BC7290B-999D-4688-959C-868306C1F52B}.CompatibilityMode|Any CPU.Build.0 = Release|Any CPU
{6BC7290B-999D-4688-959C-868306C1F52B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {6BC7290B-999D-4688-959C-868306C1F52B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6BC7290B-999D-4688-959C-868306C1F52B}.Debug|Any CPU.Build.0 = Debug|Any CPU {6BC7290B-999D-4688-959C-868306C1F52B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6BC7290B-999D-4688-959C-868306C1F52B}.Release_IncludeRigidbody|Any CPU.ActiveCfg = Release|Any CPU
{6BC7290B-999D-4688-959C-868306C1F52B}.Release_IncludeRigidbody|Any CPU.Build.0 = Release|Any CPU
{6BC7290B-999D-4688-959C-868306C1F52B}.Release_NoRigidbody|Any CPU.ActiveCfg = Release|Any CPU
{6BC7290B-999D-4688-959C-868306C1F52B}.Release_NoRigidbody|Any CPU.Build.0 = Release|Any CPU
{6BC7290B-999D-4688-959C-868306C1F52B}.Release|Any CPU.ActiveCfg = Release|Any CPU {6BC7290B-999D-4688-959C-868306C1F52B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6BC7290B-999D-4688-959C-868306C1F52B}.Release|Any CPU.Build.0 = Release|Any CPU {6BC7290B-999D-4688-959C-868306C1F52B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection

View File

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

View File

@ -29,7 +29,7 @@
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>..\bin\</OutputPath> <OutputPath>..\bin\</OutputPath>
<DefineConstants>TRACE;RIGIDBODY</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<DocumentationFile>..\bin\DOTween.XML</DocumentationFile> <DocumentationFile>..\bin\DOTween.XML</DocumentationFile>

View File

@ -29,7 +29,7 @@
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>..\bin\</OutputPath> <OutputPath>..\bin\</OutputPath>
<DefineConstants>TRACE;RIGIDBODY</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<DocumentationFile>..\bin\DOTween43.xml</DocumentationFile> <DocumentationFile>..\bin\DOTween43.xml</DocumentationFile>

View File

@ -29,7 +29,7 @@
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>..\bin\</OutputPath> <OutputPath>..\bin\</OutputPath>
<DefineConstants>TRACE;RIGIDBODY</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<DocumentationFile>..\bin\DOTween46.xml</DocumentationFile> <DocumentationFile>..\bin\DOTween46.xml</DocumentationFile>

View File

@ -29,7 +29,7 @@
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>..\bin\</OutputPath> <OutputPath>..\bin\</OutputPath>
<DefineConstants>TRACE;RIGIDBODY</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<DocumentationFile>..\bin\DOTween50.xml</DocumentationFile> <DocumentationFile>..\bin\DOTween50.xml</DocumentationFile>

View File

@ -29,7 +29,7 @@
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>..\bin\Editor\</OutputPath> <OutputPath>..\bin\Editor\</OutputPath>
<DefineConstants>TRACE;RIGIDBODY</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<DocumentationFile>..\bin\Editor\DOTweenEditor.XML</DocumentationFile> <DocumentationFile>..\bin\Editor\DOTweenEditor.XML</DocumentationFile>

View File

@ -5,6 +5,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text;
using DG.Tweening.Core; using DG.Tweening.Core;
using UnityEditor; using UnityEditor;
using UnityEngine; using UnityEngine;
@ -23,7 +24,13 @@ namespace DG.DOTweenEditor.UI
static readonly ModuleInfo _textMeshProModule = new ModuleInfo("DOTweenTextMeshPro.cs", "TEXTMESHPRO"); static readonly ModuleInfo _textMeshProModule = new ModuleInfo("DOTweenTextMeshPro.cs", "TEXTMESHPRO");
static readonly ModuleInfo _tk2DModule = new ModuleInfo("DOTweenTk2D.cs", "TK2D"); static readonly ModuleInfo _tk2DModule = new ModuleInfo("DOTweenTk2D.cs", "TK2D");
static readonly string _ModuleUtilsPath = "Modules/DOTweenModuleUtils.cs"; // Files that contain multiple module dependencies and which have specific define markers to change
static readonly string[] _ModuleDependentFiles = new[] {
"DOTWEENDIR/Modules/DOTweenModuleUtils.cs",
"DOTWEENPRODIR/DOTweenAnimation.cs",
"DOTWEENPRODIR/DOTweenProShortcuts.cs",
"DOTWEENPRODIR/Editor/DOTweenAnimationInspector.cs",
};
static EditorWindow _editor; static EditorWindow _editor;
static DOTweenSettings _src; static DOTweenSettings _src;
@ -33,7 +40,11 @@ namespace DG.DOTweenEditor.UI
static DOTweenUtilityWindowModules() static DOTweenUtilityWindowModules()
{ {
_ModuleUtilsPath = EditorUtils.dotweenDir + _ModuleUtilsPath; for (int i = 0; i < _ModuleDependentFiles.Length; ++i) {
_ModuleDependentFiles[i] = _ModuleDependentFiles[i].Replace("DOTWEENDIR/", EditorUtils.dotweenDir);
_ModuleDependentFiles[i] = _ModuleDependentFiles[i].Replace("DOTWEENPRODIR/", EditorUtils.dotweenProDir);
}
_audioModule.filePath = EditorUtils.dotweenDir + _audioModule.filePath; _audioModule.filePath = EditorUtils.dotweenDir + _audioModule.filePath;
_physicsModule.filePath = EditorUtils.dotweenDir + _physicsModule.filePath; _physicsModule.filePath = EditorUtils.dotweenDir + _physicsModule.filePath;
_physics2DModule.filePath = EditorUtils.dotweenDir + _physics2DModule.filePath; _physics2DModule.filePath = EditorUtils.dotweenDir + _physics2DModule.filePath;
@ -157,17 +168,42 @@ namespace DG.DOTweenEditor.UI
static void Apply() static void Apply()
{ {
AssetDatabase.StartAssetEditing(); AssetDatabase.StartAssetEditing();
ToggleModule(_audioModule); bool audioToggled = ToggleModule(_audioModule, ref _src.modules.audioEnabled);
ToggleModule(_physicsModule); bool physicsToggled = ToggleModule(_physicsModule, ref _src.modules.physicsEnabled);
ToggleModule(_physics2DModule); bool physics2DToggled = ToggleModule(_physics2DModule, ref _src.modules.physics2DEnabled);
ToggleModule(_spriteModule); bool spriteToggled = ToggleModule(_spriteModule, ref _src.modules.spriteEnabled);
ToggleModule(_uiModule); bool uiToggled = ToggleModule(_uiModule, ref _src.modules.uiEnabled);
bool textMeshProToggled = false;
bool tk2DToggled = false;
if (EditorUtils.hasPro) { if (EditorUtils.hasPro) {
ToggleModule(_textMeshProModule); textMeshProToggled = ToggleModule(_textMeshProModule, ref _src.modules.textMeshProEnabled);
ToggleModule(_tk2DModule); tk2DToggled = ToggleModule(_tk2DModule, ref _src.modules.tk2DEnabled);
} }
AssetDatabase.StopAssetEditing(); AssetDatabase.StopAssetEditing();
EditorUtility.SetDirty(_src);
bool anyToggled = audioToggled || physicsToggled || physics2DToggled || spriteToggled || uiToggled
|| textMeshProToggled || tk2DToggled;
if (anyToggled) {
StringBuilder strb = new StringBuilder();
strb.Append("<b>DOTween module files modified ► </b>");
if (audioToggled) Apply_AppendLog(strb, _src.modules.audioEnabled, "Audio");
if (physicsToggled) Apply_AppendLog(strb, _src.modules.physicsEnabled, "Physics");
if (physics2DToggled) Apply_AppendLog(strb, _src.modules.physics2DEnabled, "Physics2D");
if (spriteToggled) Apply_AppendLog(strb, _src.modules.spriteEnabled, "Sprites");
if (uiToggled) Apply_AppendLog(strb, _src.modules.uiEnabled, "UI");
if (textMeshProToggled) Apply_AppendLog(strb, _src.modules.textMeshProEnabled, "TextMesh Pro");
if (tk2DToggled) Apply_AppendLog(strb, _src.modules.tk2DEnabled, "2D Toolkit");
// Remove last divider
strb.Remove(strb.Length - 3, 3);
Debug.Log(strb.ToString());
}
}
static void Apply_AppendLog(StringBuilder strb, bool enabled, string id)
{
strb.Append("<color=#").Append(enabled ? "00ff00" : "ff0000").Append('>').Append(id).Append("</color>").Append(" - ");
} }
static bool ModuleIsEnabled(ModuleInfo m) static bool ModuleIsEnabled(ModuleInfo m)
@ -177,7 +213,7 @@ namespace DG.DOTweenEditor.UI
using (StreamReader sr = new StreamReader(m.filePath)) { using (StreamReader sr = new StreamReader(m.filePath)) {
string line = sr.ReadLine(); string line = sr.ReadLine();
while (line != null) { while (line != null) {
if (line.EndsWith(ModuleMarkerId) && line.StartsWith("#if")) return line.StartsWith("#if true"); if (line.EndsWith(ModuleMarkerId) && line.StartsWith("#if")) return line.Contains("true");
line = sr.ReadLine(); line = sr.ReadLine();
} }
} }
@ -189,7 +225,7 @@ namespace DG.DOTweenEditor.UI
if (m.enabled != srcModuleEnabled) { if (m.enabled != srcModuleEnabled) {
if (applySettings) { if (applySettings) {
m.enabled = srcModuleEnabled; m.enabled = srcModuleEnabled;
ToggleModule(m); ToggleModule(m, ref srcModuleEnabled);
} else { } else {
srcModuleEnabled = m.enabled; srcModuleEnabled = m.enabled;
EditorUtility.SetDirty(_src); EditorUtility.SetDirty(_src);
@ -197,25 +233,30 @@ namespace DG.DOTweenEditor.UI
} }
} }
static void ToggleModule(ModuleInfo m) // Returns TRUE if files were actually modified
static bool ToggleModule(ModuleInfo m, ref bool srcSetting)
{ {
if (!File.Exists(m.filePath)) return; if (!File.Exists(m.filePath)) return false;
if (ModuleIsEnabled(m) == m.enabled) return; // Already set // if (ModuleIsEnabled(m) == m.enabled) return; // Already set
srcSetting = m.enabled;
bool modifiedFiles = false;
_LinesToChange.Clear(); _LinesToChange.Clear();
string[] lines = File.ReadAllLines(m.filePath); string[] lines = File.ReadAllLines(m.filePath);
for (int i = 0; i < lines.Length; ++i) { for (int i = 0; i < lines.Length; ++i) {
string s = lines[i]; string s = lines[i];
if (s.EndsWith(ModuleMarkerId) && (m.enabled && s.StartsWith("#if false") || !m.enabled && s.StartsWith("#if true"))) { if (s.EndsWith(ModuleMarkerId) && s.StartsWith("#if") && (m.enabled && s.Contains("false") || !m.enabled && s.Contains("true"))) {
_LinesToChange.Add(i); _LinesToChange.Add(i);
} }
} }
if (_LinesToChange.Count > 0) { if (_LinesToChange.Count > 0) {
modifiedFiles = true;
using (StreamWriter sw = new StreamWriter(m.filePath)) { using (StreamWriter sw = new StreamWriter(m.filePath)) {
for (int i = 0; i < lines.Length; ++i) { for (int i = 0; i < lines.Length; ++i) {
string s = lines[i]; string s = lines[i];
if (_LinesToChange.Contains(i)) { if (_LinesToChange.Contains(i)) {
s = m.enabled ? s.Replace("#if false", "#if true") : s.Replace("#if true", "#if false"); s = m.enabled ? s.Replace("false", "true") : s.Replace("true", "false");
} }
sw.WriteLine(s); sw.WriteLine(s);
} }
@ -223,31 +264,45 @@ namespace DG.DOTweenEditor.UI
AssetDatabase.ImportAsset(EditorUtils.FullPathToADBPath(m.filePath), ImportAssetOptions.Default); AssetDatabase.ImportAsset(EditorUtils.FullPathToADBPath(m.filePath), ImportAssetOptions.Default);
} }
// Enable/disable conditions inside DOTweenModuleUtils.cs // Enable/disable conditions inside dependent files
if (!File.Exists(_ModuleUtilsPath)) return;
string marker = m.id + "_MARKER"; string marker = m.id + "_MARKER";
lines = File.ReadAllLines(_ModuleUtilsPath); for (int i = 0; i < _ModuleDependentFiles.Length; ++i) {
bool mod = ToggleModuleInDependentFile(_ModuleDependentFiles[i], m.enabled, marker);
if (mod) modifiedFiles = true;
}
_LinesToChange.Clear(); _LinesToChange.Clear();
return modifiedFiles;
}
// Returns TRUE if files were actually modified
static bool ToggleModuleInDependentFile(string filePath, bool enable, string marker)
{
if (!File.Exists(filePath)) return false;
bool modifiedFiles = false;
_LinesToChange.Clear();
string[] lines = File.ReadAllLines(filePath);
for (int i = 0; i < lines.Length; ++i) { for (int i = 0; i < lines.Length; ++i) {
string s = lines[i]; string s = lines[i];
if (s.EndsWith(marker) && (m.enabled && s.StartsWith("#if false") || !m.enabled && s.StartsWith("#if true"))) { if (s.EndsWith(marker) && s.StartsWith("#if") && (enable && s.Contains("false") || !enable && s.Contains("true"))) {
_LinesToChange.Add(i); _LinesToChange.Add(i);
} }
} }
if (_LinesToChange.Count > 0) { if (_LinesToChange.Count > 0) {
using (StreamWriter sw = new StreamWriter(_ModuleUtilsPath)) { modifiedFiles = true;
using (StreamWriter sw = new StreamWriter(filePath)) {
for (int i = 0; i < lines.Length; ++i) { for (int i = 0; i < lines.Length; ++i) {
string s = lines[i]; string s = lines[i];
if (_LinesToChange.Contains(i)) { if (_LinesToChange.Contains(i)) {
s = m.enabled ? s.Replace("#if false", "#if true") : s.Replace("#if true", "#if false"); s = enable ? s.Replace("false", "true") : s.Replace("true", "false");
} }
sw.WriteLine(s); sw.WriteLine(s);
} }
} }
AssetDatabase.ImportAsset(EditorUtils.FullPathToADBPath(_ModuleUtilsPath), ImportAssetOptions.Default); AssetDatabase.ImportAsset(EditorUtils.FullPathToADBPath(filePath), ImportAssetOptions.Default);
} }
return modifiedFiles;
_LinesToChange.Clear();
} }
#endregion #endregion

View File

@ -30,7 +30,7 @@
<DebugType>pdbonly</DebugType> <DebugType>pdbonly</DebugType>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>..\bin\</OutputPath> <OutputPath>..\bin\</OutputPath>
<DefineConstants>TRACE;DOTAUDIO;DOTPHYSICS;DOTPHYSICS2D;DOTSPRITE;DOTUI;UNITY_4_3;UNITY_4_6;UNITY_5;UNITY_2017_0_OR_NEWER</DefineConstants> <DefineConstants>TRACE;UNITY_4_3;UNITY_4_6;UNITY_5;UNITY_2017_1_OR_NEWER</DefineConstants>
<ErrorReport>prompt</ErrorReport> <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<DocumentationFile> <DocumentationFile>

Binary file not shown.