forked from NathanKell/RealSolarSystem
-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e6b87b6
commit 9a1cdcf
Showing
2 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
using System; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Reflection; | ||
using UnityEngine; | ||
|
||
namespace RealSolarSystem | ||
{ | ||
[KSPAddon(KSPAddon.Startup.Instantly, true)] | ||
public class StartupPopup : MonoBehaviour | ||
{ | ||
private const string PreferenceFileName = "RSSFinalizeOrbitWarning"; | ||
private static string PreferenceFilePath => Path.Combine( | ||
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), | ||
"PluginData", | ||
PreferenceFileName); | ||
|
||
public void Start() | ||
{ | ||
if (AssemblyLoader.loadedAssemblies.Any(a => string.Equals(a.name, "ksp_plugin_adapter", StringComparison.OrdinalIgnoreCase))) | ||
return; | ||
|
||
if (File.Exists(PreferenceFilePath)) return; | ||
|
||
PopupDialog.SpawnPopupDialog( | ||
new Vector2(0, 0), | ||
new Vector2(0, 0), | ||
new MultiOptionDialog( | ||
"RSSStartupDialog", | ||
"Warning: This version contains breaking changes for non-Principia users. Significant and necessary fixes have been implemented, which may result in planets changing positions in their orbits. Existing maneuvers and vessels in flight may have dramatically altered future encounters. For existing saves, it is recommended to revert to the prior CKAN version and upgrading is not recommended. Please create backups before attempting to update existing saves.", | ||
"Real Solar System", | ||
HighLogic.UISkin, | ||
new DialogGUIVerticalLayout( | ||
new DialogGUIButton("Don't show again", RememberPreference, true), | ||
new DialogGUIButton("Ok", () => { }, true) | ||
) | ||
), | ||
true, | ||
HighLogic.UISkin); | ||
} | ||
|
||
private static void RememberPreference() | ||
{ | ||
// create empty file | ||
File.Create(PreferenceFilePath).Close(); | ||
} | ||
} | ||
} |