blob: 4923a202820ce4002069208bbeb5c21e8e4ec7b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
using StardewModdingAPI.Framework.Events;
using StardewValley;
namespace StardewModdingAPI.Framework
{
/// <summary>SMAPI's implementation of the game's core multiplayer logic.</summary>
internal class SMultiplayer : Multiplayer
{
/*********
** Properties
*********/
/// <summary>Encapsulates monitoring and logging.</summary>
private readonly IMonitor Monitor;
/// <summary>Manages SMAPI events.</summary>
private readonly EventManager EventManager;
/*********
** Public methods
*********/
/// <summary>Construct an instance.</summary>
/// <param name="monitor">Encapsulates monitoring and logging.</param>
/// <param name="eventManager">Manages SMAPI events.</param>
public SMultiplayer(IMonitor monitor, EventManager eventManager)
{
this.Monitor = monitor;
this.EventManager = eventManager;
}
/// <summary>Handle sync messages from other players and perform other initial sync logic.</summary>
public override void UpdateEarly()
{
this.EventManager.Legacy_BeforeMainSync.Raise();
base.UpdateEarly();
this.EventManager.Legacy_AfterMainSync.Raise();
}
/// <summary>Broadcast sync messages to other players and perform other final sync logic.</summary>
public override void UpdateLate(bool forceSync = false)
{
this.EventManager.Legacy_BeforeMainBroadcast.Raise();
base.UpdateLate(forceSync);
this.EventManager.Legacy_AfterMainBroadcast.Raise();
}
}
}
|