private void TbmpApiCall(string simpleDesc, string methodName, Action <bool> callback, Action <bool, TurnBasedMatch> tbmpCallback, params object[] args)
 {
     this.mClient.CallClientApi(simpleDesc, delegate
     {
         AndroidTbmpClient.ResultProxy resultProxy = new AndroidTbmpClient.ResultProxy(this, methodName);
         if (callback != null)
         {
             resultProxy.SetSuccessCallback(callback);
         }
         if (tbmpCallback != null)
         {
             resultProxy.SetMatchCallback(tbmpCallback);
         }
         this.mClient.GHManager.CallGmsApiWithResult("games.Games", "TurnBasedMultiplayer", methodName, resultProxy, args);
     }, delegate(bool success)
     {
         if (!success)
         {
             Logger.w("Failed to " + simpleDesc + ": client disconnected.");
             if (callback != null)
             {
                 callback(false);
             }
         }
     });
 }
 public void CreateQuickMatch(int minOpponents, int maxOpponents, int variant, Action <bool, TurnBasedMatch> callback)
 {
     Logger.d(string.Format("AndroidTbmpClient.CreateQuickMatch, opponents {0}-{1}, var {2}", minOpponents, maxOpponents, variant));
     this.mClient.CallClientApi("tbmp create quick game", delegate
     {
         AndroidTbmpClient.ResultProxy resultProxy = new AndroidTbmpClient.ResultProxy(this, "createMatch");
         resultProxy.SetMatchCallback(callback);
         AndroidJavaClass @class = JavaUtil.GetClass("com.google.example.games.pluginsupport.TbmpUtils");
         using (AndroidJavaObject androidJavaObject = @class.CallStatic <AndroidJavaObject>("createQuickMatch", new object[]
         {
             this.mClient.GHManager.GetApiClient(),
             minOpponents,
             maxOpponents,
             variant
         }))
         {
             androidJavaObject.Call("setResultCallback", new object[]
             {
                 resultProxy
             });
         }
     }, delegate(bool success)
     {
         if (!success)
         {
             Logger.w("Failed to create tbmp quick match: client disconnected.");
             if (callback != null)
             {
                 callback(false, null);
             }
         }
     });
 }
 private void OnSelectOpponentsResult(bool success, AndroidJavaObject opponents, bool hasAutoMatch, AndroidJavaObject autoMatchCriteria, Action <bool, TurnBasedMatch> callback, int variant)
 {
     Logger.d(string.Concat(new object[]
     {
         "AndroidTbmpClient.OnSelectOpponentsResult, success=",
         success,
         ", hasAutoMatch=",
         hasAutoMatch
     }));
     if (!success)
     {
         Logger.w("Tbmp select opponents dialog terminated with failure.");
         if (callback != null)
         {
             Logger.d("Reporting select-opponents dialog failure to callback.");
             PlayGamesHelperObject.RunOnGameThread(delegate
             {
                 callback(false, null);
             });
         }
         return;
     }
     Logger.d("Creating TBMP match from opponents received from dialog.");
     this.mClient.CallClientApi("create match w/ opponents from dialog", delegate
     {
         AndroidTbmpClient.ResultProxy resultProxy = new AndroidTbmpClient.ResultProxy(this, "createMatch");
         resultProxy.SetMatchCallback(callback);
         AndroidJavaClass @class = JavaUtil.GetClass("com.google.example.games.pluginsupport.TbmpUtils");
         using (AndroidJavaObject androidJavaObject = @class.CallStatic <AndroidJavaObject>("create", new object[]
         {
             this.mClient.GHManager.GetApiClient(),
             opponents,
             variant,
             (!hasAutoMatch) ? null : autoMatchCriteria
         }))
         {
             androidJavaObject.Call("setResultCallback", new object[]
             {
                 resultProxy
             });
         }
     }, delegate(bool ok)
     {
         if (!ok)
         {
             Logger.w("Failed to create match w/ opponents from dialog: client disconnected.");
             if (callback != null)
             {
                 callback(false, null);
             }
         }
     });
 }