Пример #1
0
 public void CreateWithMatchmakerUI(MatchRequest request, IRealTimeMultiplayerListener listener)
 {
     PlayGamesPlatform.Instance.RealTime.CreateWithInvitationScreen(
         request.MinPlayers - 1,
         request.MaxPlayers - 1,
         (uint)GPGTypeConverter.ToGPGSVariant(request.Variant, MatchType.RealTime),
         new GPGRealTimeMultiplayerListener(listener, false));
 }
Пример #2
0
 public void CreateQuickMatch(MatchRequest request, IRealTimeMultiplayerListener listener)
 {
     PlayGamesPlatform.Instance.RealTime.CreateQuickGame(
         request.MinPlayers - 1,
         request.MaxPlayers - 1,
         (uint)GPGTypeConverter.ToGPGSVariant(request.Variant, MatchType.RealTime),
         new GPGRealTimeMultiplayerListener(listener, true));
 }
Пример #3
0
        public void CreateWithMatchmakerUI(MatchRequest request, Action cancelCallback, Action <string> errorCallback)
        {
            if (request == null)
            {
                throw new ArgumentNullException("Request can't be null.");
            }

            PlayGamesPlatform.Instance.TurnBased.CreateWithInvitationScreen(
                request.MinPlayers - 1,
                request.MaxPlayers - 1,
                (uint)GPGTypeConverter.ToGPGSVariant(request.Variant, MatchType.TurnBased),
                delegate(UIStatus uiBased, GPGS_TurnBasedMatch match)
            {
                if (uiBased == UIStatus.Valid)
                {
                    if (mRegisteredMatchDelegate == null)
                    {
                        Debug.LogWarning("The MatchDelegate has not been registered.");
                        return;
                    }

                    mRegisteredMatchDelegate(TurnBasedMatch.FromGPGSTurnBasedMatch(match), true, false);        // playerWantsToQuit doesn't occur on GPG.
                    return;
                }

                if (uiBased == UIStatus.UserClosedUI)
                {
                    if (cancelCallback != null)
                    {
                        cancelCallback();
                    }
                    return;
                }

                if (errorCallback != null)
                {
                    errorCallback(GetMessageFromUIStatus(uiBased));
                }
            }
                );
        }
Пример #4
0
        public void CreateQuickMatch(MatchRequest request, Action <bool, TurnBasedMatch> callback)
        {
            if (request == null)
            {
                throw new ArgumentNullException("Request can't be null.");
            }

            PlayGamesPlatform.Instance.TurnBased.CreateQuickMatch(
                request.MinPlayers - 1,
                request.MaxPlayers - 1,
                (uint)GPGTypeConverter.ToGPGSVariant(request.Variant, MatchType.TurnBased),
                (flag, match) =>
            {
                if (callback == null)
                {
                    return;
                }

                callback(flag, TurnBasedMatch.FromGPGSTurnBasedMatch(match));
            }
                );
        }