Esempio n. 1
0
 public void TakeTurn(TurnBasedMatch match, byte[] data, string pendingParticipantId,
                      Action <bool> callback)
 {
     Logger.describe(data);
     callback = Callbacks.AsOnGameThreadCallback(callback);
     // Find the indicated match, take the turn if the match is:
     // a) Still present
     // b) Still of a matching version (i.e. there were no updates to it since the passed match
     //    was retrieved)
     // c) The indicated pending participant matches a participant in the match.
     FindEqualVersionMatchWithParticipant(match, pendingParticipantId, callback,
                                          (pendingParticipant, foundMatch) =>
     {
         // If we got here, the match and the participant are in a good state.
         mTurnBasedManager.TakeTurn(foundMatch, data, pendingParticipant,
                                    result =>
         {
             if (result.RequestSucceeded())
             {
                 callback(true);
             }
             else
             {
                 Logger.d("Taking turn failed: " + result.ResponseStatus());
                 callback(false);
             }
         });
     });
 }
 public void TakeTurn(GooglePlayGames.BasicApi.Multiplayer.TurnBasedMatch match, byte[] data, string pendingParticipantId, Action <bool> callback)
 {
     Logger.describe(data);
     callback = Callbacks.AsOnGameThreadCallback(callback);
     FindEqualVersionMatchWithParticipant(match, pendingParticipantId, callback, delegate(GooglePlayGames.Native.PInvoke.MultiplayerParticipant pendingParticipant, NativeTurnBasedMatch foundMatch)
     {
         mTurnBasedManager.TakeTurn(foundMatch, data, pendingParticipant, delegate(TurnBasedManager.TurnBasedMatchResponse result)
         {
             if (result.RequestSucceeded())
             {
                 callback(true);
             }
             else
             {
                 Logger.d("Taking turn failed: " + result.ResponseStatus());
                 callback(false);
             }
         });
     });
 }