mirror of
https://github.com/AndrioCelos/TableturfBattleApp.git
synced 2026-10-03 07:39:34 -05:00
Rework sync procedure and add a loading indicator
The server will now send a sync message when the client connects via WebSocket. This removes the need to send another GET request to sync game data.
This commit is contained in:
@@ -8,6 +8,8 @@ using System.Web;
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
using TableturfBattleServer.DTO;
|
||||
|
||||
using WebSocketSharp.Server;
|
||||
|
||||
using HttpListenerRequest = WebSocketSharp.Net.HttpListenerRequest;
|
||||
@@ -154,7 +156,7 @@ internal class Program {
|
||||
SetResponse(e.Response, (int) HttpStatusCode.OK, "application/json", JsonConvert.SerializeObject(new {
|
||||
game,
|
||||
playerData = game.GetPlayer(clientToken, out var playerIndex, out var player)
|
||||
? new { playerIndex, hand = player.Hand, deck = player.Deck, cardsUsed = player.CardsUsed, move = player.Move }
|
||||
? new PlayerData(playerIndex, player)
|
||||
: null
|
||||
}));
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user