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) { 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) { // 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) { 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(); }
//在一些资源被导入后调用 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); }