Exemple #1
0
        public void CreateWithInvitationScreen(uint minOpponents, uint maxOpponents, uint variant,
                                               Action <bool, TurnBasedMatch> callback)
        {
            callback = Callbacks.AsOnGameThreadCallback(callback);
            mTurnBasedManager.ShowPlayerSelectUI(minOpponents, maxOpponents, true, result => {
                if (result.Status() != GooglePlayGames.Native.Cwrapper.CommonErrorStatus.UIStatus.VALID)
                {
                    callback(false, null);
                }

                using (var configBuilder = TurnBasedMatchConfigBuilder.Create()) {
                    configBuilder.PopulateFromUIResponse(result);
                    using (var config = configBuilder.Build()) {
                        mTurnBasedManager.CreateMatch(config, BridgeMatchToUserCallback(callback));
                    }
                }
            });
        }
 public void CreateWithInvitationScreen(uint minOpponents, uint maxOpponents, uint variant, Action <UIStatus, GooglePlayGames.BasicApi.Multiplayer.TurnBasedMatch> callback)
 {
     callback = Callbacks.AsOnGameThreadCallback(callback);
     mTurnBasedManager.ShowPlayerSelectUI(minOpponents, maxOpponents, true, delegate(PlayerSelectUIResponse result)
     {
         if (result.Status() != CommonErrorStatus.UIStatus.VALID)
         {
             callback((UIStatus)result.Status(), null);
         }
         else
         {
             using (GooglePlayGames.Native.PInvoke.TurnBasedMatchConfigBuilder turnBasedMatchConfigBuilder = GooglePlayGames.Native.PInvoke.TurnBasedMatchConfigBuilder.Create())
             {
                 turnBasedMatchConfigBuilder.PopulateFromUIResponse(result).SetVariant(variant);
                 using (GooglePlayGames.Native.PInvoke.TurnBasedMatchConfig config = turnBasedMatchConfigBuilder.Build())
                 {
                     mTurnBasedManager.CreateMatch(config, BridgeMatchToUserCallback(callback));
                 }
             }
         }
     });
 }