Beispiel #1
0
        static bool _setupDialogRequested; // Used to prevent OnPostProcessAllAssets firing twice (because of a Unity bug/feature)

        static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
        {
            if (_setupDialogRequested)
            {
                return;
            }

            string[] dotweenEntries  = System.Array.FindAll(importedAssets, name => name.Contains("DOTween") && !name.EndsWith(".meta") && !name.EndsWith(".jpg") && !name.EndsWith(".png"));
            bool     dotweenImported = dotweenEntries.Length > 0;

            if (dotweenImported)
            {
                // Reapply modules
                EditorUtils.DelayedCall(0.1f, () => {
//                    Debug.Log("Apply Modules Settings after reimport");
                    DOTweenUtilityWindowModules.ApplyModulesSettings();
                });
            }

            string[] dotweenProEntries  = System.Array.FindAll(importedAssets, name => name.Contains("DOTweenPro") && !name.EndsWith(".meta") && !name.EndsWith(".jpg") && !name.EndsWith(".png"));
            bool     dotweenProImported = dotweenProEntries.Length > 0;

            if (dotweenProImported)
            {
                // Refresh ASMDEF
                EditorUtils.DelayedCall(0.1f, () => {
//                    Debug.Log("Refresh ASMDEF after DOTween Pro reimport");
                    ASMDEFManager.RefreshExistingASMDEFFiles();
                });
            }
        }
        static bool _setupDialogRequested; // Used to prevent OnPostProcessAllAssets firing twice (because of a Unity bug/feature)

        static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
        {
            if (_setupDialogRequested)
            {
                return;
            }

            string[] dotweenEntries  = System.Array.FindAll(importedAssets, name => name.Contains("DOTween") && !name.EndsWith(".meta") && !name.EndsWith(".jpg") && !name.EndsWith(".png"));
            bool     dotweenImported = dotweenEntries.Length > 0;

            if (dotweenImported)
            {
                // Delete old DOTween files
                EditorUtils.DeleteLegacyNoModulesDOTweenFiles();
                // Delete old DemiLib configuration
                EditorUtils.DeleteOldDemiLibCore();
                // Remove old legacy defines
                DOTweenDefines.RemoveAllLegacyDefines();
                // Reapply modules
                DOTweenUtilityWindowModules.ApplyModulesSettings();
                //
                bool differentCoreVersion = EditorPrefs.GetString(Application.dataPath + DOTweenUtilityWindow.Id) != Application.dataPath + DOTween.Version;
                bool differentProVersion  = EditorUtils.hasPro && EditorPrefs.GetString(Application.dataPath + DOTweenUtilityWindow.IdPro) != Application.dataPath + EditorUtils.proVersion;
                bool setupRequired        = differentCoreVersion || differentProVersion;
                if (setupRequired)
                {
                    _setupDialogRequested = true;
                    EditorPrefs.SetString(Application.dataPath + DOTweenUtilityWindow.Id, Application.dataPath + DOTween.Version);
                    if (EditorUtils.hasPro)
                    {
                        EditorPrefs.SetString(Application.dataPath + DOTweenUtilityWindow.IdPro, Application.dataPath + EditorUtils.proVersion);
                    }
//                    EditorUtility.DisplayDialog("DOTween",
//                        differentCoreVersion
//                        ? "New version of DOTween imported." +
//                          "\n\nSelect \"Setup DOTween...\" in DOTween's Utility Panel to add/remove Modules."
//                        : "New version of DOTween Pro imported." +
//                          " \n\nSelect \"Setup DOTween...\" in DOTween's Utility Panel to add/remove external Modules (TextMesh Pro/2DToolkit/etc).",
//                        "Ok"
//                    );
                    DOTweenUtilityWindow.Open();
                    // Opening window after a postProcess doesn't work on Unity 3 so check that
//                    string[] vs = Application.unityVersion.Split("."[0]);
//                    int majorVersion = System.Convert.ToInt32(vs[0]);
//                    if (majorVersion >= 4) EditorUtils.DelayedCall(0.5f, DOTweenUtilityWindow.Open);
//                    EditorUtils.DelayedCall(8, ()=> _setupDialogRequested = false);
                }
            }
        }
        static bool _setupDialogRequested; // Used to prevent OnPostProcessAllAssets firing twice (because of a Unity bug/feature)

        static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
        {
            if (_setupDialogRequested)
            {
                return;
            }

            string[] dotweenEntries  = System.Array.FindAll(importedAssets, name => name.Contains("DOTween") && !name.EndsWith(".meta") && !name.EndsWith(".jpg") && !name.EndsWith(".png"));
            bool     dotweenImported = dotweenEntries.Length > 0;

            if (!dotweenImported)
            {
                return;
            }

            // Reapply modules
            EditorUtils.DelayedCall(0.1f, () => {
//                Debug.Log("Apply Modules Settings after reimport");
                DOTweenUtilityWindowModules.ApplyModulesSettings();
            });
//            DOTweenUtilityWindowModules.ApplyModulesSettings();



//            // Delete old DOTween files
//            EditorUtils.DeleteLegacyNoModulesDOTweenFiles();
//            // Delete old DemiLib configuration
//            EditorUtils.DeleteOldDemiLibCore();
//            // Remove old legacy defines
//            DOTweenDefines.RemoveAllLegacyDefines();
//            // Reapply modules
//            DOTweenUtilityWindowModules.ApplyModulesSettings();
//            //
//            bool differentCoreVersion = EditorPrefs.GetString(Application.dataPath + DOTweenUtilityWindow.Id) != Application.dataPath + DOTween.Version;
//            bool differentProVersion = EditorUtils.hasPro && EditorPrefs.GetString(Application.dataPath + DOTweenUtilityWindow.IdPro) != Application.dataPath + EditorUtils.proVersion;
//            bool setupRequired = differentCoreVersion || differentProVersion;
//            if (!setupRequired) return;
//
//            _setupDialogRequested = true;
//            EditorPrefs.SetString(Application.dataPath + DOTweenUtilityWindow.Id, Application.dataPath + DOTween.Version);
//            if (EditorUtils.hasPro) {
//                EditorPrefs.SetString(Application.dataPath + DOTweenUtilityWindow.IdPro, Application.dataPath + EditorUtils.proVersion);
//            }
//            DOTweenUtilityWindow.Open();
        }