diff --git a/src/Prospect.Server.Api/Services/CloudScript/Functions/EnterMatchmaking.cs b/src/Prospect.Server.Api/Services/CloudScript/Functions/EnterMatchmaking.cs new file mode 100644 index 0000000..95cd0ae --- /dev/null +++ b/src/Prospect.Server.Api/Services/CloudScript/Functions/EnterMatchmaking.cs @@ -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 +{ + private readonly IHubContext _hubContext; + + public EnterMatchmakingFunction(IHubContext hubContext) + { + _hubContext = hubContext; + } + + public async Task 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, + }; + } +} \ No newline at end of file diff --git a/src/Prospect.Server.Api/Services/CloudScript/Models/FYEnterMatchAzureFunction.cs b/src/Prospect.Server.Api/Services/CloudScript/Models/FYEnterMatchAzureFunction.cs index 5c1267b..2e2be93 100644 --- a/src/Prospect.Server.Api/Services/CloudScript/Models/FYEnterMatchAzureFunction.cs +++ b/src/Prospect.Server.Api/Services/CloudScript/Models/FYEnterMatchAzureFunction.cs @@ -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; } +} \ No newline at end of file diff --git a/src/Prospect.Server.Api/Services/CloudScript/Models/FYEnterMatchAzureFunctionResult.cs b/src/Prospect.Server.Api/Services/CloudScript/Models/FYEnterMatchAzureFunctionResult.cs index 070aa0a..5ae3514 100644 --- a/src/Prospect.Server.Api/Services/CloudScript/Models/FYEnterMatchAzureFunctionResult.cs +++ b/src/Prospect.Server.Api/Services/CloudScript/Models/FYEnterMatchAzureFunctionResult.cs @@ -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; } +} \ No newline at end of file