mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2026-02-04 14:24:55 +08:00
[BUGFIX] Fixed asmdef creation for DOTweenPro editor scripts (now creates a special ASMDEF for them)
This commit is contained in:
parent
98f2201364
commit
e819dec0a3
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1b9c6b17aec073847a9d34c432a148ec
|
||||
timeCreated: 1551037669
|
||||
licenseType: Pro
|
||||
TextScriptImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Binary file not shown.
Binary file not shown.
@ -1,8 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 56bca508bd08a4f44a507f17e7577afb
|
||||
timeCreated: 1551037654
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1,34 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c7602d66796c87a4fac3013913374c07
|
||||
timeCreated: 1551037663
|
||||
licenseType: Pro
|
||||
PluginImporter:
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
platformData:
|
||||
data:
|
||||
first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 0
|
||||
settings: {}
|
||||
data:
|
||||
first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 1
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
data:
|
||||
first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d3e15b806a8368742ba6f10e794d7b76
|
||||
timeCreated: 1551810938
|
||||
timeCreated: 1552647154
|
||||
licenseType: Pro
|
||||
TextureImporter:
|
||||
fileIDToRecycleName: {}
|
||||
|
||||
@ -11,6 +11,16 @@ using UnityEngine.UI;
|
||||
|
||||
public class TempTests : BrainBase
|
||||
{
|
||||
public enum TestEnum {
|
||||
A,
|
||||
B,
|
||||
C,
|
||||
D,
|
||||
E,
|
||||
z = 100
|
||||
}
|
||||
|
||||
public TestEnum testEnum;
|
||||
public Transform target;
|
||||
public Transform rotTarget;
|
||||
public Ease easeType = Ease.Linear;
|
||||
|
||||
Binary file not shown.
@ -32,7 +32,7 @@ namespace DG.Tweening
|
||||
public class DOTween
|
||||
{
|
||||
/// <summary>DOTween's version</summary>
|
||||
public static readonly string Version = "1.2.235"; // Last version before modules: 1.1.755
|
||||
public static readonly string Version = "1.2.240"; // Last version before modules: 1.1.755
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// Options ////////////////////////////////////
|
||||
|
||||
@ -17,7 +17,8 @@ namespace DG.DOTweenEditor
|
||||
public enum ASMDEFType
|
||||
{
|
||||
Modules,
|
||||
DOTweenPro
|
||||
DOTweenPro,
|
||||
DOTweenProEditor
|
||||
}
|
||||
|
||||
enum ChangeType
|
||||
@ -29,11 +30,15 @@ namespace DG.DOTweenEditor
|
||||
|
||||
public static bool hasModulesASMDEF { get; private set; }
|
||||
public static bool hasProASMDEF { get; private set; }
|
||||
public static bool hasProEditorASMDEF { get; private set; }
|
||||
|
||||
|
||||
const string _ModulesId = "DOTween.Modules";
|
||||
const string _ProId = "DOTweenPro.Scripts";
|
||||
const string _ProEditorId = "DOTweenPro.EditorScripts";
|
||||
const string _ModulesASMDEFFile = _ModulesId + ".asmdef";
|
||||
const string _ProASMDEFFile = _ProId + ".asmdef";
|
||||
const string _ProEditorASMDEFFile = _ProEditorId + ".asmdef";
|
||||
|
||||
const string _RefTextMeshPro = "Unity.TextMeshPro";
|
||||
|
||||
@ -48,6 +53,7 @@ namespace DG.DOTweenEditor
|
||||
{
|
||||
hasModulesASMDEF = File.Exists(EditorUtils.dotweenModulesDir + _ModulesASMDEFFile);
|
||||
hasProASMDEF = File.Exists(EditorUtils.dotweenProDir + _ProASMDEFFile);
|
||||
hasProEditorASMDEF = File.Exists(EditorUtils.dotweenProEditorDir + _ProEditorASMDEFFile);
|
||||
}
|
||||
|
||||
public static void RefreshExistingASMDEFFiles()
|
||||
@ -56,19 +62,44 @@ namespace DG.DOTweenEditor
|
||||
|
||||
if (!hasModulesASMDEF) {
|
||||
if (hasProASMDEF) RemoveASMDEF(ASMDEFType.DOTweenPro);
|
||||
if (hasProEditorASMDEF) RemoveASMDEF(ASMDEFType.DOTweenProEditor);
|
||||
return;
|
||||
}
|
||||
if (EditorUtils.hasPro && !hasProASMDEF) {
|
||||
CreateASMDEF(ASMDEFType.DOTweenPro);
|
||||
return;
|
||||
if (EditorUtils.hasPro) {
|
||||
if (!hasProASMDEF) CreateASMDEF(ASMDEFType.DOTweenPro);
|
||||
if (!hasProEditorASMDEF) CreateASMDEF(ASMDEFType.DOTweenProEditor);
|
||||
}
|
||||
|
||||
// Pro ASMDEF present: check that it contains correct elements
|
||||
// Pro ASMDEF present: check that they contain correct elements
|
||||
DOTweenSettings src = DOTweenUtilityWindow.GetDOTweenSettings();
|
||||
if (src == null) return;
|
||||
|
||||
ValidateProASMDEFReferences(src, ASMDEFType.DOTweenPro, EditorUtils.dotweenProDir + _ProASMDEFFile);
|
||||
ValidateProASMDEFReferences(src, ASMDEFType.DOTweenProEditor, EditorUtils.dotweenProEditorDir + _ProEditorASMDEFFile);
|
||||
}
|
||||
|
||||
public static void CreateAllASMDEF()
|
||||
{
|
||||
CreateASMDEF(ASMDEFType.Modules);
|
||||
CreateASMDEF(ASMDEFType.DOTweenPro);
|
||||
CreateASMDEF(ASMDEFType.DOTweenProEditor);
|
||||
}
|
||||
|
||||
public static void RemoveAllASMDEF()
|
||||
{
|
||||
RemoveASMDEF(ASMDEFType.Modules);
|
||||
RemoveASMDEF(ASMDEFType.DOTweenPro);
|
||||
RemoveASMDEF(ASMDEFType.DOTweenProEditor);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
static void ValidateProASMDEFReferences(DOTweenSettings src, ASMDEFType asmdefType, string asmdefFilepath)
|
||||
{
|
||||
bool hasTextMeshProRef = false;
|
||||
using (StreamReader sr = new StreamReader(EditorUtils.dotweenProDir + _ProASMDEFFile)) {
|
||||
using (StreamReader sr = new StreamReader(asmdefFilepath)) {
|
||||
string s;
|
||||
while ((s = sr.ReadLine()) != null) {
|
||||
if (!s.Contains(_RefTextMeshPro)) continue;
|
||||
@ -77,32 +108,28 @@ namespace DG.DOTweenEditor
|
||||
}
|
||||
}
|
||||
bool recreate = hasTextMeshProRef != src.modules.textMeshProEnabled;
|
||||
if (recreate) CreateASMDEF(ASMDEFType.DOTweenPro, true);
|
||||
if (recreate) CreateASMDEF(asmdefType, true);
|
||||
}
|
||||
|
||||
public static void CreateAllASMDEF()
|
||||
{
|
||||
CreateASMDEF(ASMDEFType.Modules);
|
||||
CreateASMDEF(ASMDEFType.DOTweenPro);
|
||||
}
|
||||
|
||||
public static void RemoveAllASMDEF()
|
||||
{
|
||||
RemoveASMDEF(ASMDEFType.Modules);
|
||||
RemoveASMDEF(ASMDEFType.DOTweenPro);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Methods
|
||||
|
||||
static void LogASMDEFChange(ASMDEFType asmdefType, ChangeType changeType)
|
||||
{
|
||||
string asmdefTypeStr = "";
|
||||
switch (asmdefType) {
|
||||
case ASMDEFType.Modules:
|
||||
asmdefTypeStr = "DOTween/Modules/" + _ModulesASMDEFFile;
|
||||
break;
|
||||
case ASMDEFType.DOTweenPro:
|
||||
asmdefTypeStr = "DOTweenPro/" + _ProASMDEFFile;
|
||||
break;
|
||||
case ASMDEFType.DOTweenProEditor:
|
||||
asmdefTypeStr = "DOTweenPro/Editor/" + _ProEditorASMDEFFile;
|
||||
break;
|
||||
}
|
||||
Debug.Log(string.Format(
|
||||
"<b>DOTween ASMDEF file <color=#{0}>{1}</color></b> ► {2}",
|
||||
changeType == ChangeType.Deleted ? "ff0000" : changeType == ChangeType.Created ? "00ff00" : "ff6600",
|
||||
changeType == ChangeType.Deleted ? "removed" : changeType == ChangeType.Created ? "created" : "changed",
|
||||
asmdefType == ASMDEFType.Modules ? "DOTween/Modules/" + _ModulesASMDEFFile : "DOTweenPro/" + _ProASMDEFFile
|
||||
asmdefTypeStr
|
||||
));
|
||||
}
|
||||
|
||||
@ -126,6 +153,12 @@ namespace DG.DOTweenEditor
|
||||
asmdefFile = _ProASMDEFFile;
|
||||
asmdefDir = EditorUtils.dotweenProDir;
|
||||
break;
|
||||
case ASMDEFType.DOTweenProEditor:
|
||||
alreadyPresent = hasProEditorASMDEF;
|
||||
asmdefId = _ProEditorId;
|
||||
asmdefFile = _ProEditorASMDEFFile;
|
||||
asmdefDir = EditorUtils.dotweenProEditorDir;
|
||||
break;
|
||||
}
|
||||
if (alreadyPresent && !forceOverwrite) {
|
||||
EditorUtility.DisplayDialog("Create ASMDEF", asmdefFile + " already exists", "Ok");
|
||||
@ -148,14 +181,25 @@ namespace DG.DOTweenEditor
|
||||
sw.WriteLine("\t\"name\": \"{0}\"", asmdefId);
|
||||
break;
|
||||
case ASMDEFType.DOTweenPro:
|
||||
case ASMDEFType.DOTweenProEditor:
|
||||
sw.WriteLine("\t\"name\": \"{0}\",", asmdefId);
|
||||
sw.WriteLine("\t\"references\": [");
|
||||
DOTweenSettings src = DOTweenUtilityWindow.GetDOTweenSettings();
|
||||
if (src != null) {
|
||||
if (src.modules.textMeshProEnabled) sw.WriteLine("\t\t\"{0}\",", _RefTextMeshPro);
|
||||
}
|
||||
if (type == ASMDEFType.DOTweenProEditor) {
|
||||
sw.WriteLine("\t\t\"{0}\",", _ModulesId);
|
||||
sw.WriteLine("\t\t\"{0}\"", _ProId);
|
||||
sw.WriteLine("\t],");
|
||||
sw.WriteLine("\t\"includePlatforms\": [");
|
||||
sw.WriteLine("\t\t\"Editor\"");
|
||||
sw.WriteLine("\t],");
|
||||
sw.WriteLine("\t\"autoReferenced\": false");
|
||||
} else {
|
||||
sw.WriteLine("\t\t\"{0}\"", _ModulesId);
|
||||
sw.WriteLine("\t]");
|
||||
}
|
||||
break;
|
||||
}
|
||||
sw.WriteLine("}");
|
||||
@ -182,6 +226,11 @@ namespace DG.DOTweenEditor
|
||||
asmdefFile = _ProASMDEFFile;
|
||||
asmdefDir = EditorUtils.dotweenProDir;
|
||||
break;
|
||||
case ASMDEFType.DOTweenProEditor:
|
||||
alreadyPresent = hasProEditorASMDEF;
|
||||
asmdefFile = _ProEditorASMDEFFile;
|
||||
asmdefDir = EditorUtils.dotweenProEditorDir;
|
||||
break;
|
||||
}
|
||||
|
||||
Refresh();
|
||||
|
||||
@ -26,6 +26,8 @@ namespace DG.DOTweenEditor
|
||||
// With final slash (system based)
|
||||
public static string dotweenProDir { get { if (string.IsNullOrEmpty(_dotweenProDir)) StoreDOTweenDirs(); return _dotweenProDir; } }
|
||||
// With final slash (system based)
|
||||
public static string dotweenProEditorDir { get { if (string.IsNullOrEmpty(_dotweenProEditorDir)) StoreDOTweenDirs(); return _dotweenProEditorDir; } }
|
||||
// With final slash (system based)
|
||||
public static string dotweenModulesDir { get { if (string.IsNullOrEmpty(_dotweenModulesDir)) StoreDOTweenDirs(); return _dotweenModulesDir; } }
|
||||
public static bool isOSXEditor { get; private set; }
|
||||
public static string pathSlash { get; private set; } // for full paths
|
||||
@ -39,6 +41,7 @@ namespace DG.DOTweenEditor
|
||||
static string _demigiantDir; // with final slash
|
||||
static string _dotweenDir; // with final slash
|
||||
static string _dotweenProDir; // with final slash
|
||||
static string _dotweenProEditorDir; // with final slash
|
||||
static string _dotweenModulesDir; // with final slash
|
||||
|
||||
static EditorUtils()
|
||||
@ -375,6 +378,7 @@ namespace DG.DOTweenEditor
|
||||
|
||||
_dotweenDir = _dotweenDir.Replace(pathSlashToReplace, pathSlash);
|
||||
_dotweenProDir = _dotweenProDir.Replace(pathSlashToReplace, pathSlash);
|
||||
_dotweenProEditorDir = _dotweenProDir + "Editor" + pathSlash;
|
||||
_dotweenModulesDir = _dotweenDir + "Modules" + pathSlash;
|
||||
if (_demigiantDir != null) _demigiantDir = _demigiantDir.Replace(pathSlashToReplace, pathSlash);
|
||||
}
|
||||
|
||||
@ -182,14 +182,16 @@ namespace DG.DOTweenEditor.UI
|
||||
if (GUILayout.Button(ASMDEFManager.hasModulesASMDEF ? "Remove ASMDEF..." : "Create ASMDEF...", EditorGUIUtils.btSetup, GUILayout.Width(200))) {
|
||||
if (ASMDEFManager.hasModulesASMDEF) {
|
||||
if (EditorUtility.DisplayDialog("Remove ASMDEF",
|
||||
string.Format("This will remove the \"DOTween/Modules/DOTween.Modules.asmdef\" and \"DOTweenPro/DOTweenPro.Scripts.asmdef\"" +
|
||||
" (if you have DOTween Pro) files."),
|
||||
string.Format("This will remove the \"DOTween/Modules/DOTween.Modules.asmdef\" file" +
|
||||
" (and if you have DOTween Pro also the \"DOTweenPro/DOTweenPro.Scripts.asmdef\"" +
|
||||
" and \"DOTweenPro/Editor/DOTweenPro.EditorScripts.asmdef\" files)"),
|
||||
"Ok", "Cancel"
|
||||
)) ASMDEFManager.RemoveAllASMDEF();
|
||||
} else {
|
||||
if (EditorUtility.DisplayDialog("Create ASMDEF",
|
||||
string.Format("This will create the \"DOTween/Modules/DOTween.Modules.asmdef\" and \"DOTweenPro/DOTweenPro.Scripts.asmdef\"" +
|
||||
" (if you have DOTween Pro) files."),
|
||||
string.Format("This will create the \"DOTween/Modules/DOTween.Modules.asmdef\" file" +
|
||||
" (and if you have DOTween Pro also the \"DOTweenPro/DOTweenPro.Scripts.asmdef\"" +
|
||||
" and \"DOTweenPro/Editor/DOTweenPro.EditorScripts.asmdef\" files)"),
|
||||
"Ok", "Cancel"
|
||||
)) ASMDEFManager.CreateAllASMDEF();
|
||||
}
|
||||
|
||||
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