mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2025-12-20 09:16:02 +08:00
DOTween Utility Panel > Implemented choice of Settings location
This commit is contained in:
parent
bd5a686d18
commit
9be6d63fd6
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,6 +6,7 @@ _DOTween.Assembly/*.suo
|
||||
_DOTween.Assembly/*.user
|
||||
_DOTween.Assembly/.gitignore
|
||||
_DOTween.Assembly/.git
|
||||
ExternalPluginsTestsAndExamples*
|
||||
*.Unity*/_ReSharper*
|
||||
*.Unity*/Library
|
||||
*.Unity*/obj
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 37ee0778ced0de945b4521e7e0ee9dac
|
||||
folderAsset: yes
|
||||
timeCreated: 1428482901
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1,5 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c4ba43af0a1577c44aed9e8ee47cbb81
|
||||
guid: 6c68a80831d8da74087b61dad131dcd6
|
||||
folderAsset: yes
|
||||
timeCreated: 1428751523
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ce117ac50a01981468b64937132115fa
|
||||
timeCreated: 1426159620
|
||||
licenseType: Pro
|
||||
guid: fbcef3e5c5a51234b9946a301f852687
|
||||
timeCreated: 1428751188
|
||||
licenseType: Free
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
|
||||
Binary file not shown.
@ -6,11 +6,13 @@ using TMPro;
|
||||
public class ExternalPlugins_TextMeshPro : BrainBase
|
||||
{
|
||||
public TextMeshPro[] texts;
|
||||
public TextMeshProUGUI[] uguiTexts;
|
||||
|
||||
[TextArea(5, 10)]
|
||||
public string replaceWText = "This <#00ff00>rich <b>bold</b>+<i>italic</i> text</color> is <#ff0000>gonna appear</color> with a tween, <#f38013>yabadabadoo!</color>";
|
||||
bool richTextEnabled = true;
|
||||
string[] orTexts;
|
||||
string[] orGuiTexts;
|
||||
|
||||
void Start()
|
||||
{
|
||||
@ -18,6 +20,8 @@ public class ExternalPlugins_TextMeshPro : BrainBase
|
||||
|
||||
orTexts = new string[texts.Length];
|
||||
for (int i = 0; i < texts.Length; ++i) orTexts[i] = texts[i].text;
|
||||
orGuiTexts = new string[uguiTexts.Length];
|
||||
for (int i = 0; i < uguiTexts.Length; ++i) orGuiTexts[i] = uguiTexts[i].text;
|
||||
}
|
||||
|
||||
void OnGUI()
|
||||
@ -25,45 +29,106 @@ public class ExternalPlugins_TextMeshPro : BrainBase
|
||||
if (GUILayout.Button("Rich Text Support: " + (richTextEnabled ? "ON" : "OFF"))) richTextEnabled = !richTextEnabled;
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Color To Green")) foreach (TextMeshPro t in texts) t.DOColor(Color.green, 1).SetEase(Ease.Linear);
|
||||
if (GUILayout.Button("Color To Red")) foreach (TextMeshPro t in texts) t.DOColor(Color.red, 1).SetEase(Ease.Linear);
|
||||
if (GUILayout.Button("Fade Out")) foreach (TextMeshPro t in texts) t.DOFade(0, 1).SetEase(Ease.Linear);
|
||||
if (GUILayout.Button("Fade In")) foreach (TextMeshPro t in texts) t.DOFade(1, 1).SetEase(Ease.Linear);
|
||||
if (GUILayout.Button("Color To Green")) {
|
||||
foreach (TextMeshPro t in texts) t.DOColor(Color.green, 1).SetEase(Ease.Linear);
|
||||
foreach (TextMeshProUGUI t in uguiTexts) t.DOColor(Color.green, 1).SetEase(Ease.Linear);
|
||||
}
|
||||
if (GUILayout.Button("Color To Red")) {
|
||||
foreach (TextMeshPro t in texts) t.DOColor(Color.red, 1).SetEase(Ease.Linear);
|
||||
foreach (TextMeshProUGUI t in uguiTexts) t.DOColor(Color.red, 1).SetEase(Ease.Linear);
|
||||
}
|
||||
if (GUILayout.Button("Fade Out")) {
|
||||
foreach (TextMeshPro t in texts) t.DOFade(0, 1).SetEase(Ease.Linear);
|
||||
foreach (TextMeshProUGUI t in uguiTexts) t.DOFade(0, 1).SetEase(Ease.Linear);
|
||||
}
|
||||
if (GUILayout.Button("Fade In")) {
|
||||
foreach (TextMeshPro t in texts) t.DOFade(1, 1).SetEase(Ease.Linear);
|
||||
foreach (TextMeshProUGUI t in uguiTexts) t.DOFade(1, 1).SetEase(Ease.Linear);
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Face Color To Green")) foreach (TextMeshPro t in texts) t.DOFaceColor(Color.green, 1).SetEase(Ease.Linear);
|
||||
if (GUILayout.Button("Face Color To Red")) foreach (TextMeshPro t in texts) t.DOFaceColor(Color.red, 1).SetEase(Ease.Linear);
|
||||
if (GUILayout.Button("Face Fade Out")) foreach (TextMeshPro t in texts) t.DOFaceFade(0, 1).SetEase(Ease.Linear);
|
||||
if (GUILayout.Button("Face Fade In")) foreach (TextMeshPro t in texts) t.DOFaceFade(1, 1).SetEase(Ease.Linear);
|
||||
if (GUILayout.Button("Face Color To Green")) {
|
||||
foreach (TextMeshPro t in texts) t.DOFaceColor(Color.green, 1).SetEase(Ease.Linear);
|
||||
foreach (TextMeshProUGUI t in uguiTexts) t.DOFaceColor(Color.green, 1).SetEase(Ease.Linear);
|
||||
}
|
||||
if (GUILayout.Button("Face Color To Red")) {
|
||||
foreach (TextMeshPro t in texts) t.DOFaceColor(Color.red, 1).SetEase(Ease.Linear);
|
||||
foreach (TextMeshProUGUI t in uguiTexts) t.DOFaceColor(Color.red, 1).SetEase(Ease.Linear);
|
||||
}
|
||||
if (GUILayout.Button("Face Fade Out")) {
|
||||
foreach (TextMeshPro t in texts) t.DOFaceFade(0, 1).SetEase(Ease.Linear);
|
||||
foreach (TextMeshProUGUI t in uguiTexts) t.DOFaceFade(0, 1).SetEase(Ease.Linear);
|
||||
}
|
||||
if (GUILayout.Button("Face Fade In")) {
|
||||
foreach (TextMeshPro t in texts) t.DOFaceFade(1, 1).SetEase(Ease.Linear);
|
||||
foreach (TextMeshProUGUI t in uguiTexts) t.DOFaceFade(1, 1).SetEase(Ease.Linear);
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Glow Color To Green")) foreach (TextMeshPro t in texts) t.DOGlowColor(Color.green, 1).SetEase(Ease.Linear);
|
||||
if (GUILayout.Button("Glow Color To Red")) foreach (TextMeshPro t in texts) t.DOGlowColor(Color.red, 1).SetEase(Ease.Linear);
|
||||
if (GUILayout.Button("Glow Color To Green")) {
|
||||
foreach (TextMeshPro t in texts) t.DOGlowColor(Color.green, 1).SetEase(Ease.Linear);
|
||||
foreach (TextMeshProUGUI t in uguiTexts) t.DOGlowColor(Color.green, 1).SetEase(Ease.Linear);
|
||||
}
|
||||
if (GUILayout.Button("Glow Color To Red")) {
|
||||
foreach (TextMeshPro t in texts) t.DOGlowColor(Color.red, 1).SetEase(Ease.Linear);
|
||||
foreach (TextMeshProUGUI t in uguiTexts) t.DOGlowColor(Color.red, 1).SetEase(Ease.Linear);
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Outline Color To Green")) foreach (TextMeshPro t in texts) t.DOOutlineColor(Color.green, 1).SetEase(Ease.Linear);
|
||||
if (GUILayout.Button("Outline Color To Red")) foreach (TextMeshPro t in texts) t.DOOutlineColor(Color.red, 1).SetEase(Ease.Linear);
|
||||
if (GUILayout.Button("Outline Color To Green")) {
|
||||
foreach (TextMeshPro t in texts) t.DOOutlineColor(Color.green, 1).SetEase(Ease.Linear);
|
||||
foreach (TextMeshProUGUI t in uguiTexts) t.DOOutlineColor(Color.green, 1).SetEase(Ease.Linear);
|
||||
}
|
||||
if (GUILayout.Button("Outline Color To Red")) {
|
||||
foreach (TextMeshPro t in texts) t.DOOutlineColor(Color.red, 1).SetEase(Ease.Linear);
|
||||
foreach (TextMeshProUGUI t in uguiTexts) t.DOOutlineColor(Color.red, 1).SetEase(Ease.Linear);
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Font Resize Down")) foreach (TextMeshPro t in texts) t.DOFontSize(10, 1);
|
||||
if (GUILayout.Button("Font Resize Up")) foreach (TextMeshPro t in texts) t.DOFontSize(32, 1);
|
||||
if (GUILayout.Button("Scale to 1.5")) foreach (TextMeshPro t in texts) t.DOScale(1.5f, 1);
|
||||
if (GUILayout.Button("Trim Max Visible Characters")) foreach (TextMeshPro t in texts) t.DOMaxVisibleCharacters(22, 1);
|
||||
if (GUILayout.Button("Font Resize Down")) {
|
||||
foreach (TextMeshPro t in texts) t.DOFontSize(10, 1);
|
||||
foreach (TextMeshProUGUI t in uguiTexts) t.DOFontSize(10, 1);
|
||||
}
|
||||
if (GUILayout.Button("Font Resize Up")) {
|
||||
foreach (TextMeshPro t in texts) t.DOFontSize(32, 1);
|
||||
foreach (TextMeshProUGUI t in uguiTexts) t.DOFontSize(32, 1);
|
||||
}
|
||||
if (GUILayout.Button("Scale to 1.5")) {
|
||||
foreach (TextMeshPro t in texts) t.DOScale(1.5f, 1);
|
||||
foreach (TextMeshProUGUI t in uguiTexts) t.DOScale(1.5f, 1);
|
||||
}
|
||||
if (GUILayout.Button("Trim Max Visible Characters")) {
|
||||
foreach (TextMeshPro t in texts) t.DOMaxVisibleCharacters(22, 1);
|
||||
foreach (TextMeshProUGUI t in uguiTexts) t.DOMaxVisibleCharacters(22, 1);
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
if (GUILayout.Button("Text Reset")) {
|
||||
DOTween.KillAll();
|
||||
for (int i = 0; i < texts.Length; ++i) texts[i].text = orTexts[i];
|
||||
for (int i = 0; i < uguiTexts.Length; ++i) uguiTexts[i].text = orGuiTexts[i];
|
||||
}
|
||||
if (GUILayout.Button("Text Replace")) {
|
||||
foreach (TextMeshPro t in texts) t.DOText(replaceWText, 5, richTextEnabled).SetEase(Ease.Linear);
|
||||
foreach (TextMeshProUGUI t in uguiTexts) t.DOText(replaceWText, 5, richTextEnabled).SetEase(Ease.Linear);
|
||||
}
|
||||
if (GUILayout.Button("Text Replace Add")) {
|
||||
foreach (TextMeshPro t in texts) t.DOText(" " + replaceWText, 5, richTextEnabled).SetRelative().SetEase(Ease.Linear);
|
||||
foreach (TextMeshProUGUI t in uguiTexts) t.DOText(" " + replaceWText, 5, richTextEnabled).SetRelative().SetEase(Ease.Linear);
|
||||
}
|
||||
if (GUILayout.Button("Text Replace W Scramble")) {
|
||||
foreach (TextMeshPro t in texts) t.DOText(replaceWText, 5, richTextEnabled, ScrambleMode.Lowercase).SetEase(Ease.Linear);
|
||||
foreach (TextMeshProUGUI t in uguiTexts) t.DOText(replaceWText, 5, richTextEnabled, ScrambleMode.Lowercase).SetEase(Ease.Linear);
|
||||
}
|
||||
if (GUILayout.Button("Text Replace Add W Scramble")) {
|
||||
foreach (TextMeshPro t in texts) t.DOText(" " + replaceWText, 5, richTextEnabled, ScrambleMode.Lowercase).SetRelative().SetEase(Ease.Linear);
|
||||
foreach (TextMeshProUGUI t in uguiTexts) t.DOText(" " + replaceWText, 5, richTextEnabled, ScrambleMode.Lowercase).SetRelative().SetEase(Ease.Linear);
|
||||
}
|
||||
if (GUILayout.Button("Text Replace")) foreach (TextMeshPro t in texts) t.DOText(replaceWText, 5, richTextEnabled).SetEase(Ease.Linear);
|
||||
if (GUILayout.Button("Text Replace Add")) foreach (TextMeshPro t in texts) t.DOText(" " + replaceWText, 5, richTextEnabled).SetRelative().SetEase(Ease.Linear);
|
||||
if (GUILayout.Button("Text Replace W Scramble")) foreach (TextMeshPro t in texts) t.DOText(replaceWText, 5, richTextEnabled, ScrambleMode.Lowercase).SetEase(Ease.Linear);
|
||||
if (GUILayout.Button("Text Replace Add W Scramble")) foreach (TextMeshPro t in texts) t.DOText(" " + replaceWText, 5, richTextEnabled, ScrambleMode.Lowercase).SetRelative().SetEase(Ease.Linear);
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
|
||||
Binary file not shown.
@ -4,5 +4,15 @@ using UnityEngine;
|
||||
|
||||
public class Paths : BrainBase
|
||||
{
|
||||
public Transform target;
|
||||
|
||||
void Start()
|
||||
{
|
||||
Vector3[] p = new[] {
|
||||
new Vector3(2,2,2),
|
||||
new Vector3(2,4,2),
|
||||
new Vector3(0,2,2),
|
||||
};
|
||||
target.DOPath(p, 4);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@ -7,15 +7,16 @@ public class Temp : BrainBase
|
||||
{
|
||||
public Transform target;
|
||||
|
||||
public void TweenThis(int direction)
|
||||
IEnumerator Start()
|
||||
{
|
||||
Debug.Log("HERE");
|
||||
if (DOTween.IsTweening("infoTabSwipeAnim")) {
|
||||
Debug.Log("IsTweening");
|
||||
// DOTween.Rewind("infoTabSwipeAnim", false);
|
||||
DOTween.Kill("infoTabSwipeAnim", true);
|
||||
}
|
||||
target.DOMoveX(2, 3).OnComplete(()=> {
|
||||
Debug.Log("call");
|
||||
target.GetComponent<TempMonoBehaviour>().Goco();
|
||||
Debug.Log("after call");
|
||||
});
|
||||
|
||||
target.DOLocalMoveX(direction*800, 0.3f, false).From().SetEase(Ease.OutBack).SetId("infoTabSwipeAnim");
|
||||
yield return new WaitForSeconds(1);
|
||||
|
||||
target.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@ -1,7 +1,32 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using DG.Tweening;
|
||||
|
||||
public class TempMonoBehaviour : MonoBehaviour
|
||||
{
|
||||
public float fval = 0;
|
||||
// IEnumerator Start()
|
||||
// {
|
||||
// yield return new WaitForSeconds(1);
|
||||
|
||||
// Debug.Log("Start");
|
||||
// transform.DOMoveX(2, 3).OnComplete(Goco);
|
||||
|
||||
// yield return new WaitForSeconds(1);
|
||||
|
||||
// Debug.Log("Deactivate");
|
||||
// this.gameObject.SetActive(false);
|
||||
// }
|
||||
|
||||
public void Goco()
|
||||
{
|
||||
Debug.Log("Start Coroutine");
|
||||
StartCoroutine(SomeCoroutine());
|
||||
}
|
||||
|
||||
IEnumerator SomeCoroutine()
|
||||
{
|
||||
Debug.Log("CO start");
|
||||
yield return new WaitForSeconds(1);
|
||||
Debug.Log("CO end");
|
||||
}
|
||||
}
|
||||
@ -22,5 +22,13 @@ namespace DG.Tweening.Core
|
||||
public float defaultEasePeriod = 0;
|
||||
public bool defaultAutoKill = true;
|
||||
public LoopType defaultLoopType = LoopType.Restart;
|
||||
|
||||
// Editor-only
|
||||
public enum SettingsLocation
|
||||
{
|
||||
AssetsDirectory,
|
||||
DOTweenDirectory
|
||||
}
|
||||
public SettingsLocation storeSettingsLocation = SettingsLocation.AssetsDirectory;
|
||||
}
|
||||
}
|
||||
@ -21,7 +21,7 @@ namespace DG.Tweening
|
||||
public class DOTween
|
||||
{
|
||||
/// <summary>DOTween's version</summary>
|
||||
public static readonly string Version = "1.0.450";
|
||||
public static readonly string Version = "1.0.465";
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// Options ////////////////////////////////////
|
||||
|
||||
@ -45,8 +45,7 @@ namespace DG.DOTweenEditor
|
||||
static void ShowWindow() { Open(); }
|
||||
|
||||
const string _Title = "DOTween Utility Panel";
|
||||
const string _SrcFile = "DOTweenSettings.asset";
|
||||
static readonly Vector2 _WinSize = new Vector2(300,350);
|
||||
static readonly Vector2 _WinSize = new Vector2(300,365);
|
||||
public const string Id = "DOTweenVersion";
|
||||
public const string IdPro = "DOTweenProVersion";
|
||||
static readonly float _HalfBtSize = _WinSize.x * 0.5f - 6;
|
||||
@ -59,6 +58,7 @@ namespace DG.DOTweenEditor
|
||||
|
||||
int _selectedTab;
|
||||
string[] _tabLabels = new[] { "Setup", "Preferences" };
|
||||
string[] _settingsLocation = new[] {"Assets > Resources", "DOTween > Resources"};
|
||||
|
||||
// If force is FALSE opens the window only if DOTween's version has changed
|
||||
// (set to FALSE by OnPostprocessAllAssets)
|
||||
@ -182,6 +182,9 @@ namespace DG.DOTweenEditor
|
||||
_src.useSafeMode = EditorGUILayout.Toggle("Safe Mode", _src.useSafeMode);
|
||||
_src.showUnityEditorReport = EditorGUILayout.Toggle("Editor Report", _src.showUnityEditorReport);
|
||||
_src.logBehaviour = (LogBehaviour)EditorGUILayout.EnumPopup("Log Behaviour", _src.logBehaviour);
|
||||
DOTweenSettings.SettingsLocation prevSettingsLocation = _src.storeSettingsLocation;
|
||||
_src.storeSettingsLocation = (DOTweenSettings.SettingsLocation)EditorGUILayout.Popup("Settings Location", (int)_src.storeSettingsLocation, _settingsLocation);
|
||||
if (_src.storeSettingsLocation != prevSettingsLocation) Connect(true);
|
||||
GUILayout.Space(8);
|
||||
GUILayout.Label("DEFAULTS ▼");
|
||||
_src.defaultRecyclable = EditorGUILayout.Toggle("Recycle Tweens", _src.defaultRecyclable);
|
||||
@ -200,25 +203,74 @@ namespace DG.DOTweenEditor
|
||||
// ===================================================================================
|
||||
// METHODS ---------------------------------------------------------------------------
|
||||
|
||||
void Connect()
|
||||
void Connect(bool forceReconnect = false)
|
||||
{
|
||||
if (_src != null && !forceReconnect) return;
|
||||
|
||||
string externalSrcDir = EditorUtils.assetsPath + EditorUtils.pathSlash + "Resources";
|
||||
string externalSrcFilePath = externalSrcDir + EditorUtils.pathSlash + DOTweenSettings.AssetName + ".asset";
|
||||
string externalAdbSrcFilePath = EditorUtils.FullPathToADBPath(externalSrcFilePath);
|
||||
string internalSrcDir = EditorUtils.dotweenDir + "Resources";
|
||||
string internalSrcFilePath = internalSrcDir + EditorUtils.pathSlash + DOTweenSettings.AssetName + ".asset";
|
||||
string internalAdbSrcFilePath = EditorUtils.FullPathToADBPath(internalSrcFilePath);
|
||||
|
||||
if (_src == null) {
|
||||
string srcDir = EditorUtils.assetsPath + EditorUtils.pathSlash + "Resources";
|
||||
if (!Directory.Exists(srcDir)) AssetDatabase.CreateFolder("Assets", "Resources");
|
||||
string adbSrcFilePath = EditorUtils.FullPathToADBPath(srcDir + EditorUtils.pathSlash + DOTweenSettings.AssetName + ".asset");
|
||||
|
||||
// Legacy: check if there are settings saved in old mode (inside DOTween/Resources folder) and eventually move them
|
||||
string legacySrcDir = EditorUtils.dotweenDir + "Resources";
|
||||
string legacySrcFilePath = legacySrcDir + EditorUtils.pathSlash + DOTweenSettings.AssetName + ".asset";
|
||||
if (File.Exists(legacySrcFilePath)) {
|
||||
// Move legacy src file to correct folder
|
||||
AssetDatabase.MoveAsset(EditorUtils.FullPathToADBPath(legacySrcFilePath), adbSrcFilePath);
|
||||
// Delete legacy Resources folder
|
||||
AssetDatabase.DeleteAsset(EditorUtils.FullPathToADBPath(legacySrcDir));
|
||||
// Load eventual existing settings
|
||||
_src = EditorUtils.ConnectToSourceAsset<DOTweenSettings>(externalAdbSrcFilePath, false);
|
||||
if (_src == null) _src = EditorUtils.ConnectToSourceAsset<DOTweenSettings>(internalAdbSrcFilePath, false);
|
||||
}
|
||||
if (_src == null) {
|
||||
// Settings don't exist. Create it in external folder
|
||||
if (!Directory.Exists(externalSrcDir)) AssetDatabase.CreateFolder("Assets", "Resources");
|
||||
_src = EditorUtils.ConnectToSourceAsset<DOTweenSettings>(externalAdbSrcFilePath, true);
|
||||
}
|
||||
|
||||
_src = EditorUtils.ConnectToSourceAsset<DOTweenSettings>(adbSrcFilePath, true);
|
||||
}
|
||||
// Move eventual settings from previous location and setup everything correctly
|
||||
DOTweenSettings.SettingsLocation settingsLoc = _src.storeSettingsLocation;
|
||||
switch (settingsLoc) {
|
||||
case DOTweenSettings.SettingsLocation.AssetsDirectory:
|
||||
if (!Directory.Exists(externalSrcDir)) AssetDatabase.CreateFolder("Assets", "Resources");
|
||||
if (File.Exists(internalSrcFilePath)) {
|
||||
// Move internal src file to correct folder
|
||||
AssetDatabase.MoveAsset(internalAdbSrcFilePath, externalAdbSrcFilePath);
|
||||
// Delete internal Resources folder
|
||||
AssetDatabase.DeleteAsset(EditorUtils.FullPathToADBPath(internalSrcDir));
|
||||
}
|
||||
_src = EditorUtils.ConnectToSourceAsset<DOTweenSettings>(externalAdbSrcFilePath, true);
|
||||
break;
|
||||
case DOTweenSettings.SettingsLocation.DOTweenDirectory:
|
||||
if (!Directory.Exists(internalSrcDir)) AssetDatabase.CreateFolder(EditorUtils.FullPathToADBPath(EditorUtils.dotweenDir.Substring(0, EditorUtils.dotweenDir.LastIndexOf(EditorUtils.pathSlash))), "Resources");
|
||||
if (File.Exists(externalSrcFilePath)) {
|
||||
// Move external src file to correct folder
|
||||
AssetDatabase.MoveAsset(externalAdbSrcFilePath, internalAdbSrcFilePath);
|
||||
// Delete external settings
|
||||
AssetDatabase.DeleteAsset(externalAdbSrcFilePath);
|
||||
// Check if external Resources folder is empty and in case delete it
|
||||
if (Directory.GetDirectories(externalSrcDir).Length == 0 && Directory.GetFiles(externalSrcDir).Length == 0) {
|
||||
AssetDatabase.DeleteAsset(EditorUtils.FullPathToADBPath(externalSrcDir));
|
||||
}
|
||||
}
|
||||
_src = EditorUtils.ConnectToSourceAsset<DOTweenSettings>(internalAdbSrcFilePath, true);
|
||||
break;
|
||||
}
|
||||
|
||||
// if (_src == null) {
|
||||
// string srcDir = EditorUtils.assetsPath + EditorUtils.pathSlash + "Resources";
|
||||
// if (!Directory.Exists(srcDir)) AssetDatabase.CreateFolder("Assets", "Resources");
|
||||
// string adbSrcFilePath = EditorUtils.FullPathToADBPath(srcDir + EditorUtils.pathSlash + DOTweenSettings.AssetName + ".asset");
|
||||
//
|
||||
// // Legacy: check if there are settings saved in previous mode and eventually move them
|
||||
// string altSrcDir = EditorUtils.dotweenDir + "Resources";
|
||||
// string legacySrcFilePath = altSrcDir + EditorUtils.pathSlash + DOTweenSettings.AssetName + ".asset";
|
||||
// if (File.Exists(legacySrcFilePath)) {
|
||||
// // Move legacy src file to correct folder
|
||||
// AssetDatabase.MoveAsset(EditorUtils.FullPathToADBPath(legacySrcFilePath), adbSrcFilePath);
|
||||
// // Delete legacy Resources folder
|
||||
// AssetDatabase.DeleteAsset(EditorUtils.FullPathToADBPath(altSrcDir));
|
||||
// }
|
||||
//
|
||||
// _src = EditorUtils.ConnectToSourceAsset<DOTweenSettings>(adbSrcFilePath, true);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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