Skip to content

Commit

Permalink
Add ESC to go back in UIMainMenu and fix logging
Browse files Browse the repository at this point in the history
  • Loading branch information
starfi5h committed Sep 7, 2024
1 parent c03e3e5 commit fd7c760
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected override void ProcessPacket(StationUIInitialSyncRequest packet, Nebula

if (stationComponent == null)
{
Log.Error(
Log.Warn(
$"StationUIInitialSyncRequestProcessor: Unable to find requested station on planet {packet.PlanetId} with id {packet.StationId} and gid {packet.StationGId}");
return;
}
Expand Down
4 changes: 0 additions & 4 deletions NebulaPatcher/Patches/Dynamic/PlanetData_Patch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,8 @@ public static bool UpdateDirtyMesh_Prefix(PlanetData __instance, int dirtyIdx, r
{
return true;
}
Log.Warn(__instance == GameMain.localPlanet
? "Local"
: "Remote" + $" PlanetData.UpdateDirtyMesh: meshes[{dirtyIdx}] is null");
__result = false;
return false;

}

[HarmonyPrefix]
Expand Down
25 changes: 25 additions & 0 deletions NebulaPatcher/Patches/Dynamic/UIMainMenu_Patch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,31 @@ public static void OnUpdateLogButtonClick_Postfix()
OnMultiplayerBackButtonClick();
}

[HarmonyPrefix]
[HarmonyPatch(nameof(UIMainMenu.UpdateDemoScene))]
[HarmonyPatch(nameof(UIMainMenu._OnUpdate))]
public static void OnEscSwitch()
{
if (!VFInput.escape) return;

// Go back to the upper level when hitting esc
if (multiplayerMenu.gameObject.activeInHierarchy)
{
OnJoinGameBackButtonClick();
VFInput.UseEscape();
}
else if (UIRoot.instance.loadGameWindow.active)
{
UIRoot.instance.loadGameWindow.OnCancelClick(0);
VFInput.UseEscape();
}
else if (multiplayerSubMenu.gameObject.activeInHierarchy)
{
OnMultiplayerBackButtonClick();
VFInput.UseEscape();
}
}

// Main Menu
private static void AddMultiplayerButton()
{
Expand Down

0 comments on commit fd7c760

Please sign in to comment.