From 9728fe3f347328323ff79c6c93df2ab390f6070e Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Mon, 4 May 2020 17:53:48 -0400 Subject: add Multiplayer.PeerConnected event --- src/SMAPI/Events/IMultiplayerEvents.cs | 5 ++++- src/SMAPI/Events/PeerConnectedEventArgs.cs | 25 +++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 src/SMAPI/Events/PeerConnectedEventArgs.cs (limited to 'src/SMAPI/Events') diff --git a/src/SMAPI/Events/IMultiplayerEvents.cs b/src/SMAPI/Events/IMultiplayerEvents.cs index 4a31f48e..af9b5f17 100644 --- a/src/SMAPI/Events/IMultiplayerEvents.cs +++ b/src/SMAPI/Events/IMultiplayerEvents.cs @@ -5,9 +5,12 @@ namespace StardewModdingAPI.Events /// Events raised for multiplayer messages and connections. public interface IMultiplayerEvents { - /// Raised after the mod context for a peer is received. This happens before the game approves the connection, so the player doesn't yet exist in the game. This is the earliest point where messages can be sent to the peer via SMAPI. + /// Raised after the mod context for a peer is received. This happens before the game approves the connection (), so the player doesn't yet exist in the game. This is the earliest point where messages can be sent to the peer via SMAPI. event EventHandler PeerContextReceived; + /// Raised after a peer connection is approved by the game. + event EventHandler PeerConnected; + /// Raised after a mod message is received over the network. event EventHandler ModMessageReceived; diff --git a/src/SMAPI/Events/PeerConnectedEventArgs.cs b/src/SMAPI/Events/PeerConnectedEventArgs.cs new file mode 100644 index 00000000..bfaa2bd3 --- /dev/null +++ b/src/SMAPI/Events/PeerConnectedEventArgs.cs @@ -0,0 +1,25 @@ +using System; + +namespace StardewModdingAPI.Events +{ + /// Event arguments for an event. + public class PeerConnectedEventArgs : EventArgs + { + /********* + ** Accessors + *********/ + /// The peer whose metadata was received. + public IMultiplayerPeer Peer { get; } + + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The peer whose metadata was received. + internal PeerConnectedEventArgs(IMultiplayerPeer peer) + { + this.Peer = peer; + } + } +} -- cgit