static NGNavSelectionWindow() { try { if (Application.platform == RuntimePlatform.WindowsEditor) { EditorApplication.update += NGNavSelectionWindow.HandleMouseInputs; } NGEditorApplication.EditorExit += NGNavSelectionWindow.SaveHistoric; HQ.SettingsChanged += NGNavSelectionWindow.OnSettingsChanged; // It must me delayed! Most Object are correctly fetched, except folders and maybe others. EditorApplication.delayCall += () => { // HACK Prevents double call bug. if (NGNavSelectionWindow.historic.Count != 0) { return; } NGNavSelectionWindow.lastHash = NGEditorPrefs.GetInt(NGNavSelectionWindow.LastHashPrefKey, 0); NGNavSelectionWindow.isPlaging = EditorApplication.isPlaying; string autoSave = NGEditorPrefs.GetString(NGNavSelectionWindow.AutoSavePrefKey, string.Empty, true); if (autoSave != string.Empty) { string[] selections = autoSave.Split(','); int lastHash = 0; for (int i = 0; i < selections.Length; i++) { string[] IDs = selections[i].Split(';'); int[] array = new int[IDs.Length]; for (int j = 0; j < IDs.Length; j++) { array[j] = int.Parse(IDs[j]); } AssetsSelection selection = new AssetsSelection(array); if (selection.refs.Count > 0) { int hash = selection.GetSelectionHash(); if (lastHash != hash) { lastHash = hash; NGNavSelectionWindow.historic.Add(selection); } } } } }; } catch { } }
static NGHubWindow() { // In the case of NG Hub as dock, the layout won't load it at the second restart. Certainly due to the window's state as Popup, but it does not explain why it only occurs at the second restart. EditorApplication.delayCall += () => { int forceRecreate = NGEditorPrefs.GetInt(NGHubWindow.ForceRecreateKeyPref + "_" + Application.dataPath, 0); NGDiagnostic.Log(NGHubWindow.Title, "ForceRecreate", forceRecreate); if (forceRecreate == (int)DockState.ProperlyDisabled && Resources.FindObjectsOfTypeAll <NGHubWindow>().Length == 0) { NGHubWindow.OpenAsDock(); } }; }
public override void Load(string path) { this.value = (Int32)NGEditorPrefs.GetInt(path); }
public ScreenshotModuleEditor() : base(ScreenshotModule.ModuleID, ScreenshotModule.Priority, ScreenshotModule.Name) { this.useJPG = NGEditorPrefs.GetBool(ScreenshotModuleEditor.UseJPGKeyPref, this.useJPG, true); this.useCompression = NGEditorPrefs.GetBool(ScreenshotModuleEditor.UseCompressionKeyPref, this.useCompression, true); this.scaleMode = (ScaleMode)NGEditorPrefs.GetInt(ScreenshotModuleEditor.ScaleModeKeyPref, (int)this.scaleMode, true); }