react frontend app (display screen, join)
This commit is contained in:
parent
1a20fa1fb6
commit
abdfdf2ec0
1 changed files with 3917 additions and 5 deletions
18
TanksServer/PlayerService.cs
Normal file
18
TanksServer/PlayerService.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
using System.Collections.Concurrent;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace TanksServer;
|
||||
|
||||
internal sealed class PlayerService(ILogger<PlayerService> logger)
|
||||
{
|
||||
private readonly ConcurrentDictionary<string, Player> _players = new();
|
||||
|
||||
public Player GetOrAdd(string name) => _players.GetOrAdd(name, _ => new Player(name));
|
||||
}
|
||||
|
||||
internal class Player(string name)
|
||||
{
|
||||
public string Name => name;
|
||||
|
||||
public Guid Id => Guid.NewGuid();
|
||||
}
|
||||
Reference in a new issue