private void CallHandler(ClientInfo client, Object request) { Call pckt = (Call)request; RoomDealer room = Rooms.FindRoomFromClientId(client.Id); room.GameInfo.SetPlayerCall(client.Id, pckt.Type); room.SendMessageToRoom("Call", pckt); if (room.GameInfo.IsAllPlayersSkiped()) { room.GameCancelled(); } else if (room.GameInfo.IsGameCallOver()) { room.StartPlayerDogHandling(); } else { Net.GetConnectionByClientId(room.GetNextPlayerIdTurnById(client.Id)).SendObject("YourTurnCall", new YourTurnCall()); } }
private void CardPlayedHandler(ClientInfo client, Object request) { CardPlayed pckt = (CardPlayed)request; RoomDealer RoomOfClient = Rooms.FindRoomFromClientId(client.Id); RoomOfClient.GameInfo.PlayersInfo[client.Id].CardPlayedOnTable = pckt.Card; RoomOfClient.GameInfo.PlayersInfo[client.Id].RemoveCardPlayed(pckt.Card); RoomOfClient.SendMessageToRoom("CardPlayed", pckt); if (RoomOfClient.GameInfo.IsTurnOver()) { RoomOfClient.HandleTurnOver(); } else { if (RoomOfClient.GameInfo.IsFirstCardToPlayed()) { RoomOfClient.GameInfo.ColorPlayed = pckt.Card.Color; } Net.GetConnectionByClientId(RoomOfClient.GetNextPlayerIdTurnById(client.Id)).SendObject("YourTurnPlayCard", new YourTurnPlayCard()); } }