/// <summary> /// Informs the PlayFab game server hosting service that the indicated user has left the Game Server Instance specified /// </summary> public void PlayerLeft(PlayerLeftRequest request, Action <PlayerLeftResponse> 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; PlayFabHttp.MakeApiCall("/Matchmaker/PlayerLeft", request, AuthType.DevSecretKey, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this); }
/// <summary> /// Informs the PlayFab game server hosting service that the indicated user has left the Game Server Instance specified /// </summary> public async Task <PlayFabResult <PlayerLeftResponse> > PlayerLeftAsync(PlayerLeftRequest request, object customData = null, Dictionary <string, string> extraHeaders = null) { await new PlayFabUtil.SynchronizationContextRemover(); var requestContext = request?.AuthenticationContext ?? authenticationContext; var requestSettings = apiSettings ?? PlayFabSettings.staticSettings; if (requestSettings.DeveloperSecretKey == null) { throw new PlayFabException(PlayFabExceptionCode.DeveloperKeyNotSet, "DeveloperSecretKey must be set in your local or global settings to call this method"); } var httpResult = await PlayFabHttp.DoPost("/Matchmaker/PlayerLeft", request, "X-SecretKey", requestSettings.DeveloperSecretKey, extraHeaders, requestSettings); if (httpResult is PlayFabError) { var error = (PlayFabError)httpResult; PlayFabSettings.GlobalErrorHandler?.Invoke(error); return(new PlayFabResult <PlayerLeftResponse> { Error = error, CustomData = customData }); } var resultRawJson = (string)httpResult; var resultData = PluginManager.GetPlugin <ISerializerPlugin>(PluginContract.PlayFab_Serializer).DeserializeObject <PlayFabJsonSuccess <PlayerLeftResponse> >(resultRawJson); var result = resultData.data; return(new PlayFabResult <PlayerLeftResponse> { Result = result, CustomData = customData }); }
internal static void NotifyPlayerLeft(int id) { try { TcpClient client = new TcpClient() { SendTimeout = 5, ReceiveTimeout = 5 }; client.Connect(MasterServerAddress, masterServerPort); using (Stream stream = client.GetStream()) { var obj = new PlayerLeftRequest() { serverPort = Globals.listenPort, userId = id }; var buffer = new byte[4096]; var xs = new XmlSerializer(typeof(PlayerLeftRequest)); xs.Serialize(new MemoryStream(buffer), obj); stream.Write(buffer, 0, buffer.Length); } } catch (Exception e) { Debug.LogError("Error sending PlayerLeft notification with the Master Server:\n" + e.ToString()); } }
/// <summary> /// Informs the PlayFab game server hosting service that the indicated user has left the Game Server Instance specified /// </summary> public async Task <PlayFabResult <PlayerLeftResponse> > PlayerLeftAsync(PlayerLeftRequest request, object customData = null, Dictionary <string, string> extraHeaders = null) { var developerSecretKey = request.AuthenticationContext?.DeveloperSecretKey ?? (authenticationContext?.DeveloperSecretKey ?? PlayFabSettings.DeveloperSecretKey); if (developerSecretKey == null) { throw new PlayFabException(PlayFabExceptionCode.DeveloperKeyNotSet, "DeveloperSecretKey is not found in Request, Server Instance or PlayFabSettings"); } var httpResult = await PlayFabHttp.DoPost("/Matchmaker/PlayerLeft", request, "X-SecretKey", developerSecretKey, extraHeaders, apiSettings); if (httpResult is PlayFabError) { var error = (PlayFabError)httpResult; PlayFabSettings.GlobalErrorHandler?.Invoke(error); return(new PlayFabResult <PlayerLeftResponse> { Error = error, CustomData = customData }); } var resultRawJson = (string)httpResult; var resultData = PluginManager.GetPlugin <ISerializerPlugin>(PluginContract.PlayFab_Serializer).DeserializeObject <PlayFabJsonSuccess <PlayerLeftResponse> >(resultRawJson); var result = resultData.data; return(new PlayFabResult <PlayerLeftResponse> { Result = result, CustomData = customData }); }
/// <summary> /// Informs the PlayFab game server hosting service that the indicated user has left the Game Server Instance specified /// </summary> public static void PlayerLeft(PlayerLeftRequest request, Action <PlayerLeftResponse> resultCallback, Action <PlayFabError> errorCallback, object customData = null) { if (PlayFabSettings.DeveloperSecretKey == null) { throw new Exception("Must have PlayFabSettings.DeveloperSecretKey set to call this method"); } PlayFabHttp.MakeApiCall("/Matchmaker/PlayerLeft", request, AuthType.DevSecretKey, resultCallback, errorCallback, customData); }
/// <summary> /// Informs the PlayFab game server hosting service that the indicated user has left the Game Server Instance specified /// </summary> public static void PlayerLeft(PlayerLeftRequest request, Action <PlayerLeftResponse> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null) { if (PlayFabSettings.DeveloperSecretKey == null) { throw new PlayFabException(PlayFabExceptionCode.DeveloperKeyNotSet, "Must have PlayFabSettings.DeveloperSecretKey set to call this method"); } PlayFabHttp.MakeApiCall("/Matchmaker/PlayerLeft", request, AuthType.DevSecretKey, resultCallback, errorCallback, customData, extraHeaders); }
internal void PlayerLeft() { PlayerLeftRequest request = new PlayerLeftRequest { room_id = roomId, user_id = int.Parse(GameVariables.userId), }; SocketConnectionManager.GetInstance.SendSocketRequest(GameVariables.SocketRequestType.declare, request); }
/// <summary> /// Informs the PlayFab game server hosting service that the indicated user has left the Game Server Instance specified /// </summary> public void PlayerLeft(PlayerLeftRequest request, Action <PlayerLeftResponse> 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 (string.IsNullOrEmpty(callSettings.DeveloperSecretKey)) { throw new PlayFabException(PlayFabExceptionCode.DeveloperKeyNotSet, "Must set DeveloperSecretKey in settings to call this method"); } PlayFabHttp.MakeApiCall("/Matchmaker/PlayerLeft", request, AuthType.DevSecretKey, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this); }
internal void LeaveSocketRoom() { if (GamePlayManager.GetInstance.isJoinedRoom) { PlayerLeftRequest playerLeftRequest = new PlayerLeftRequest { room_id = GamePlayManager.GetInstance.roomId, user_id = int.Parse(GameVariables.userId), }; SocketConnectionManager.GetInstance.SendSocketRequest(GameVariables.SocketRequestType.playerLeft, playerLeftRequest); GamePlayManager.GetInstance.isJoinedRoom = false; } SocketConnectionManager.GetInstance.DisconnectSocket(); }
/// <summary> /// Informs the PlayFab game server hosting service that the indicated user has left the Game Server Instance specified /// </summary> public static void PlayerLeft(PlayerLeftRequest request, ProcessApiCallback <PlayerLeftResponse> resultCallback, ErrorCallback errorCallback, object customData = null) { if (PlayFabSettings.DeveloperSecretKey == null) { throw new Exception("Must have PlayFabSettings.DeveloperSecretKey set to call this method"); } string serializedJson = SimpleJson.SerializeObject(request, Util.ApiSerializerStrategy); Action <CallRequestContainer> callback = delegate(CallRequestContainer requestContainer) { ResultContainer <PlayerLeftResponse> .HandleResults(requestContainer, resultCallback, errorCallback, null); }; PlayFabHTTP.Post("/Matchmaker/PlayerLeft", serializedJson, "X-SecretKey", PlayFabSettings.DeveloperSecretKey, callback, request, customData); }
/// <summary> /// Informs the PlayFab game server hosting service that the indicated user has left the Game Server Instance specified /// </summary> /// <param name="LobbyId">Unique identifier of the Game Server Instance the user is leaving. This must be a Game Server Instance started with the Matchmaker/StartGame API. (Required)</param> /// <param name="PlayFabId">PlayFab unique identifier for the player leaving. (Required)</param> public static Task <PlayerLeftResponse> PlayerLeft(string LobbyId, string PlayFabId, PlayFabAuthenticationContext customAuthContext = null, object customData = null, Dictionary <string, string> extraHeaders = null) { PlayerLeftRequest request = new PlayerLeftRequest() { LobbyId = LobbyId, PlayFabId = PlayFabId, }; var context = GetContext(customAuthContext); return(PlayFabHttp.MakeApiCallAsync <PlayerLeftResponse>("/Matchmaker/PlayerLeft", request, AuthType.DevSecretKey, customData, extraHeaders, context)); }
/// <summary> /// Informs the PlayFab game server hosting service that the indicated user has left the Game Server Instance specified /// </summary> public static void PlayerLeft(PlayerLeftRequest request, PlayerLeftCallback resultCallback, ErrorCallback errorCallback, object customData = null) { if (PlayFabSettings.DeveloperSecretKey == null) { throw new Exception("Must have PlayFabSettings.DeveloperSecretKey set to call this method"); } string serializedJson = JsonConvert.SerializeObject(request, Util.JsonFormatting, Util.JsonSettings); Action <CallRequestContainer> callback = delegate(CallRequestContainer requestContainer) { PlayerLeftResponse result = ResultContainer <PlayerLeftResponse> .HandleResults(requestContainer, resultCallback, errorCallback); if (result != null) { } }; PlayFabHTTP.Post("/Matchmaker/PlayerLeft", serializedJson, "X-SecretKey", PlayFabSettings.DeveloperSecretKey, callback, request, customData); }
/// <summary> /// Informs the PlayFab game server hosting service that the indicated user has left the Game Server Instance specified /// </summary> public static void PlayerLeft(PlayerLeftRequest request, Action <PlayerLeftResponse> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null) { PlayFabHttp.MakeApiCall("/Matchmaker/PlayerLeft", request, AuthType.DevSecretKey, resultCallback, errorCallback, customData, extraHeaders); }
/// <summary> /// Informs the PlayFab game server hosting service that the indicated user has left the Game Server Instance specified /// </summary> public static async Task <PlayFabResult <PlayerLeftResponse> > PlayerLeftAsync(PlayerLeftRequest request, object customData = null) { if (PlayFabSettings.DeveloperSecretKey == null) { throw new Exception("Must have PlayFabSettings.DeveloperSecretKey set to call this method"); } var httpResult = await PlayFabHttp.DoPost("/Matchmaker/PlayerLeft", request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey); if (httpResult is PlayFabError) { var error = (PlayFabError)httpResult; if (PlayFabSettings.GlobalErrorHandler != null) { PlayFabSettings.GlobalErrorHandler(error); } return(new PlayFabResult <PlayerLeftResponse> { Error = error, CustomData = customData }); } var resultRawJson = (string)httpResult; var resultData = JsonWrapper.DeserializeObject <PlayFabJsonSuccess <PlayerLeftResponse> >(resultRawJson); var result = resultData.data; return(new PlayFabResult <PlayerLeftResponse> { Result = result, CustomData = customData }); }
/// <summary> /// Informs the PlayFab game server hosting service that the indicated user has left the Game Server Instance specified /// </summary> public static async Task <PlayFabResult <PlayerLeftResponse> > PlayerLeftAsync(PlayerLeftRequest request, object customData = null, Dictionary <string, string> extraHeaders = null) { if (PlayFabSettings.DeveloperSecretKey == null) { throw new PlayFabException(PlayFabExceptionCode.DeveloperKeyNotSet, "Must have PlayFabSettings.DeveloperSecretKey set to call this method"); } var httpResult = await PlayFabHttp.DoPost("/Matchmaker/PlayerLeft", request, "X-SecretKey", PlayFabSettings.DeveloperSecretKey, extraHeaders); if (httpResult is PlayFabError) { var error = (PlayFabError)httpResult; PlayFabSettings.GlobalErrorHandler?.Invoke(error); return(new PlayFabResult <PlayerLeftResponse> { Error = error, CustomData = customData }); } var resultRawJson = (string)httpResult; var resultData = PluginManager.GetPlugin <ISerializerPlugin>(PluginContract.PlayFab_Serializer).DeserializeObject <PlayFabJsonSuccess <PlayerLeftResponse> >(resultRawJson); var result = resultData.data; return(new PlayFabResult <PlayerLeftResponse> { Result = result, CustomData = customData }); }