Partial rewrite, missing:
- Correctly parsing incoming messages - Sending the gamestate after relevant actions
This commit is contained in:
38
Room/RoomType.cs
Normal file
38
Room/RoomType.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using MauMau_Server.Websockets;
|
||||
|
||||
namespace MauMau_Server.Room;
|
||||
|
||||
public abstract class RoomType
|
||||
{
|
||||
protected readonly Room _room;
|
||||
|
||||
protected RoomType(Room room)
|
||||
{
|
||||
_room = room;
|
||||
}
|
||||
|
||||
/**
|
||||
* <summary>
|
||||
* This method is called when a message is received from a ConnectionInstance
|
||||
* </summary>
|
||||
* <param name="sender">The ConnectionInstance that sent the message</param>
|
||||
* <param name="message">The message received</param>
|
||||
*/
|
||||
public abstract void OnMessage(ConnectionInstance sender, string message);
|
||||
|
||||
/**
|
||||
* <summary>
|
||||
* This method is called when a new ConnectionInstance is added to the Room.
|
||||
* </summary>
|
||||
* <param name="connection">The ConnectionInstance that was added to the Room</param>
|
||||
*/
|
||||
public abstract void OnConnect(ConnectionInstance connection);
|
||||
|
||||
/**
|
||||
* <summary>
|
||||
* This method is called when a ConnectionInstance is either removed from the Room or the ConnectionInstance's WebSocket is closed.
|
||||
* </summary>
|
||||
* <param name="connection">The ConnectionInstance that was removed from the Room</param>
|
||||
*/
|
||||
public abstract void OnDisconnect(ConnectionInstance connection);
|
||||
}
|
||||
Reference in New Issue
Block a user