removed auth and fixed id bug
This commit is contained in:
@@ -1,15 +0,0 @@
|
||||
using System.Text.Json;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace MauMau_Server.Controllers;
|
||||
|
||||
[ApiController]
|
||||
[Route("[controller]")]
|
||||
public class AuthController : ControllerBase
|
||||
{
|
||||
[HttpGet]
|
||||
public async Task<IActionResult> Get()
|
||||
{
|
||||
return Ok(JsonSerializer.Serialize(Guid.NewGuid()));
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,7 @@ public class GameState
|
||||
|
||||
foreach (var player in game.Players)
|
||||
{
|
||||
Players.Add(p.Connection.ConnectionId);
|
||||
Players.Add(player.Connection.ConnectionId);
|
||||
}
|
||||
|
||||
CurrentCard = game.CurrentCard.ToString();
|
||||
|
||||
14
Room/Room.cs
14
Room/Room.cs
@@ -1,6 +1,4 @@
|
||||
using System.Collections;
|
||||
using System.Net.WebSockets;
|
||||
using System.Text;
|
||||
using System.Net.WebSockets;
|
||||
using System.Text.Json;
|
||||
using MauMau_Server.Mau;
|
||||
|
||||
@@ -62,13 +60,12 @@ public class Room
|
||||
private ConnectionInstance AddConnection(WebSocket socket)
|
||||
{
|
||||
var connectionId = Guid.NewGuid().ToString();
|
||||
// TODO: Why does every connection have the same connectionId?
|
||||
var connection = new ConnectionInstance(connectionId, socket);
|
||||
_connections.Add(connection);
|
||||
return connection;
|
||||
}
|
||||
|
||||
public void RemoveConnection(string socketId)
|
||||
private void RemoveConnection(string socketId)
|
||||
{
|
||||
_connections.RemoveAll(connection => connection.ConnectionId == socketId);
|
||||
}
|
||||
@@ -102,12 +99,7 @@ public class Room
|
||||
return _connections.Select(connection => connection.Socket).ToList();
|
||||
}
|
||||
|
||||
private static byte[] EmptyBuffer()
|
||||
{
|
||||
return new byte[4096];
|
||||
}
|
||||
|
||||
public bool IsEmpty()
|
||||
private bool IsEmpty()
|
||||
{
|
||||
return _connections.Count == 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user