Fixed the UI not showing on smaller resolutions. Also fixed UI not moving over immediately after screen size change

This commit is contained in:
Twirlbug 2023-06-27 00:31:24 -05:00
parent 3a899a79f1
commit 4adf8c9ce7

View file

@ -8,7 +8,8 @@ using SRMultiplayer.Networking;
public class MultiplayerUI : SRSingleton<MultiplayerUI>
{
private Rect windowRect = new Rect(Screen.width - 300, 20, 300, 500);
private int LastWidth = 0;
private Rect windowRect = new Rect(Screen.width - 300 - 20, 20, 300, 500);
private Vector2 playersScroll = Vector2.zero;
private string ipaddress = "localhost";
private string port = "16500";
@ -73,7 +74,14 @@ public class MultiplayerUI : SRSingleton<MultiplayerUI>
if (SceneManager.GetActiveScene().buildIndex >= 2)
{
windowRect = GUI.Window(1, windowRect, MultiplayerWindow, "SRMP v" + Globals.Version);
//check to see if the windows needs to move
if(LastWidth != Screen.width)
{
//recalc the window rect to move the gui
windowRect = new Rect(Screen.width - 300 - 20, 20, 300, 500);
}
windowRect = GUILayout.Window(1, windowRect, MultiplayerWindow, "SRMP v" + Globals.Version);
}
}