2022-11-03 12:29:35 +01:00
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
|
|
|
|
|
namespace PongGame.Hubs;
|
|
|
|
|
|
|
|
|
|
[DebuggerDisplay($"{{{nameof(ToString)}(),nq}}")]
|
|
|
|
|
public class PongPlayer {
|
2022-11-04 15:13:56 +01:00
|
|
|
|
private string username = "UNNAMED";
|
2022-11-03 12:29:35 +01:00
|
|
|
|
|
|
|
|
|
public PongRoom? ConnectedRoom { get; internal set; }
|
|
|
|
|
public string Username {
|
|
|
|
|
get => username;
|
|
|
|
|
internal set {
|
|
|
|
|
if (username != value) {
|
|
|
|
|
username = value;
|
|
|
|
|
Task.Run(() => Client.UsernameChanged(value));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public IPongClient Client { get; internal set; } = default!;
|
|
|
|
|
|
|
|
|
|
public override string ToString() => $"[{Username}]";
|
|
|
|
|
}
|