/// <summary> /// Lists multiplayer server sessions for a build. /// </summary> public static void ListMultiplayerServers(ListMultiplayerServersRequest request, Action <ListMultiplayerServersResponse> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null) { var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer; PlayFabHttp.MakeApiCall("/MultiplayerServer/ListMultiplayerServers", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context); }
/// <summary> /// Lists multiplayer server sessions for a build. /// </summary> public void ListMultiplayerServers(ListMultiplayerServersRequest request, Action <ListMultiplayerServersResponse> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null) { var context = (request == null ? null : request.AuthenticationContext) ?? authenticationContext; var callSettings = apiSettings ?? PlayFabSettings.staticSettings; if (!context.IsEntityLoggedIn()) { throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn, "Must be logged in to call this method"); } PlayFabHttp.MakeApiCall("/MultiplayerServer/ListMultiplayerServers", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this); }
private void GetPlayFabServers() { var getTitleEntityTokenRequest = new GetEntityTokenRequest(); GetEntityTokenRequest tokenRequest = new GetEntityTokenRequest(); PlayFabAuthenticationAPI.GetEntityToken(tokenRequest, TokenResponseSuccess, Error, null, null); ListMultiplayerServersRequest request = new ListMultiplayerServersRequest(); //request.BuildId = MMOClientInstance.Singleton.PlayFabManager.BuildIdKey; //request.Region = MMOClientInstance.Singleton.PlayFabManager.playFabRegion.ToString(); PlayFabMultiplayerAPI.ListMultiplayerServers(request, GetServerList, Error, null, null); }
/// <summary> /// Retrieves a list of multiplayer servers /// </summary> /// <returns> /// A list container of running multiplayer server information /// </returns> public async Task <List <MultiplayerServerSummary> > QueryMultiplayerServers(string buildID, AzureRegion region) { // We must be authenticated to make this call if (IsAuthenticated()) { ListMultiplayerServersRequest request = new ListMultiplayerServersRequest(); request.BuildId = buildID; request.Region = region; var task = PlayFab.PlayFabMultiplayerAPI.ListMultiplayerServersAsync(request); var resp = await task; return(resp.Result.MultiplayerServerSummaries); } return(null); }
/// <summary> /// Lists multiplayer server sessions for a build. /// </summary> public static void ListMultiplayerServers(ListMultiplayerServersRequest request, Action <ListMultiplayerServersResponse> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null) { PlayFabHttp.MakeApiCall("/MultiplayerServer/ListMultiplayerServers", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders); }
/// <summary> /// Lists multiplayer server sessions for a build. /// </summary> public static async Task <PlayFabResult <ListMultiplayerServersResponse> > ListMultiplayerServersAsync(ListMultiplayerServersRequest request, object customData = null, Dictionary <string, string> extraHeaders = null) { if (PlayFabSettings.EntityToken == null) { throw new PlayFabException(PlayFabExceptionCode.EntityTokenNotSet, "Must call GetEntityToken before calling this method"); } var httpResult = await PlayFabHttp.DoPost("/MultiplayerServer/ListMultiplayerServers", request, "X-EntityToken", PlayFabSettings.EntityToken, extraHeaders); if (httpResult is PlayFabError) { var error = (PlayFabError)httpResult; PlayFabSettings.GlobalErrorHandler?.Invoke(error); return(new PlayFabResult <ListMultiplayerServersResponse> { Error = error, CustomData = customData }); } var resultRawJson = (string)httpResult; var resultData = PluginManager.GetPlugin <ISerializerPlugin>(PluginContract.PlayFab_Serializer).DeserializeObject <PlayFabJsonSuccess <ListMultiplayerServersResponse> >(resultRawJson); var result = resultData.data; return(new PlayFabResult <ListMultiplayerServersResponse> { Result = result, CustomData = customData }); }