Add EnterMatchmaking function for CB

This commit is contained in:
Yury
2025-03-25 18:53:52 +02:00
parent 31dbcfdb4f
commit 7766d47bda
3 changed files with 92 additions and 0 deletions
@@ -0,0 +1,38 @@
using System.Text.Json.Serialization;
using Microsoft.AspNetCore.SignalR;
using Prospect.Server.Api.Hubs;
using Prospect.Server.Api.Services.CloudScript.Models;
// Closed Beta Function
namespace Prospect.Server.Api.Services.CloudScript.Functions;
[CloudScriptFunction("EnterMatchmaking")]
public class EnterMatchmakingFunction : ICloudScriptFunction<FYEnterMatchAzureFunction, FYEnterMatchAzureFunctionResult>
{
private readonly IHubContext<CycleHub> _hubContext;
public EnterMatchmakingFunction(IHubContext<CycleHub> hubContext)
{
_hubContext = hubContext;
}
public async Task<FYEnterMatchAzureFunctionResult> ExecuteAsync(FYEnterMatchAzureFunction request)
{
//await _hubContext.Clients.All.SendAsync("OnSquadMatchmakingSuccess", new OnSquadMatchmakingSuccessMessage {
// Success = true,
// SessionID = request.MapName, // TODO: Need to implement TryGetCompleteSquadInfo and pass squad info
// SquadID = request.SquadId,
//});
return new FYEnterMatchAzureFunctionResult
{
Success = true,
ErrorMessage = "",
SingleplayerStation = true,
Address = request.MapName,
MaintenanceMode = false,
Port = 7777,
};
}
}
@@ -29,3 +29,30 @@ public class FYEnterMatchAzureFunction
[JsonPropertyName("loginNonce")]
public string LoginNonce { get; set; }
}
public class FYEnterMatchAzureFunctionCB
{
[JsonPropertyName("optimalRegion")]
public string? OptimalRegion { get; set; }
[JsonPropertyName("isMatch")]
public bool IsMatch { get; set; }
[JsonPropertyName("bypassMaintenanceMode")]
public bool BypassMaintenanceMode { get; set; }
[JsonPropertyName("debugOption")]
public string? DebugOption { get; set; }
[JsonPropertyName("mapName")]
public string? MapName { get; set; }
[JsonPropertyName("squad_id")]
public string? SquadId { get; set; }
[JsonPropertyName("purchaseInsuranceRequest")]
public FYPurchaseInventoryInsuranceRequest PurchaseInventoryInsurances { get; set; }
[JsonPropertyName("loginNonce")]
public string LoginNonce { get; set; }
}
@@ -21,3 +21,30 @@ public class FYEnterMatchmakingResult
[JsonPropertyName("errorMessage")]
public string ErrorMessage { get; set; }
}
public class FYEnterMatchAzureFunctionResult
{
[JsonPropertyName("success")]
public bool Success { get; set; }
[JsonPropertyName("address")]
public string? Address { get; set; }
[JsonPropertyName("errorMessage")]
public string? ErrorMessage { get; set; }
[JsonPropertyName("port")]
public int Port { get; set; }
[JsonPropertyName("sharedIndex")]
public int ShardIndex { get; set; }
[JsonPropertyName("singleplayerStation")]
public bool SingleplayerStation { get; set; }
[JsonPropertyName("maintenanceMode")]
public bool MaintenanceMode { get; set; }
[JsonPropertyName("sessionTimeJoinDelay")]
public float SessionTimeJoinDelay { get; set; }
}