76 lines
2.6 KiB
C#
76 lines
2.6 KiB
C#
using System.Buffers.Text;
|
|
using System.Text;
|
|
using MessagePack;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Http;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Serialization;
|
|
using SVSim.Database.Models;
|
|
using SVSim.Database.Repositories.Viewer;
|
|
using SVSim.EmulatedEntrypoint.Extensions;
|
|
using SVSim.EmulatedEntrypoint.Models.Dtos;
|
|
using SVSim.EmulatedEntrypoint.Models.Dtos.Requests;
|
|
using SVSim.EmulatedEntrypoint.Models.Dtos.Responses;
|
|
|
|
namespace SVSim.EmulatedEntrypoint.Controllers
|
|
{
|
|
[Route("api/[controller]")]
|
|
[ApiController]
|
|
public class CheckController : SVSimController
|
|
{
|
|
private readonly ILogger _logger;
|
|
private readonly IViewerRepository _viewerRepository;
|
|
|
|
public CheckController(ILogger<CheckController> logger, IViewerRepository viewerRepository)
|
|
{
|
|
_logger = logger;
|
|
_viewerRepository = viewerRepository;
|
|
}
|
|
|
|
[AllowAnonymous]
|
|
[HttpPost("special_title")]
|
|
public async Task<SpecialTitleCheckResponse> SpecialTitleCheck(SpecialTitleCheckRequest request)
|
|
{
|
|
int titleId = Random.Shared.Next(8, 33);
|
|
var res = new SpecialTitleCheckResponse
|
|
{
|
|
TitleImageId = titleId,
|
|
TitleSoundId = titleId
|
|
};
|
|
|
|
return res;
|
|
}
|
|
|
|
[HttpPost("game_start")]
|
|
public async Task<GameStartResponse> GameStart(GameStartRequest request)
|
|
{
|
|
Viewer? viewer = await _viewerRepository.GetViewerWithSocials(HttpContext.GetViewer().Id);
|
|
return new GameStartResponse()
|
|
{
|
|
IsSetTransitionPassword = true,
|
|
KorAuthorityId = default,
|
|
KorAuthorityState = default,
|
|
NowRank = new Dictionary<string, string>()
|
|
{
|
|
{ "1", "RankName_010" },
|
|
{ "2", "RankName_010" },
|
|
{ "4", "RankName_017" }
|
|
},
|
|
NowName = viewer.DisplayName,
|
|
PolicyState = default,
|
|
PolicyId = default,
|
|
NowTutorialStep = "100",
|
|
NowViewerId = viewer.Id,
|
|
TosId = default,
|
|
TosState = default,
|
|
TransitionAccountData = viewer.SocialAccountConnections.Select(sac => new TransitionAccountData
|
|
{
|
|
ConnectedViewerId = viewer.Id.ToString(),
|
|
SocialAccountId = sac.AccountId.ToString(),
|
|
SocialAccountType = ((int)sac.AccountType).ToString()
|
|
}).ToList()
|
|
};
|
|
}
|
|
}
|
|
} |