private static void OpenWindow(string type, string value) { UnityAssemblyVerifier.missing.Add(new KeyValuePair <string, string>(type, value)); UnityAssemblyVerifier.cachedMissing = null; EditorApplication.delayCall += () => { if (NGEditorPrefs.GetBool(UnityAssemblyVerifier.SkipWarningPrefKey) == false) { EditorWindow.GetWindow <UnityAssemblyVerifier>(true, Constants.PackageTitle).CenterOnMainWin(); } }; }
public static void CheckLatestVersion(string toolName) { if (NGEditorPrefs.GetBool(NGChangeLogWindow.DontNotifyNewUpdateKeyPref) == true) { return; } try { // Prevent repeating initialization. foreach (KeyValuePair <string, int> item in NGChangeLogWindow.pendingTools) { if (item.Key == toolName) { return; } } List <ChangeLog> changeLog; if (NGChangeLogWindow.changeLogs.TryGetValue(toolName, out changeLog) == true) { changeLog.Sort((a, b) => a.version.CompareTo(b.version)); string local = NGChangeLogWindow.GetToolPath(toolName); if (File.Exists(local) == true) { string version = File.ReadAllText(local); for (int i = 0; i < changeLog.Count; i++) { if (version.CompareTo(changeLog[i].version) < 0) { NGChangeLogWindow.pendingTools.Enqueue(new KeyValuePair <string, int>(toolName, i)); NGChangeLogWindow.Open(); break; } } } else { File.WriteAllText(local, changeLog[changeLog.Count - 1].version); } } } catch (Exception ex) { InternalNGDebug.LogException(ex); } }
public override object Fetch(object instance, Type type, string path) { return(NGEditorPrefs.GetBool(path, (Boolean)instance)); }
static HQ() { HQ.rootPath = Utility.GetPackagePath(); NGDiagnostic.Log(Preferences.Title, "RootPath", HQ.RootPath); if (HQ.RootPath == string.Empty) { InternalNGDebug.LogWarning(Constants.RootFolderName + " folder was not found."); return; } HQ.SettingsChanged += HQ.CheckSettingsVersion; string[] files = Directory.GetFiles(HQ.RootPath, HQ.NestedNGMenuItems, SearchOption.AllDirectories); if (files.Length == 1) { HQ.rootedMenuFilePath = files[0]; } NGLicensesManager.LicensesLoaded += () => { NGDiagnostic.Log(Preferences.Title, "AllowSendStats", NGEditorPrefs.GetBool(HQ.AllowSendStatsKeyPref, true)); if (NGEditorPrefs.GetBool(HQ.AllowSendStatsKeyPref, true) == true) { HQ.SendStats(); } }; NGLicensesManager.ActivationSucceeded += (invoice) => { string path = Path.Combine(Application.persistentDataPath, Path.Combine(Constants.InternalPackageTitle, "sendStats." + Utility.UnityVersion + "." + Constants.Version + ".txt")); if (File.Exists(path) == true) { File.Delete(path); } }; //Conf.DebugMode = (Conf.DebugState)EditorPrefs.GetInt(Conf.DebugModeKeyPref, (int)Conf.DebugMode); Utility.SafeDelayCall(() => { NGLicensesManager.Title = Constants.PackageTitle; NGLicensesManager.IntermediatePath = Constants.InternalPackageTitle; NGDiagnostic.Log(Preferences.Title, "LogPath", InternalNGDebug.LogPath); }); NGDiagnostic.Log(Preferences.Title, "DebugMode", Conf.DebugMode); // TODO Unity <5.6 backward compatibility? MethodInfo ResetAssetsMethod = typeof(HQ).GetMethod("ResetAssets", BindingFlags.Static | BindingFlags.NonPublic); try { EventInfo projectChangedEvent = typeof(EditorApplication).GetEvent("projectChanged"); projectChangedEvent.AddEventHandler(null, Delegate.CreateDelegate(projectChangedEvent.EventHandlerType, null, ResetAssetsMethod)); //EditorApplication.projectChanged += HQ.ResetAssets; } catch { FieldInfo projectWindowChangedField = UnityAssemblyVerifier.TryGetField(typeof(EditorApplication), "projectWindowChanged", BindingFlags.Static | BindingFlags.Public); if (projectWindowChangedField != null) { projectWindowChangedField.SetValue(null, Delegate.Combine((Delegate)projectWindowChangedField.GetValue(null), Delegate.CreateDelegate(projectWindowChangedField.FieldType, null, ResetAssetsMethod))); } //EditorApplication.projectWindowChanged += HQ.ResetAssets; } EditorApplication.projectWindowItemOnGUI += ProjectCopyAssets.OnProjectElementGUI; }
protected virtual void OnEnable() { this.notifyNewUpdate = !NGEditorPrefs.GetBool(DontNotifyNewUpdateKeyPref); }