Beispiel #1
0
 /// <summary>
 /// Raises the try match error event.
 /// </summary>
 /// <param name="response">Response.</param>
 private void OnTryMatchError(MatchmakingResponse response)
 {
     foreach (SparkView view in sparkViews)
     {
         view.SendEvent_TryMatchError(response);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Sends the event try match error.
 /// </summary>
 /// <param name="response">Response.</param>
 public void SendEvent_TryMatchError(MatchmakingResponse response)
 {
     foreach (SparkBehaviour behaviour in ObservedBehaviours)
     {
         behaviour.Call("OnTryMatchError", response);
     }
 }
 void FindMatchCallback(MatchmakingResponse response)
 {
     if (response.HasErrors)
     {
         Debug.Log("GameSparksManager: Matchmaking result: Error: " + response.Errors.JSON);
         OnMatchResult(false);
     }
 }
 public void OnMatchmakingError(MatchmakingResponse response)
 {
     //UnblockInput();
     Debug.Log("Matchmaking Error");
     if (ThrottleHandler.IsRequestThrottled(response.Errors.JSON))
     {
         Invoke("AttemptSendMatchRequest", ThrottleHandler.GetRandomTime());
     }
 }
Beispiel #5
0
 public void OnMatchmakingError(MatchmakingResponse response)
 {
     //UnblockInput();
     Debug.Log("Matchmaking Error");
     if (ThrottleHandler.IsRequestThrottled(response.Errors.JSON))
     {
         var request = lastMatchmakingRequest;
         request.Send(OnMatchmakingSuccess, OnMatchmakingError);
     }
 }
        public async Task ResolveMatch(IMatchResolverContext matchCtx)
        {
            try
            {
                //_logger.Log(LogLevel.Trace, "matchmaking.resolver", "Resolving a successful match.", new { });


                var matchData = (MatchData)matchCtx.Match.CustomData;
                var response  = new MatchmakingResponse();

                response.gameId = "game-" + matchCtx.Match.Id;

                response.team1.AddRange(GetPlayers(matchCtx.Match, matchCtx.Match.Teams[0]));
                response.team2.AddRange(GetPlayers(matchCtx.Match, matchCtx.Match.Teams[1]));

                //_logger.Log(LogLevel.Trace, "matchmaking.resolver", $"sending matchmaking response", response.ForLog());

                var managementClient = await _management.GetApplicationClient();

                var metadata = Newtonsoft.Json.Linq.JObject.FromObject(new { gameSession = new { userIds = matchCtx.Match.AllPlayers.Select(p => p.UserId).ToList() } });


                await managementClient.CreateScene(
                    response.gameId,
                    global::Server.App.GAMESESSION_SCENE_TYPE,
                    false,
                    metadata,
                    false);

                _logger.Log(LogLevel.Trace, "matchmaking resolver", $"Created scene for game {response.gameId}",
                            new {
                    id       = response.gameId,
                    template = global::Server.App.GAMESESSION_SCENE_TYPE,
                    isPublic = false,
                    metadata,
                    isPersistent = false
                });
                _logger.Log(LogLevel.Trace, "matchmaking.resolver", "Match found and resolved.", response);

                matchCtx.ResolutionAction = (writerCtx => writerCtx.WriteObjectToStream(response));
            }
            catch (Exception ex)
            {
                _logger.Log(LogLevel.Error, "matchmaking.resolver", "An exception occurred while resolving a successful match.", ex);
                throw;
            }
        }
Beispiel #7
0
 private void OnMatchmakingResponseSuccess(MatchmakingResponse response)
 {
     Debug.Log("OnMatchmakingResponseSuccess");
 }
Beispiel #8
0
 public void OnMatchmakingSuccess(MatchmakingResponse response)
 {
     //UnblockInput();
     Debug.Log("Matchmaking Success");
 }
Beispiel #9
0
 private void OnTryMatchError(MatchmakingResponse response)
 {
 }
Beispiel #10
0
 private void OnTryMatchSuccess(MatchmakingResponse response)
 {
 }
Beispiel #11
0
 public void OnMatchmakingError(MatchmakingResponse response)
 {
     //UnblockInput();
     Debug.Log("Matchmaking Error");
 }
Beispiel #12
0
 private void OnMatchmakingSuccess(MatchmakingResponse response)
 {
     //LoadingManager.Instance.LoadNextScene();
     //SceneManager.LoadScene("GamePlay");
 }
Beispiel #13
0
 private void OnMatchmakingError(MatchmakingResponse response)
 {
     UnblockInput();
     Debug.Log(response.Errors.JSON.ToString());
 }
Beispiel #14
0
 void OnMatchMakingError(MatchmakingResponse response)
 {
     UnblockInput();
     textMatchFindMessage.text = response.JSONString;
 }
Beispiel #15
0
 void OnMatchMakingSuccess(MatchmakingResponse response)
 {
     textMatchFindMessage.text = response.JSONString;
 }
Beispiel #16
0
 private void OnMatchmakingError(MatchmakingResponse response)
 {
     UnblockInput();
     Debug.Log("Matching error response: " + response.JSONString);
 }
Beispiel #17
0
 private void OnMatchmakingSuccess(MatchmakingResponse response)
 {
     Debug.Log(response.JSONString);
 }
Beispiel #18
0
 private void OnMatchmakingResponseError(MatchmakingResponse response)
 {
     Debug.Log("OnMatchmakingResponseError");
     MatchNotFoundEvent.Invoke();
 }
 private void OnTryMatchSuccess(MatchmakingResponse response)
 {
     Debug.Log("On try match success.");
 }
 private void OnTryMatchError(MatchmakingResponse response)
 {
     Debug.Log("On try match error.");
 }