// --------------------- static private void CheckInstallation() { CFProjPrefs prefs = CFProjPrefs.Inst; string curProjPath = Application.dataPath; if (prefs.isIsntalled && (prefs.projectPath != curProjPath)) { EditorUtility.DisplayDialog(DIALOG_TITLE, "Looks like CF2 was installed in different location...", "OK"); prefs.wasShown = false; } if (prefs.isIsntalled && (prefs.installedVer != CF2_INSTALLER_VERSION)) { // TODO : upgrade... } prefs.projectPath = curProjPath; prefs.Save(); if (!prefs.wasShown || (prefs.installedVer != CF2_INSTALLER_VERSION)) { ShowInstallerWindow(); } }
// ----------------- public static CFProjPrefs Load() { string fullPath = GetFullPath(); CFEditorUtils.EnsureDirectoryExists(fullPath); CFProjPrefs o = CFEditorUtils.LoadObjectFromXml(fullPath, typeof(CFProjPrefs)) as CFProjPrefs; //LoadXml<CFProjPrefs>(fullPath); return((o == null) ? (new CFProjPrefs()) : o); }
// -------------------- bool Install() { try { EditorUtility.DisplayProgressBar(DIALOG_TITLE, "Adding CF2 Input Manager axes...", 0.1f); UnityInputManagerUtils.AddControlFreakAxes(); EditorUtility.DisplayProgressBar(DIALOG_TITLE, "Adding Define Symbols...", 0.6f); ConfigManager.AddDefaultControlFreakSymbols(); // Save config... EditorUtility.DisplayProgressBar(DIALOG_TITLE, "Saving...", 0.8f); CFProjPrefs prefs = CFProjPrefs.Inst; prefs.wasShown = true; prefs.installedVer = CF2_INSTALLER_VERSION; prefs.projectPath = Application.dataPath; prefs.isIsntalled = true; prefs.Save(); //Debug.Log("Saved!"); prefs = CFProjPrefs.Inst; //Debug.Log("reloaded : " + prefs.isIsntalled + " ver:" + prefs.installedVer); // Recompile scripts... AssetDatabase.Refresh(); EditorUtility.ClearProgressBar(); } catch (System.Exception e) { EditorUtility.ClearProgressBar(); EditorUtility.DisplayDialog(DIALOG_TITLE, "Something went wrong during installation!\n" + e.Message, "OK"); return(false); } return(true); }
// --------------------- static private void CheckInstallation() { EditorApplication.update -= CheckInstallation; if (EditorApplication.isPlaying || EditorApplication.isPlayingOrWillChangePlaymode) { return; } CFProjPrefs prefs = CFProjPrefs.Inst; string curProjPath = Application.dataPath; if (prefs.isIsntalled && (prefs.projectPath != curProjPath)) { EditorUtility.DisplayDialog(DIALOG_TITLE, "Looks like CF2 was originally installed in different location!\nPlease run the CF2 Installer.", "OK"); //prefs.wasShown = false; } if (prefs.isIsntalled && (prefs.installedVer != CF2_INSTALLER_VERSION)) { // TODO : upgrade... } prefs.projectPath = curProjPath; prefs.Save(); if (!prefs.wasShown || (prefs.installedVer != CF2_INSTALLER_VERSION)) { ShowInstallerWindow(); } }