feat(arena-tk2): do_matching mints battle via IMatchingBridge, returns 3004
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using SVSim.BattleNode.Bridge;
|
||||
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests.ArenaTwoPick;
|
||||
using SVSim.EmulatedEntrypoint.Models.Dtos.Responses.ArenaTwoPick;
|
||||
using SVSim.EmulatedEntrypoint.Services;
|
||||
@@ -9,13 +10,25 @@ namespace SVSim.EmulatedEntrypoint.Controllers;
|
||||
public class ArenaTwoPickBattleController : SVSimController
|
||||
{
|
||||
private readonly IArenaTwoPickService _svc;
|
||||
public ArenaTwoPickBattleController(IArenaTwoPickService svc) => _svc = svc;
|
||||
private readonly IMatchingBridge _matching;
|
||||
|
||||
public ArenaTwoPickBattleController(IArenaTwoPickService svc, IMatchingBridge matching)
|
||||
{
|
||||
_svc = svc;
|
||||
_matching = matching;
|
||||
}
|
||||
|
||||
[HttpPost("do_matching")]
|
||||
public IActionResult DoMatching([FromBody] DoMatchingRequest req)
|
||||
{
|
||||
if (!TryGetViewerId(out _)) return Unauthorized();
|
||||
return Ok(new DoMatchingResponseDto());
|
||||
if (!TryGetViewerId(out var vid)) return Unauthorized();
|
||||
var match = _matching.RegisterPendingBattle(vid);
|
||||
return Ok(new DoMatchingResponseDto
|
||||
{
|
||||
MatchingState = 3004,
|
||||
BattleId = match.BattleId,
|
||||
NodeServerUrl = match.NodeServerUrl,
|
||||
});
|
||||
}
|
||||
|
||||
[HttpPost("finish")]
|
||||
|
||||
Reference in New Issue
Block a user