예제 #1
0
        static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
        {
            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)
            {
                bool openSetupDialog = EditorUtils.DOTweenSetupRequired() &&
                                       (EditorPrefs.GetString(Application.dataPath + DOTweenUtilityWindow.Id) != Application.dataPath + DOTween.Version ||
                                        EditorPrefs.GetString(Application.dataPath + DOTweenUtilityWindow.IdPro) != Application.dataPath + EditorUtils.proVersion);
                if (openSetupDialog)
                {
                    EditorPrefs.SetString(Application.dataPath + DOTweenUtilityWindow.Id, Application.dataPath + DOTween.Version);
                    EditorPrefs.SetString(Application.dataPath + DOTweenUtilityWindow.IdPro, Application.dataPath + EditorUtils.proVersion);
                    EditorUtility.DisplayDialog("DOTween", "DOTween needs to be setup.\n\nSelect \"Tools > DOTween Utility Panel\" and press \"Setup DOTween...\" in the panel that opens.", "Ok");
                    // 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)
                    {
                        DOTweenUtilityWindow.Open();
                    }
                }
            }
        }
예제 #2
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)
            {
                // 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);
                }
            }
        }
예제 #3
0
 private static void ShowWindow()
 {
     DOTweenUtilityWindow.Open();
 }