Partial rewrite, missing:
Some checks failed
Build Mau & Deploy Mau / build (push) Failing after 1m15s
Build Mau & Deploy Mau / deploy (push) Has been skipped

- Correctly parsing incoming messages
- Sending the gamestate after relevant actions
This commit is contained in:
DTieman
2024-05-04 19:55:11 +02:00
parent 0c2cb8272d
commit 694bc6147a
20 changed files with 612 additions and 294 deletions

39
Room/Lobby.cs Normal file
View File

@@ -0,0 +1,39 @@
using MauMau_Server.Mau;
using MauMau_Server.Websockets;
namespace MauMau_Server.Room;
public class Lobby : RoomType
{
private readonly Room _room;
public Lobby(Room room)
{
_room = room;
}
public Lobby(Room room, ConnectionInstance connection)
{
_room = room;
Console.WriteLine(connection.Name + " won the game!");
}
public void OnMessage(ConnectionInstance sender, string message)
{
// TODO: Add a way to change game settings
if (sender == _room._host)
{
_room._roomType = new Game(_room, _room.Connections);
}
}
public void OnConnect(ConnectionInstance connection)
{
var roomMessage = new RoomMessage("LOBBY", MessageType.INFO, _room.Connections, connection.Name + " joined!");
}
public void OnDisconnect(ConnectionInstance connection)
{
throw new NotImplementedException();
}
}