Skip to content

Commit

Permalink
Implemented modules support for DOTweenTimeline
Browse files Browse the repository at this point in the history
  • Loading branch information
Demigiant committed Apr 11, 2020
1 parent 9ed8ef9 commit dba6264
Show file tree
Hide file tree
Showing 15 changed files with 18 additions and 13 deletions.
Binary file modified UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll
Binary file not shown.
Binary file modified UnityTests.Unity5/Assets/Demigiant/DOTween/DOTween.dll.mdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion _DOTween.Assembly/DOTween/DOTween.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace DG.Tweening
public class DOTween
{
/// <summary>DOTween's version</summary>
public static readonly string Version = "1.2.370"; // Last version before modules: 1.1.755
public static readonly string Version = "1.2.375"; // Last version before modules: 1.1.755

///////////////////////////////////////////////
// Options ////////////////////////////////////
Expand Down
23 changes: 11 additions & 12 deletions _DOTween.Assembly/DOTweenEditor/UI/DOTweenUtilityWindowModules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public static class DOTweenUtilityWindowModules
static readonly ModuleInfo _uiModule = new ModuleInfo("Modules/DOTweenModuleUI.cs", "UI");
static readonly ModuleInfo _textMeshProModule = new ModuleInfo("DOTweenTextMeshPro.cs", "TEXTMESHPRO");
static readonly ModuleInfo _tk2DModule = new ModuleInfo("DOTweenTk2D.cs", "TK2D");
static readonly ModuleInfo _deAudioModule = new ModuleInfo(null, "DEAUDIO");
static readonly ModuleInfo _deUnityExtendedModule = new ModuleInfo(null, "DEUNITYEXTENDED");
static readonly ModuleInfo _deAudioModule = new ModuleInfo("DOTweenDeAudio.cs", "DEAUDIO");
static readonly ModuleInfo _deUnityExtendedModule = new ModuleInfo("DOTweenDeUnityExtended.cs", "DEUNITYEXTENDED");

// Files that contain multiple module dependencies and which have specific define markers to change
static readonly string[] _ModuleDependentFiles = new[] {
Expand Down Expand Up @@ -58,6 +58,8 @@ static DOTweenUtilityWindowModules()
_uiModule.filePath = EditorUtils.dotweenDir + _uiModule.filePath;
_textMeshProModule.filePath = EditorUtils.dotweenProDir + _textMeshProModule.filePath;
_tk2DModule.filePath = EditorUtils.dotweenProDir + _tk2DModule.filePath;
_deAudioModule.filePath = EditorUtils.dotweenProDir + _deAudioModule.filePath;
_deUnityExtendedModule.filePath = EditorUtils.dotweenProDir + _deUnityExtendedModule.filePath;
}

#region GUI
Expand Down Expand Up @@ -165,8 +167,8 @@ public static void Refresh(DOTweenSettings src, bool applySrcSettings = false)
//
_textMeshProModule.enabled = ModuleIsEnabled(_textMeshProModule);
_tk2DModule.enabled = ModuleIsEnabled(_tk2DModule);
_deAudioModule.enabled = ModuleIsEnabled(_deAudioModule, src.modules.deAudioEnabled);
_deUnityExtendedModule.enabled = ModuleIsEnabled(_deUnityExtendedModule, src.modules.deUnityExtendedEnabled);
_deAudioModule.enabled = ModuleIsEnabled(_deAudioModule);
_deUnityExtendedModule.enabled = ModuleIsEnabled(_deUnityExtendedModule);

CheckAutoModuleSettings(applySrcSettings, _audioModule, ref src.modules.audioEnabled);
CheckAutoModuleSettings(applySrcSettings, _physicsModule, ref src.modules.physicsEnabled);
Expand Down Expand Up @@ -233,12 +235,9 @@ 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, bool? setToThisIfNoModuleBasedFileExists = null)
static bool ModuleIsEnabled(ModuleInfo m)
{
if (!File.Exists(m.filePath)) {
if (setToThisIfNoModuleBasedFileExists == null) return false;
else return (bool)setToThisIfNoModuleBasedFileExists;
}
if (!File.Exists(m.filePath)) return false;

using (StreamReader sr = new StreamReader(m.filePath)) {
string line = sr.ReadLine();
Expand All @@ -252,15 +251,15 @@ static bool ModuleIsEnabled(ModuleInfo m, bool? setToThisIfNoModuleBasedFileExis

static void CheckAutoModuleSettings(bool applySettings, ModuleInfo m, ref bool srcModuleEnabled)
{
// if (m.enabled != srcModuleEnabled) {
if (m.enabled != srcModuleEnabled) {
if (applySettings) {
m.enabled = srcModuleEnabled;
ToggleModule(m, ref srcModuleEnabled);
} else {
srcModuleEnabled = m.enabled;
EditorUtility.SetDirty(_src);
}
// }
}
}

// Returns TRUE if files were actually modified
Expand Down Expand Up @@ -298,7 +297,7 @@ static bool ToggleModule(ModuleInfo m, ref bool srcSetting)
}

// Enable/disable conditions inside dependent files
string marker = m.id + "_MARKER";
string marker = "// " + m.id + "_MARKER";
for (int i = 0; i < _ModuleDependentFiles.Length; ++i) {
bool mod = ToggleModuleInDependentFile(_ModuleDependentFiles[i], m.enabled, marker);
if (mod) modifiedFiles = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\bin_pro\DOTweenDeAudio.cs">
<Link>bin_pro\DOTweenDeAudio.cs</Link>
</Compile>
<Compile Include="..\bin_pro\DOTweenDeUnityExtended.cs">
<Link>bin_pro\DOTweenDeUnityExtended.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="..\bin\*.cs">
<Link>bin\%(FileName)</Link>
Expand Down
Binary file modified _DOTween.Assembly/bin/DOTween.dll
Binary file not shown.
Binary file modified _DOTween.Assembly/bin/DOTween.dll.mdb
Binary file not shown.
Binary file modified _DOTween.Assembly/bin/Editor/DOTweenEditor.dll
Binary file not shown.
Binary file modified _DOTween.Assembly/bin/Editor/DOTweenEditor.dll.mdb
Binary file not shown.
Binary file modified _DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll
Binary file not shown.
Binary file modified _DOTween.Assembly/bin/Editor/DOTweenUpgradeManager.dll.mdb
Binary file not shown.

0 comments on commit dba6264

Please sign in to comment.