summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/SMultiplayer.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2018-11-14 00:57:52 -0500
committerJesse Plamondon-Willard <Pathoschild@users.noreply.github.com>2018-11-14 00:57:52 -0500
commit8e1d45b3100453a11bcdf663d3567935c592098c (patch)
tree0a86c9a891e75f3462169b0f64a4ba2355272643 /src/SMAPI/Framework/SMultiplayer.cs
parent77a7a0fe58186e49e24c41f47a2a33661afbc81c (diff)
downloadSMAPI-8e1d45b3100453a11bcdf663d3567935c592098c.tar.gz
SMAPI-8e1d45b3100453a11bcdf663d3567935c592098c.tar.bz2
SMAPI-8e1d45b3100453a11bcdf663d3567935c592098c.zip
override Galaxy client/server to support context sync (#480)
This commit assumes the changes I requested in the game code to make GalaxyNetClient and GalaxyNetServer public are implemented in 1.3.32.
Diffstat (limited to 'src/SMAPI/Framework/SMultiplayer.cs')
-rw-r--r--src/SMAPI/Framework/SMultiplayer.cs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/SMultiplayer.cs b/src/SMAPI/Framework/SMultiplayer.cs
index 6ce7596d..5a8aa3e5 100644
--- a/src/SMAPI/Framework/SMultiplayer.cs
+++ b/src/SMAPI/Framework/SMultiplayer.cs
@@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using Galaxy.Api;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using StardewModdingAPI.Events;
@@ -11,6 +12,7 @@ using StardewModdingAPI.Framework.Reflection;
using StardewModdingAPI.Toolkit.Serialisation;
using StardewValley;
using StardewValley.Network;
+using StardewValley.SDKs;
namespace StardewModdingAPI.Framework
{
@@ -113,6 +115,12 @@ namespace StardewModdingAPI.Framework
return new SLidgrenClient(address, this.OnClientProcessingMessage, this.OnClientSendingMessage);
}
+ case GalaxyNetClient _:
+ {
+ GalaxyID address = this.Reflection.GetField<GalaxyID>(client, "lobbyId").GetValue();
+ return new SGalaxyNetClient(address, this.OnClientProcessingMessage, this.OnClientSendingMessage);
+ }
+
default:
return client;
}
@@ -130,6 +138,11 @@ namespace StardewModdingAPI.Framework
return new SLidgrenServer(gameServer, this.Reflection, this.readFarmer, this.OnServerProcessingMessage);
}
+ case GalaxyNetServer _:
+ {
+ IGameServer gameServer = this.Reflection.GetField<IGameServer>(server, "gameServer").GetValue();
+ return new SGalaxyNetServer(gameServer, this.Reflection, this.OnServerProcessingMessage);
+ }
default:
return server;