Exemple #1
0
 private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
 {
     if (!UtilityWindowProcessor._setupDialogRequested && Array.FindAll(importedAssets, delegate(string name)
     {
         if (name.Contains("DOTween") && !name.EndsWith(".meta") && !name.EndsWith(".jpg"))
         {
             return(!name.EndsWith(".png"));
         }
         return(false);
     }).Length != 0)
     {
         EditorUtils.DeleteOldDemiLibCore();
         if (EditorUtils.DOTweenSetupRequired() && (EditorPrefs.GetString(Application.dataPath + "DOTweenVersion") != Application.dataPath + DOTween.Version || EditorPrefs.GetString(Application.dataPath + "DOTweenProVersion") != Application.dataPath + EditorUtils.proVersion))
         {
             UtilityWindowProcessor._setupDialogRequested = true;
             EditorPrefs.SetString(Application.dataPath + "DOTweenVersion", Application.dataPath + DOTween.Version);
             EditorPrefs.SetString(Application.dataPath + "DOTweenProVersion", 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");
             if (Convert.ToInt32(Application.unityVersion.Split("."[0])[0]) >= 4)
             {
                 EditorUtils.DelayedCall(0.5f, DOTweenUtilityWindow.Open);
             }
             EditorUtils.DelayedCall(8f, delegate
             {
                 UtilityWindowProcessor._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)
            {
                // Delete old DemiLib configuration
                EditorUtils.DeleteOldDemiLibCore();
                //
                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)
                {
                    _setupDialogRequested = true;
                    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)
                    {
                        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)
            {
                // 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);
                }
            }
        }
Exemple #4
0
        //在一些资源被导入后调用
        private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
        {
            if (!_setupDialogRequested)
            {
                EditorUtils.DeleteOldDemiLibCore();
                if (EditorUtils.DOTweenSetupRequired() && ((EditorPrefs.GetString(Application.dataPath + "DOTweenVersion") != (Application.dataPath + DOTween.Version)) || (EditorPrefs.GetString(Application.dataPath + "DOTweenProVersion") != (Application.dataPath + EditorUtils.proVersion))))
                {
                    _setupDialogRequested = true;
                    EditorPrefs.SetString(Application.dataPath + "DOTweenVersion", Application.dataPath + DOTween.Version);
                    EditorPrefs.SetString(Application.dataPath + "DOTweenProVersion", 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");
                    char[] separator = new char[] { "."[0] };
                    if (Convert.ToInt32(Application.unityVersion.Split(separator)[0]) >= 4)
                    {
                        EditorUtils.DelayedCall(0.5f, new Action(DOTweenUtilityWindow.SetupWindow));
                    }
                }
            }

            //LanguageProcessor(importedAssets);
        }