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; }); } } }
void OnEnable() { _innerTitle = "DOTween v" + DOTween.Version + (DOTween.isDebugBuild ? " [Debug build]" : " [Release build]"); if (EditorUtils.hasPro) { _innerTitle += "\nDOTweenPro v" + EditorUtils.proVersion; } else { _innerTitle += "\nDOTweenPro not installed"; } if (_headerImg == null) { _headerImg = Resources.LoadAssetAtPath("Assets/" + EditorUtils.editorADBDir + "Imgs/Header.jpg", typeof(Texture2D)) as Texture2D; EditorUtils.SetEditorTexture(_headerImg, FilterMode.Bilinear, 512); _headerSize.x = _WinSize.x; _headerSize.y = (int)((_WinSize.x * _headerImg.height) / _headerImg.width); _footerImg = Resources.LoadAssetAtPath("Assets/" + EditorUtils.editorADBDir + (EditorGUIUtility.isProSkin ? "Imgs/Footer.png" : "Imgs/Footer_dark.png"), typeof(Texture2D)) as Texture2D; EditorUtils.SetEditorTexture(_footerImg, FilterMode.Bilinear, 256); _footerSize.x = _WinSize.x; _footerSize.y = (int)((_WinSize.x * _footerImg.height) / _footerImg.width); } _setupRequired = EditorUtils.DOTweenSetupRequired(); }
private void OnEnable() { this._innerTitle = "DOTween v" + DOTween.Version + (DOTween.isDebugBuild ? " [Debug build]" : " [Release build]"); if (EditorUtils.hasPro) { this._innerTitle = this._innerTitle + "\nDOTweenPro v" + EditorUtils.proVersion; } else { this._innerTitle = this._innerTitle + "\nDOTweenPro not installed"; } if (this._headerImg == null) { this._headerImg = AssetDatabase.LoadAssetAtPath("Assets" + EditorUtils.editorADBDir + "Imgs/Header.jpg", typeof(Texture2D)) as Texture2D; //Debug.LogWarning ("**************_headerImg:" + _headerImg); EditorUtils.SetEditorTexture(this._headerImg, FilterMode.Bilinear, 0x200); this._headerSize.x = _WinSize.x; this._headerSize.y = (int)((_WinSize.x * this._headerImg.height) / ((float)this._headerImg.width)); this._footerImg = AssetDatabase.LoadAssetAtPath("Assets" + EditorUtils.editorADBDir + (EditorGUIUtility.isProSkin? "Imgs/Footer.png" : "Imgs/Footer_dark.png"), typeof(Texture2D)) as Texture2D; //Debug.LogWarning ("**************_headerImg:" + _headerImg); EditorUtils.SetEditorTexture(this._footerImg, FilterMode.Bilinear, 0x100); this._footerSize.x = _WinSize.x; this._footerSize.y = (int)((_WinSize.x * this._footerImg.height) / ((float)this._footerImg.width)); } this._setupRequired = EditorUtils.DOTweenSetupRequired(); }
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); } } }
private void DrawSetupGUI() { Rect position = new Rect(0f, 30f, this._headerSize.x, this._headerSize.y); GUI.DrawTexture(position, this._headerImg, ScaleMode.StretchToFill, false); GUILayout.Space((position.y + this._headerSize.y) + 2f); GUILayout.Label(this._innerTitle, DOTween.isDebugBuild ? EditorGUIUtils.redLabelStyle : EditorGUIUtils.boldLabelStyle, new GUILayoutOption[0]); if (this._setupRequired) { GUI.backgroundColor = Color.red; GUILayout.BeginVertical(GUI.skin.box, new GUILayoutOption[0]); GUILayout.Label("DOTWEEN SETUP REQUIRED", EditorGUIUtils.setupLabelStyle, new GUILayoutOption[0]); GUILayout.EndVertical(); GUI.backgroundColor = Color.white; } else { GUILayout.Space(8f); } if (GUILayout.Button("Setup DOTween...", EditorGUIUtils.btStyle, new GUILayoutOption[0])) { DOTweenSetupMenuItem.Setup(false); this._setupRequired = EditorUtils.DOTweenSetupRequired(); } GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(_HalfBtSize) }; if (GUILayout.Button("Documentation", EditorGUIUtils.btStyle, options)) { Application.OpenURL("http://dotween.demigiant.com/documentation.php"); } GUILayoutOption[] optionArray2 = new GUILayoutOption[] { GUILayout.Width(_HalfBtSize) }; if (GUILayout.Button("Support", EditorGUIUtils.btStyle, optionArray2)) { Application.OpenURL("http://dotween.demigiant.com/support.php"); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(new GUILayoutOption[0]); GUILayoutOption[] optionArray3 = new GUILayoutOption[] { GUILayout.Width(_HalfBtSize) }; if (GUILayout.Button("Changelog", EditorGUIUtils.btStyle, optionArray3)) { Application.OpenURL("http://dotween.demigiant.com/download.php"); } GUILayoutOption[] optionArray4 = new GUILayoutOption[] { GUILayout.Width(_HalfBtSize) }; if (GUILayout.Button("Check Updates", EditorGUIUtils.btStyle, optionArray4)) { Application.OpenURL("http://dotween.demigiant.com/download.php?v=" + DOTween.Version); } GUILayout.EndHorizontal(); GUILayout.Space(14f); if (GUILayout.Button(this._footerImg, EditorGUIUtils.btImgStyle, new GUILayoutOption[0])) { Application.OpenURL("http://www.demigiant.com/"); } }
void OnGUI() { SetGUIStyles(); Rect headerRect = new Rect(0, 0, _headerSize.x, _headerSize.y); GUI.DrawTexture(headerRect, _headerImg, ScaleMode.StretchToFill, false); GUILayout.Space(_headerSize.y + 2); GUILayout.Label(_innerTitle, DOTween.isDebugBuild ? _redLabelStyle : _boldLabelStyle); if (_setupRequired) { GUI.backgroundColor = Color.red; GUILayout.BeginVertical(GUI.skin.box); GUILayout.Label("DOTWEEN SETUP REQUIRED", _setupLabelStyle); GUILayout.EndVertical(); GUI.backgroundColor = Color.white; } else { GUILayout.Space(8); } if (GUILayout.Button("Setup DOTween...", _btStyle)) { DOTweenSetupMenuItem.Setup(); _setupRequired = EditorUtils.DOTweenSetupRequired(); } GUILayout.BeginHorizontal(); if (GUILayout.Button("Documentation", _btStyle, GUILayout.Width(_HalfBtSize))) { Application.OpenURL("http://dotween.demigiant.com/documentation.php"); } if (GUILayout.Button("Support", _btStyle, GUILayout.Width(_HalfBtSize))) { Application.OpenURL("http://dotween.demigiant.com/support.php"); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Changelog", _btStyle, GUILayout.Width(_HalfBtSize))) { Application.OpenURL("http://dotween.demigiant.com/download.php"); } if (GUILayout.Button("Check Updates", _btStyle, GUILayout.Width(_HalfBtSize))) { Application.OpenURL("http://dotween.demigiant.com/download.php?v=" + DOTween.Version); } GUILayout.EndHorizontal(); GUILayout.Space(14); if (GUILayout.Button(_footerImg, _btImgStyle)) { Application.OpenURL("http://www.demigiant.com/"); } }
//在一些资源被导入后调用 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); }
private void OnEnable() { this._innerTitle = "DOTween v" + DOTween.Version + (DOTween.isDebugBuild ? " [Debug build]" : " [Release build]"); if (EditorUtils.hasPro) { this._innerTitle = this._innerTitle + "\nDOTweenPro v" + EditorUtils.proVersion; } else { this._innerTitle += "\nDOTweenPro not installed"; } if ((UnityEngine.Object) this._headerImg == (UnityEngine.Object)null) { this._headerImg = (AssetDatabase.LoadAssetAtPath("Assets/" + EditorUtils.editorADBDir + "Imgs/Header.jpg", typeof(Texture2D)) as Texture2D); EditorUtils.SetEditorTexture(this._headerImg, FilterMode.Bilinear, 512); this._headerSize.x = DOTweenUtilityWindow._WinSize.x; this._headerSize.y = (float)(int)(DOTweenUtilityWindow._WinSize.x * (float)this._headerImg.height / (float)this._headerImg.width); this._footerImg = (AssetDatabase.LoadAssetAtPath("Assets/" + EditorUtils.editorADBDir + (EditorGUIUtility.isProSkin ? "Imgs/Footer.png" : "Imgs/Footer_dark.png"), typeof(Texture2D)) as Texture2D); EditorUtils.SetEditorTexture(this._footerImg, FilterMode.Bilinear, 256); this._footerSize.x = DOTweenUtilityWindow._WinSize.x; this._footerSize.y = (float)(int)(DOTweenUtilityWindow._WinSize.x * (float)this._footerImg.height / (float)this._footerImg.width); } this._setupRequired = EditorUtils.DOTweenSetupRequired(); }
public static void Setup(bool partiallySilent = false) { if (EditorUtils.DOTweenSetupRequired()) { string str3 = "Based on your Unity version (" + Application.unityVersion + ") and eventual plugins, DOTween will now activate additional tween elements, if available."; if (!EditorUtility.DisplayDialog("DOTween Setup", str3, "Ok", "Cancel")) { return; } } else if (!partiallySilent) { string str4 = "This project has already been setup for your version of DOTween.\nReimport DOTween if you added new compatible external assets or upgraded your Unity version."; if (!EditorUtility.DisplayDialog("DOTween Setup", str4, "Force Setup", "Cancel")) { return; } } else { return; } string dotweenDir = EditorUtils.dotweenDir; string dotweenProDir = EditorUtils.dotweenProDir; EditorUtility.DisplayProgressBar("DOTween Setup", "Please wait...", 0.25f); int totImported = 0; char[] separator = new char[] { "."[0] }; string[] textArray1 = Application.unityVersion.Split(separator); int num2 = Convert.ToInt32(textArray1[0]); int num3 = Convert.ToInt32(textArray1[1]); if (num2 < 4) { SetupComplete(dotweenDir, dotweenProDir, totImported); } else { if (num2 == 4) { if (num3 < 3) { SetupComplete(dotweenDir, dotweenProDir, totImported); return; } totImported += ImportAddons("43", dotweenDir); if (num3 >= 6) { totImported += ImportAddons("46", dotweenDir); } } else { totImported += ImportAddons("43", dotweenDir); totImported += ImportAddons("46", dotweenDir); totImported += ImportAddons("50", dotweenDir); } if (EditorUtils.hasPro) { if (Has2DToolkit()) { totImported += ImportAddons("Tk2d", dotweenProDir); ProEditor_AddGlobalDefine("DOTWEEN_TK2D"); } else { ProEditor_RemoveGlobalDefine("DOTWEEN_TK2D"); } if (HasTextMeshPro()) { totImported += ImportAddons("TextMeshPro", dotweenProDir); ProEditor_AddGlobalDefine("DOTWEEN_TMP"); } else { ProEditor_RemoveGlobalDefine("DOTWEEN_TMP"); } } SetupComplete(dotweenDir, dotweenProDir, totImported); } }
/// <summary> /// Setups DOTween /// </summary> /// <param name="partiallySilent">If TRUE, no warning window appears in case there is no need for setup</param> public static void Setup(bool partiallySilent = false) { bool setupRequired = EditorUtils.DOTweenSetupRequired(); if (setupRequired) { string msg = "Based on your Unity version (" + Application.unityVersion + ") and eventual plugins, DOTween will now activate additional tween elements, if available."; if (!EditorUtility.DisplayDialog(_Title, msg, "Ok", "Cancel")) { return; } } else { if (!partiallySilent) { string msg = "This project has already been setup for your version of DOTween.\nReimport DOTween if you added new compatible external assets or upgraded your Unity version."; if (!EditorUtility.DisplayDialog(_Title, msg, "Force Setup", "Cancel")) { return; } } else { return; } } string addonsDir = EditorUtils.dotweenDir; string proAddonsDir = EditorUtils.dotweenProDir; EditorUtility.DisplayProgressBar(_Title, "Please wait...", 0.25f); int totImported = 0; // Unity version-based files string[] vs = Application.unityVersion.Split("."[0]); int majorVersion = Convert.ToInt32(vs[0]); int minorVersion = Convert.ToInt32(vs[1]); if (majorVersion < 4) { SetupComplete(addonsDir, proAddonsDir, totImported); return; } if (majorVersion == 4) { if (minorVersion < 3) { SetupComplete(addonsDir, proAddonsDir, totImported); return; } totImported += ImportAddons("43", addonsDir); if (minorVersion >= 6) { totImported += ImportAddons("46", addonsDir); } } else { // 5.x totImported += ImportAddons("43", addonsDir); totImported += ImportAddons("46", addonsDir); totImported += ImportAddons("50", addonsDir); } // Additional plugin files // Pro plugins if (EditorUtils.hasPro) { // PRO > 2DToolkit shortcuts if (Has2DToolkit()) { totImported += ImportAddons("Tk2d", proAddonsDir); ProEditor_AddGlobalDefine("DOTWEEN_TK2D"); } else { ProEditor_RemoveGlobalDefine("DOTWEEN_TK2D"); } // PRO > TextMeshPro shortcuts if (HasTextMeshPro()) { totImported += ImportAddons("TextMeshPro", proAddonsDir); ProEditor_AddGlobalDefine("DOTWEEN_TMP"); } else { ProEditor_RemoveGlobalDefine("DOTWEEN_TMP"); } } SetupComplete(addonsDir, proAddonsDir, totImported); }
/// <summary> /// Setups DOTween /// </summary> /// <param name="partiallySilent">If TRUE, no warning window appears in case there is no need for setup</param> public static void Setup(bool partiallySilent = false) { bool setupRequired = EditorUtils.DOTweenSetupRequired(); if (setupRequired) { string msg = "Based on your Unity version (" + Application.unityVersion + ") and eventual plugins, DOTween will now import additional tween elements, if available."; if (!EditorUtility.DisplayDialog(_Title, msg, "Ok", "Cancel")) { return; } } else { if (!partiallySilent) { string msg = "This project has already been setup for your version of DOTween.\nUpdate to a new DOTween version before running the setup again."; EditorUtility.DisplayDialog(_Title, msg, "Ok"); } return; } string addonsDir = EditorUtils.dotweenDir; string proAddonsDir = EditorUtils.dotweenProDir; string projectPath = Application.dataPath + EditorUtils.pathSlash; EditorUtility.DisplayProgressBar(_Title, "Importing additional DOTween elements based on your Unity version and eventual plugins...", 0.25f); int totImported = 0; // Unity version-based files string[] vs = Application.unityVersion.Split("."[0]); int majorVersion = Convert.ToInt32(vs[0]); int minorVersion = Convert.ToInt32(vs[1]); if (majorVersion < 4) { SetupComplete(addonsDir, proAddonsDir, totImported); return; } if (majorVersion == 4) { if (minorVersion < 3) { SetupComplete(addonsDir, proAddonsDir, totImported); return; } totImported += ImportAddons("43", addonsDir); if (minorVersion >= 6) { totImported += ImportAddons("46", addonsDir); } } else { // 5.x totImported += ImportAddons("43", addonsDir); totImported += ImportAddons("46", addonsDir); totImported += ImportAddons("50", addonsDir); } // Additional plugin files // Pro plugins if (EditorUtils.hasPro) { if (Directory.Exists(projectPath + "TK2DROOT")) { // PRO > 2DToolkit shortcuts totImported += ImportAddons("Tk2d", proAddonsDir); } } SetupComplete(addonsDir, proAddonsDir, totImported); }
public static void Setup(bool partiallySilent = false) { if (EditorUtils.DOTweenSetupRequired()) { string message = "Based on your Unity version (" + Application.unityVersion + ") and eventual plugins, DOTween will now activate additional tween elements, if available."; if (!EditorUtility.DisplayDialog("DOTween Setup", message, "Ok", "Cancel")) { return; } } else { if (partiallySilent) { return; } string message2 = "This project has already been setup for your version of DOTween.\nReimport DOTween if you added new compatible external assets or upgraded your Unity version."; if (!EditorUtility.DisplayDialog("DOTween Setup", message2, "Force Setup", "Cancel")) { return; } } string dotweenDir = EditorUtils.dotweenDir; string dotweenProDir = EditorUtils.dotweenProDir; EditorUtility.DisplayProgressBar("DOTween Setup", "Please wait...", 0.25f); int num = 0; string[] array = Application.unityVersion.Split("."[0]); int num2 = Convert.ToInt32(array[0]); int num3 = Convert.ToInt32(array[1]); if (num2 < 4) { DOTweenSetupMenuItem.SetupComplete(dotweenDir, dotweenProDir, num); } else { if (num2 == 4) { if (num3 < 3) { DOTweenSetupMenuItem.SetupComplete(dotweenDir, dotweenProDir, num); return; } num += DOTweenSetupMenuItem.ImportAddons("43", dotweenDir); if (num3 >= 6) { num += DOTweenSetupMenuItem.ImportAddons("46", dotweenDir); } } else { num += DOTweenSetupMenuItem.ImportAddons("43", dotweenDir); num += DOTweenSetupMenuItem.ImportAddons("46", dotweenDir); num += DOTweenSetupMenuItem.ImportAddons("50", dotweenDir); } if (EditorUtils.hasPro) { if (DOTweenSetupMenuItem.Has2DToolkit()) { num += DOTweenSetupMenuItem.ImportAddons("Tk2d", dotweenProDir); DOTweenSetupMenuItem.ProEditor_AddGlobalDefine("DOTWEEN_TK2D"); } else { DOTweenSetupMenuItem.ProEditor_RemoveGlobalDefine("DOTWEEN_TK2D"); } if (DOTweenSetupMenuItem.HasTextMeshPro()) { num += DOTweenSetupMenuItem.ImportAddons("TextMeshPro", dotweenProDir); DOTweenSetupMenuItem.ProEditor_AddGlobalDefine("DOTWEEN_TMP"); } else { DOTweenSetupMenuItem.ProEditor_RemoveGlobalDefine("DOTWEEN_TMP"); } } DOTweenSetupMenuItem.SetupComplete(dotweenDir, dotweenProDir, num); } }