checkpoint
This commit is contained in:
@@ -1,6 +1,35 @@
|
||||
namespace Gameboard.ShogiUI.Sockets.Managers
|
||||
using Gameboard.ShogiUI.BoardState;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace Gameboard.ShogiUI.Sockets.Managers
|
||||
{
|
||||
public class BoardManager
|
||||
public interface IBoardManager
|
||||
{
|
||||
void Add(string sessionName, ShogiBoard board);
|
||||
ShogiBoard Get(string sessionName);
|
||||
}
|
||||
|
||||
public class BoardManager : IBoardManager
|
||||
{
|
||||
private readonly ConcurrentDictionary<string, ShogiBoard> Boards;
|
||||
|
||||
public BoardManager()
|
||||
{
|
||||
Boards = new ConcurrentDictionary<string, ShogiBoard>();
|
||||
}
|
||||
|
||||
public void Add(string sessionName, ShogiBoard board) => Boards.TryAdd(sessionName, board);
|
||||
|
||||
public ShogiBoard Get(string sessionName)
|
||||
{
|
||||
if (Boards.TryGetValue(sessionName, out var board))
|
||||
return board;
|
||||
return null;
|
||||
}
|
||||
|
||||
public string GetBoardState()
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user