diff --git a/HKMP/Game/Client/Save/SaveManager.cs b/HKMP/Game/Client/Save/SaveManager.cs
index 2fe4279..1ea7100 100644
--- a/HKMP/Game/Client/Save/SaveManager.cs
+++ b/HKMP/Game/Client/Save/SaveManager.cs
@@ -584,6 +584,10 @@ private void UpdateSaveWithData(SaveUpdate saveUpdate) {
UpdateSaveWithData(index, value);
}
+ ///
+ /// Set the save data from the given CurrentSave by overriding all values.
+ ///
+ /// The save data to set.
public void SetSaveWithData(CurrentSave currentSave) {
Logger.Info("Received current save, updating...");
diff --git a/HKMP/Ui/UiManager.cs b/HKMP/Ui/UiManager.cs
index 920e835..606b8f1 100644
--- a/HKMP/Ui/UiManager.cs
+++ b/HKMP/Ui/UiManager.cs
@@ -312,7 +312,8 @@ public void ReturnToMainMenuFromGame() {
UM.StartCoroutine(GM.ReturnToMainMenu(
GameManager.ReturnToMainMenuSaveModes.DontSave,
_ => {
- UM.StartCoroutine(UM.HideCurrentMenu());
+ IH.StartUIInput();
+ UM.returnMainMenuPrompt.HighlightDefault();
}
));
}
@@ -347,8 +348,12 @@ private void TryAddMultiOption() {
return;
}
- if (btnParent.FindGameObjectInChildren("StartMultiplayerButton") != null) {
+ var startMultiBtn = btnParent.FindGameObjectInChildren("StartMultiplayerButton");
+ if (startMultiBtn != null) {
Logger.Info("Multiplayer button is already present");
+
+ FixMultiplayerButtonNavigation(startMultiBtn);
+
return;
}
@@ -358,7 +363,7 @@ private void TryAddMultiOption() {
return;
}
- var startMultiBtn = Object.Instantiate(startGameBtn, btnParent.transform);
+ startMultiBtn = Object.Instantiate(startGameBtn, btnParent.transform);
if (startMultiBtn == null) {
Logger.Info("startMultiBtn is null");
return;
@@ -370,9 +375,30 @@ private void TryAddMultiOption() {
var autoLocalize = startMultiBtn.GetComponent();
autoLocalize.textKey = "StartMultiplayerBtn";
autoLocalize.RefreshTextFromLocalization();
+
+ var eventTrigger = startMultiBtn.GetComponent();
+ eventTrigger.triggers.Clear();
+ ChangeBtnTriggers(eventTrigger, () => UM.StartCoroutine(GoToMultiplayerMenu()));
+
+ // Fix navigation now and when the IH can accept input again
+ FixMultiplayerButtonNavigation(startMultiBtn);
+
+ UM.StartCoroutine(WaitForInput());
+ IEnumerator WaitForInput() {
+ yield return new WaitUntil(() => IH.acceptingInput);
+
+ FixMultiplayerButtonNavigation(startMultiBtn);
+ }
+ }
+
+ ///
+ /// Fix the navigation for the multiplayer button that is added to the main menu.
+ ///
+ /// The game object for the multiplayer button.
+ private void FixMultiplayerButtonNavigation(GameObject multiBtnObject) {
// Fix navigation for buttons
- var startMultiBtnMenuBtn = startMultiBtn.GetComponent();
+ var startMultiBtnMenuBtn = multiBtnObject.GetComponent();
if (startMultiBtnMenuBtn != null) {
var nav = UM.mainMenuButtons.startButton.navigation;
nav.selectOnDown = startMultiBtnMenuBtn;
@@ -386,11 +412,6 @@ private void TryAddMultiOption() {
nav.selectOnUp = UM.mainMenuButtons.startButton;
startMultiBtnMenuBtn.navigation = nav;
}
-
- var eventTrigger = startMultiBtn.GetComponent();
- eventTrigger.triggers.Clear();
-
- ChangeBtnTriggers(eventTrigger, () => UM.StartCoroutine(GoToMultiplayerMenu()));
}
///