Skip to content

Commit

Permalink
Merge pull request #513 from misternebula/quick-patch
Browse files Browse the repository at this point in the history
Quick patch
  • Loading branch information
misternebula authored Apr 22, 2022
2 parents 5338531 + 102e3de commit f67da6f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
15 changes: 15 additions & 0 deletions QSB/Menus/MenuManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ internal class MenuManager : MonoBehaviour, IAddComponentOnStart
private GameObject ResumeGameButton;
private GameObject NewGameButton;
private GameObject ConnectButton;
private float _timeIPPopupOpened;

private const int _ClientButtonIndex = 2;

Expand Down Expand Up @@ -175,7 +176,14 @@ private void CreateCommonPopups()
{
var text = QSBCore.DebugSettings.UseKcpTransport ? "Public IP Address" : "Product User ID";
IPPopup = MenuApi.MakeInputFieldPopup(text, text, "Connect", "Cancel");
IPPopup.CloseMenuOnOk(false);
IPPopup.OnPopupConfirm += Connect;
IPPopup.OnActivateMenu += () =>
{
_timeIPPopupOpened = Time.time;
Delay.RunFramesLater(30, () => IPPopup.CloseMenuOnOk(true));
};
IPPopup.OnDeactivateMenu += () => IPPopup.CloseMenuOnOk(false);

OneButtonInfoPopup = MenuApi.MakeInfoPopup("", "");
OneButtonInfoPopup.OnDeactivateMenu += OnCloseInfoPopup;
Expand Down Expand Up @@ -348,6 +356,13 @@ private void Host()

private void Connect()
{
if (Time.time - _timeIPPopupOpened < 0.25f)
{
return;
}

IPPopup.CloseMenuOnOk(false);

_intentionalDisconnect = false;

var address = ((PopupInputMenu)IPPopup).GetInputText();
Expand Down
7 changes: 5 additions & 2 deletions QSB/QSBCore.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Mirror;
using HarmonyLib;
using Mirror;
using OWML.Common;
using OWML.ModHelper;
using QSB.Menus;
Expand Down Expand Up @@ -46,7 +47,9 @@ public class QSBCore : ModBehaviour
public static bool IsHost => NetworkServer.active;
public static bool IsInMultiplayer => QSBNetworkManager.singleton.isNetworkActive;
public static string QSBVersion => Helper.Manifest.Version;
public static string GameVersion => Application.version;
public static string GameVersion =>
// ignore the last patch numbers like the title screen does
Application.version.Split('.').Take(3).Join(delimiter: ".");
public static bool DLCInstalled => EntitlementsManager.IsDlcOwned() == EntitlementsManager.AsyncOwnershipStatus.Owned;
public static IMenuAPI MenuApi { get; private set; }
public static DebugSettings DebugSettings { get; private set; } = new();
Expand Down
2 changes: 1 addition & 1 deletion QSB/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"body": "- Disable *all* other mods. (Can heavily affect performance)\n- Make sure you are not running any other network-intensive applications.\n- Make sure you have forwarded/opened the correct ports. (See the GitHub readme.)"
},
"uniqueName": "Raicuparta.QuantumSpaceBuddies",
"version": "0.17.1",
"version": "0.17.2",
"owmlVersion": "2.3.2",
"dependencies": [ "_nebula.MenuFramework" ]
}

0 comments on commit f67da6f

Please sign in to comment.