diff --git a/Multiplayer/Components/MainMenu/HostGamePane.cs b/Multiplayer/Components/MainMenu/HostGamePane.cs index 043c683..675d071 100644 --- a/Multiplayer/Components/MainMenu/HostGamePane.cs +++ b/Multiplayer/Components/MainMenu/HostGamePane.cs @@ -332,6 +332,7 @@ private void ValidateInputs(string text) startButton.ToggleInteractable(valid); //Multiplayer.Log($"HostPane validated: {valid}"); + } @@ -391,6 +392,7 @@ private void StartClick() var ContinueGameRequested = lcInstance.GetType().GetMethod("OnRunClicked", BindingFlags.NonPublic | BindingFlags.Instance); + //Multiplayer.Log($"OnRunClicked exists: {ContinueGameRequested != null}"); ContinueGameRequested?.Invoke(lcInstance, null); } diff --git a/Multiplayer/Components/MainMenu/ServerBrowserPane.cs b/Multiplayer/Components/MainMenu/ServerBrowserPane.cs index 4d8570a..c453427 100644 --- a/Multiplayer/Components/MainMenu/ServerBrowserPane.cs +++ b/Multiplayer/Components/MainMenu/ServerBrowserPane.cs @@ -18,8 +18,6 @@ using Multiplayer.Components.Networking.UI; using System.Net; - - namespace Multiplayer.Components.MainMenu { public class ServerBrowserPane : MonoBehaviour @@ -73,7 +71,6 @@ public class ServerBrowserPane : MonoBehaviour private void Awake() { //Multiplayer.Log("MultiplayerPane Awake()"); - CleanUI(); BuildUI(); @@ -326,6 +323,7 @@ private void JoinAction() { //not making a direct connection direct = false; + address = selectedServer.ip; portNumber = selectedServer.port; @@ -359,14 +357,13 @@ private void IndexChanged(AGridView gridView) if (gridView.SelectedModelIndex >= 0) { - //Debug.Log($"Selected server: {gridViewModel[gridView.SelectedModelIndex].Name}"); + //Multiplayer.Log($"Selected server: {gridViewModel[gridView.SelectedModelIndex].Name}"); selectedServer = gridViewModel[gridView.SelectedModelIndex]; UpdateDetailsPane(); //Check if we can connect to this server - Multiplayer.Log($"Server: \"{selectedServer.GameVersion}\" \"{selectedServer.MultiplayerVersion}\""); Multiplayer.Log($"Client: \"{BuildInfo.BUILD_VERSION_MAJOR.ToString()}\" \"{Multiplayer.ModEntry.Version.ToString()}\""); Multiplayer.Log($"Result: \"{selectedServer.GameVersion == BuildInfo.BUILD_VERSION_MAJOR.ToString()}\" \"{selectedServer.MultiplayerVersion == Multiplayer.ModEntry.Version.ToString()}\""); @@ -684,8 +681,6 @@ private void FillDummyServers() item.GameVersion = UnityEngine.Random.Range(1, 10) > 3 ? BuildInfo.BUILD_VERSION_MAJOR.ToString() : "97"; item.MultiplayerVersion = UnityEngine.Random.Range(1, 10) > 3 ? Multiplayer.ModEntry.Version.ToString() : "0.1.0"; - - //Debug.Log(item.HasPassword); gridViewModel.Add(item); } @@ -712,6 +707,4 @@ private string ExtractDomainName(string input) return input; } } - - } diff --git a/Multiplayer/Networking/Managers/Client/NetworkClient.cs b/Multiplayer/Networking/Managers/Client/NetworkClient.cs index cfdb9b1..ec91512 100644 --- a/Multiplayer/Networking/Managers/Client/NetworkClient.cs +++ b/Multiplayer/Networking/Managers/Client/NetworkClient.cs @@ -959,6 +959,14 @@ public void SendJobTakeRequest(ushort netId) } + public void SendChat(string message) + { + SendPacketToServer(new CommonChatPacket + { + message = message + }, DeliveryMethod.ReliableUnordered); + } + public void SendChat(string message) { SendPacketToServer(new CommonChatPacket diff --git a/Multiplayer/Networking/Managers/Server/NetworkServer.cs b/Multiplayer/Networking/Managers/Server/NetworkServer.cs index 301ea27..2bee782 100644 --- a/Multiplayer/Networking/Managers/Server/NetworkServer.cs +++ b/Multiplayer/Networking/Managers/Server/NetworkServer.cs @@ -108,7 +108,6 @@ protected override void Subscribe() netPacketProcessor.SubscribeReusable(OnCommonHandbrakePositionPacket); netPacketProcessor.SubscribeReusable(OnCommonTrainPortsPacket); netPacketProcessor.SubscribeReusable(OnCommonTrainFusesPacket); - netPacketProcessor.SubscribeReusable(OnServerboundJobTakeRequestPacket); netPacketProcessor.SubscribeReusable(OnCommonChatPacket); } diff --git a/Multiplayer/Patches/MainMenu/RightPaneControllerPatch.cs b/Multiplayer/Patches/MainMenu/RightPaneControllerPatch.cs index 8b3c46e..cd89b2c 100644 --- a/Multiplayer/Patches/MainMenu/RightPaneControllerPatch.cs +++ b/Multiplayer/Patches/MainMenu/RightPaneControllerPatch.cs @@ -61,8 +61,6 @@ private static void Prefix(RightPaneController __instance) MainMenuController_Awake_Patch.multiplayerButton.SetActive(true); Multiplayer.LogError("At end!"); - - // Check if the host pane already exists if (__instance.HasChildWithName("PaneRight Host")) return; diff --git a/Multiplayer/Settings.cs b/Multiplayer/Settings.cs index 9b4ce99..e2ffacb 100644 --- a/Multiplayer/Settings.cs +++ b/Multiplayer/Settings.cs @@ -34,7 +34,6 @@ public class Settings : UnityModManager.ModSettings, IDrawable [Draw("Details", Tooltip = "Details shown in the server browser")] public string Details = ""; - [Space(10)] [Header("Lobby Server")] [Draw("Lobby Server address", Tooltip = "Address of lobby server for finding multiplayer games")] diff --git a/Multiplayer/Utils/Csv.cs b/Multiplayer/Utils/Csv.cs index fcb12e5..192d17d 100644 --- a/Multiplayer/Utils/Csv.cs +++ b/Multiplayer/Utils/Csv.cs @@ -17,6 +17,7 @@ public static ReadOnlyDictionary> Parse(strin { // Split the input data into lines string[] separators = new string[] { "\r\n", "\n" }; + string[] lines = data.Split(separators, StringSplitOptions.RemoveEmptyEntries); // Use an OrderedDictionary to preserve the insertion order of keys