Skip to content

Commit

Permalink
Merge branch 'beta' into Join-Menu-Improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
AMacro authored Jul 14, 2024
2 parents 24b6f58 + 1827ded commit 33592fd
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
2 changes: 2 additions & 0 deletions Multiplayer/Components/MainMenu/HostGamePane.cs
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ private void ValidateInputs(string text)
startButton.ToggleInteractable(valid);

//Multiplayer.Log($"HostPane validated: {valid}");

}


Expand Down Expand Up @@ -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);
}
Expand Down
11 changes: 2 additions & 9 deletions Multiplayer/Components/MainMenu/ServerBrowserPane.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
using Multiplayer.Components.Networking.UI;
using System.Net;



namespace Multiplayer.Components.MainMenu
{
public class ServerBrowserPane : MonoBehaviour
Expand Down Expand Up @@ -73,7 +71,6 @@ public class ServerBrowserPane : MonoBehaviour
private void Awake()
{
//Multiplayer.Log("MultiplayerPane Awake()");

CleanUI();
BuildUI();

Expand Down Expand Up @@ -326,6 +323,7 @@ private void JoinAction()
{
//not making a direct connection
direct = false;

address = selectedServer.ip;
portNumber = selectedServer.port;

Expand Down Expand Up @@ -359,14 +357,13 @@ private void IndexChanged(AGridView<IServerBrowserGameDetails> 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()}\"");
Expand Down Expand Up @@ -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);
}

Expand All @@ -712,6 +707,4 @@ private string ExtractDomainName(string input)
return input;
}
}


}
8 changes: 8 additions & 0 deletions Multiplayer/Networking/Managers/Client/NetworkClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion Multiplayer/Networking/Managers/Server/NetworkServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ protected override void Subscribe()
netPacketProcessor.SubscribeReusable<CommonHandbrakePositionPacket, NetPeer>(OnCommonHandbrakePositionPacket);
netPacketProcessor.SubscribeReusable<CommonTrainPortsPacket, NetPeer>(OnCommonTrainPortsPacket);
netPacketProcessor.SubscribeReusable<CommonTrainFusesPacket, NetPeer>(OnCommonTrainFusesPacket);

netPacketProcessor.SubscribeReusable<ServerboundJobTakeRequestPacket, NetPeer>(OnServerboundJobTakeRequestPacket);
netPacketProcessor.SubscribeReusable<CommonChatPacket, NetPeer>(OnCommonChatPacket);
}
Expand Down
2 changes: 0 additions & 2 deletions Multiplayer/Patches/MainMenu/RightPaneControllerPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion Multiplayer/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down
1 change: 1 addition & 0 deletions Multiplayer/Utils/Csv.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public static ReadOnlyDictionary<string, Dictionary<string, string>> 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
Expand Down

0 comments on commit 33592fd

Please sign in to comment.