This commit is contained in:
2024-10-31 18:56:51 -05:00
parent e282566241
commit fa1ad5f6d0

View File

@@ -95,7 +95,7 @@ public class ShogiApplication(
} }
else else
{ {
var isPromotion = command.IsPromotion.HasValue ? command.IsPromotion.Value : false; var isPromotion = command.IsPromotion ?? false;
session.Board.Move(command.From!, command.To, isPromotion); session.Board.Move(command.From!, command.To, isPromotion);
} }
} }
@@ -109,7 +109,6 @@ public class ShogiApplication(
await gameHubContext.Emit_PieceMoved(sessionId); await gameHubContext.Emit_PieceMoved(sessionId);
return new NoContentResult(); return new NoContentResult();
} }
public async Task<IActionResult> JoinSession(string sessionId, string player2Id) public async Task<IActionResult> JoinSession(string sessionId, string player2Id)
@@ -120,12 +119,9 @@ public class ShogiApplication(
if (string.IsNullOrEmpty(session.Player2)) if (string.IsNullOrEmpty(session.Player2))
{ {
session.AddPlayer2(player2Id); session.AddPlayer2(player2Id);
await sessionRepository.SetPlayer2(sessionId, player2Id); await sessionRepository.SetPlayer2(sessionId, player2Id);
var player2Email = this.GetUsername(player2Id);
await gameHubContext.Emit_SessionJoined(sessionId); await gameHubContext.Emit_SessionJoined(sessionId);
return new OkResult(); return new OkResult();
} }