Skip to content

Commit

Permalink
KSP 1.3 changes (#66)
Browse files Browse the repository at this point in the history
* Add names to dialog windows

Now required

* Adjust MMPatchLoaderIndex

A new LoadingSystem was added at the beginning (FontLoader).  This
change ensures that MM will always be after the GameDatabase regardless.

* Fix position of MM info in loading screen

Things seem to have moved

* Remove unused field

* Press Alt+F11 again to dismiss the menu

Apparently this wasn't a feature before (at least not recently) but
pretty simple to implement
  • Loading branch information
blowfishpro authored and sarbian committed Apr 3, 2017
1 parent 8f7fa26 commit ca5288b
Showing 1 changed file with 46 additions and 35 deletions.
81 changes: 46 additions & 35 deletions moduleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ public class ModuleManager : MonoBehaviour
private Sprite[] catFrames;
private Texture2D rainbow;


private int activePos = 0;

private bool nyan = false;

private PopupDialog menu;

#endregion state

#region Top Level - Update
Expand Down Expand Up @@ -108,7 +107,9 @@ internal void Awake()
MMPatchLoader loader = aGameObject.AddComponent<MMPatchLoader>();

log(string.Format("Adding ModuleManager to the loading screen {0}", list.Count));
list.Insert(1, loader);

int gameDatabaseIndex = list.FindIndex(s => s is GameDatabase);
list.Insert(gameDatabaseIndex + 1, loader);
}

nyan = (DateTime.Now.Month == 4 && DateTime.Now.Day == 1)
Expand Down Expand Up @@ -237,36 +238,46 @@ internal void Update()
&& (HighLogic.LoadedScene == GameScenes.SPACECENTER || HighLogic.LoadedScene == GameScenes.MAINMENU)
&& !inRnDCenter)
{
PopupDialog.SpawnPopupDialog(new Vector2(0.5f, 0.5f),
new Vector2(0.5f, 0.5f),
new MultiOptionDialog("",
"ModuleManager",
HighLogic.UISkin,
new Rect(0.5f, 0.5f, 150f, 60f),
new DialogGUIFlexibleSpace(),
new DialogGUIVerticalLayout(
if (menu == null)
{
menu = PopupDialog.SpawnPopupDialog(new Vector2(0.5f, 0.5f),
new Vector2(0.5f, 0.5f),
new MultiOptionDialog(
"ModuleManagerMenu",
"",
"ModuleManager",
HighLogic.UISkin,
new Rect(0.5f, 0.5f, 150f, 60f),
new DialogGUIFlexibleSpace(),
new DialogGUIButton("Reload Database",
delegate
{
MMPatchLoader.keepPartDB = false;
StartCoroutine(DataBaseReloadWithMM());
}, 140.0f, 30.0f, true),
new DialogGUIButton("Quick Reload Database",
delegate
{
MMPatchLoader.keepPartDB = true;
StartCoroutine(DataBaseReloadWithMM());
}, 140.0f, 30.0f, true),
new DialogGUIButton("Dump Database to Files",
delegate
{
StartCoroutine(DataBaseReloadWithMM(true));
}, 140.0f, 30.0f, true),
new DialogGUIButton("Close",() => {}, 140.0f, 30.0f, true)
)),
false,
HighLogic.UISkin);
new DialogGUIVerticalLayout(
new DialogGUIFlexibleSpace(),
new DialogGUIButton("Reload Database",
delegate
{
MMPatchLoader.keepPartDB = false;
StartCoroutine(DataBaseReloadWithMM());
}, 140.0f, 30.0f, true),
new DialogGUIButton("Quick Reload Database",
delegate
{
MMPatchLoader.keepPartDB = true;
StartCoroutine(DataBaseReloadWithMM());
}, 140.0f, 30.0f, true),
new DialogGUIButton("Dump Database to Files",
delegate
{
StartCoroutine(DataBaseReloadWithMM(true));
}, 140.0f, 30.0f, true),
new DialogGUIButton("Close", () => { }, 140.0f, 30.0f, true)
)),
false,
HighLogic.UISkin);
}
else
{
menu.Dismiss();
menu = null;
}
}

if (totalTime.IsRunning && HighLogic.LoadedScene == GameScenes.MAINMENU)
Expand All @@ -277,7 +288,7 @@ internal void Update()
Application.runInBackground = GameSettings.SIMULATE_IN_BACKGROUND;
}

float offsetY = Mathf.FloorToInt(0.3f * Screen.height);
float offsetY = Mathf.FloorToInt(0.23f * Screen.height);
float h;
if (warning)
{
Expand Down Expand Up @@ -423,7 +434,7 @@ public bool ElectionAndCheck()
string status =
"You have old versions of Module Manager (older than 1.5) or MMSarbianExt.\nYou will need to remove them for Module Manager and the mods using it to work\nExit KSP and delete those files :\n" +
String.Join("\n", badPaths.ToArray());
PopupDialog.SpawnPopupDialog(new Vector2(0f, 1f), new Vector2(0f, 1f), "Old versions of Module Manager", status, "OK", false, UISkinManager.defaultSkin);
PopupDialog.SpawnPopupDialog(new Vector2(0f, 1f), new Vector2(0f, 1f), "ModuleManagerOldVersions", "Old versions of Module Manager", status, "OK", false, UISkinManager.defaultSkin);
log("Old version of Module Manager present. Stopping");
return false;
}
Expand Down

0 comments on commit ca5288b

Please sign in to comment.