diff --git a/XLMultiplayer/MultiplayerController.cs b/XLMultiplayer/MultiplayerController.cs index 76294e4..67b6253 100644 --- a/XLMultiplayer/MultiplayerController.cs +++ b/XLMultiplayer/MultiplayerController.cs @@ -75,6 +75,9 @@ class MultiplayerController : MonoBehaviour{ private bool closedByPeer = false; private bool problemDetectedLocally = false; + private string serverIPString = ""; + private ushort serverPort = 7777; + private Thread networkMessageThread; public List chatMessages = new List(); @@ -283,6 +286,8 @@ public void ConnectToServer(string ip, ushort port, string user) { } catch (Exception) { } } + serverPort = port; + serverIPString = serverIP.ToString(); Address remoteAddress = new Address(); remoteAddress.SetAddress(serverIP.ToString(), port); @@ -506,8 +511,7 @@ public void Update() { if (GameManagement.GameStateMachine.Instance.CurrentState.GetType() == typeof(GameManagement.ReplayState)) { controller.replayController.TimeScale = ReplayEditorController.Instance.playbackController.TimeScale; controller.replayController.SetPlaybackTime(ReplayEditorController.Instance.playbackController.CurrentTime); - - + if (controller.playerID == 255 && ((controller.replayController.ClipFrames.Last().time < ReplayEditorController.Instance.playbackController.CurrentTime && controller.skater.activeSelf) || (controller.replayController.ClipFrames.Count == 0 && controller.skater.activeSelf))) { controller.skater.SetActive(false); controller.board.SetActive(false); @@ -638,7 +642,7 @@ private void ProcessMessage(byte[] buffer) { fileClient = new NetworkingSockets(); Address remoteAddress = new Address(); - remoteAddress.SetAddress("127.0.0.1", 7778); + remoteAddress.SetAddress(serverIPString, (ushort)(serverPort + 1)); fileConnection = fileClient.Connect(ref remoteAddress); diff --git a/XLMultiplayerServer/FileServer.cs b/XLMultiplayerServer/FileServer.cs index 7789173..c90ba8a 100644 --- a/XLMultiplayerServer/FileServer.cs +++ b/XLMultiplayerServer/FileServer.cs @@ -58,7 +58,7 @@ public static void ServerLoop() { Console.WriteLine($"Gameplay port: {Server.port}, File Server Port: {(ushort)(Server.port + 1)}"); - address.SetAddress("::0", 7778); + address.SetAddress("::0", (ushort)(Server.port + 1)); listenSocket = server.CreateListenSocket(ref address); pollGroup = server.CreatePollGroup();