コード例 #1
0
    private void OnTicketCreated(CreateMatchmakingTicketResult res)
    {
        ticketId = res.TicketId;
        leaveBtn.SetActive(true);

        PlayfabUtils.OnSuccess(feedbackText, "Match Ticket Created!");
        pollTicketCoroutine = StartCoroutine(PollTicket());
    }
コード例 #2
0
    private void OnMatchmakingTicketCreated(CreateMatchmakingTicketResult result)
    {
        ticketId            = result.TicketId;
        pollTicketCoroutine = StartCoroutine(PollTicket(result.TicketId));

        cancelMatchButton.SetActive(true);
        queueStatusText.text = "Player Found...";
    }
コード例 #3
0
    private void OnMatchmakingTicketCreated(CreateMatchmakingTicketResult createMatchmakingTicketResult)
    {
        // Now we need to start polling the ticket periodically, using a coroutine
        StartCoroutine(PollMatchmakingTicket(createMatchmakingTicketResult.TicketId));

        // Display progress in UI
        UIManager.singleton.DisplayNetworkMessage("Matchmaking request sent");
    }
コード例 #4
0
ファイル: Program.cs プロジェクト: PlayFab/MpsSamples
        private static async Task CreateMatchmakeTicket(Player player, string mmQueueName)
        {
            var createRequest = new CreateMatchmakingTicketRequest
            {
                QueueName          = mmQueueName,
                GiveUpAfterSeconds = 15,
                Creator            = new MatchmakingPlayer {
                    Entity = new PlayFab.MultiplayerModels.EntityKey {
                        Id = player.context.EntityId, Type = player.context.EntityType
                    }
                }                                                                                                                                                       // Why isn't this just the caller?
            };
            PlayFabResult <CreateMatchmakingTicketResult> ticketResult = await player.mpApi.CreateMatchmakingTicketAsync(createRequest);

            CreateMatchmakingTicketResult ticket = VerifyPlayFabCall(ticketResult, "Failed to create matchmake ticket");

            player.mmTicketId = ticket.TicketId;
        }
コード例 #5
0
    /*
     * public void CreateMatch()
     * {
     *  PlayFabMultiplayerAPI.CreateMatchmakingTicket(
     *      new CreateMatchmakingTicketRequest
     *      {
     *          // The ticket creator specifies their own player attributes.
     *          Creator = new MatchmakingPlayer
     *          {
     *              Entity = new EntityKey
     *              {
     *                  Id = _loginHandler.player.PlayFabId,
     *                  Type = "title_player_account",
     *              },
     *
     *              // Here we specify the creator's attributes.
     *              Attributes = new MatchmakingPlayerAttributes
     *              {
     *                  DataObject = new
     *                  {
     *                      Skill = 24.4
     *                  },
     *              },
     *          },
     *
     *          // Cancel matchmaking if a match is not found after 120 seconds.
     *          GiveUpAfterSeconds = 120,
     *
     *          // The name of the queue to submit the ticket into.
     *          QueueName = "myqueue",
     *      },
     *
     *      // Callbacks for handling success and error.
     *      this.OnMatchmakingTicketCreated,
     *      this.OnMatchmakingError);
     *
     *
     * }
     */


    //Ticket creation success callback
    public void OnMatchmakingTicketCreated(CreateMatchmakingTicketResult result)
    {
        Debug.Log("Success creating ticket with id : ");
        Debug.Log(result.TicketId);
    }