(Feat) Add Network Body
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
|
||||
namespace Ashwild.Network
|
||||
{
|
||||
/// <summary>
|
||||
/// A tiny static hub for "another player joined / left my session" notifications, kept separate
|
||||
/// from PlayerEvents on purpose: PlayerEvents represents the LOCAL owned player and §3 forbids a
|
||||
/// remote player copy from driving it. These events are raised by SessionPresenceNotifier on the
|
||||
/// networked player copies (a local-client view of the session roster) and consumed by the game
|
||||
/// scene's presence feed UI. Names are already resolved display names, ready to show.
|
||||
/// </summary>
|
||||
public static class SessionPresenceEvents
|
||||
{
|
||||
#region Events
|
||||
|
||||
/// <summary>
|
||||
/// A remote player just joined the session — carries their display name.
|
||||
/// </summary>
|
||||
public static event Action<string> PlayerJoined;
|
||||
|
||||
/// <summary>
|
||||
/// A remote player just left the session — carries their display name.
|
||||
/// </summary>
|
||||
public static event Action<string> PlayerLeft;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Raisers
|
||||
|
||||
/// <summary>
|
||||
/// Announces that a remote player joined, to whoever is listening on this client.
|
||||
/// </summary>
|
||||
public static void RaisePlayerJoined(string playerName) => PlayerJoined?.Invoke(playerName);
|
||||
|
||||
/// <summary>
|
||||
/// Announces that a remote player left, to whoever is listening on this client.
|
||||
/// </summary>
|
||||
public static void RaisePlayerLeft(string playerName) => PlayerLeft?.Invoke(playerName);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user