private static Invitation.InvType ToInvType(Types.MultiplayerInvitationType invitationType) { switch (invitationType) { case Types.MultiplayerInvitationType.REAL_TIME: return Invitation.InvType.RealTime; case Types.MultiplayerInvitationType.TURN_BASED: return Invitation.InvType.TurnBased; default: Logger.d("Found unknown invitation type: " + invitationType); return Invitation.InvType.Unknown; } }
private static void InternalAuthStartedCallback(Types.AuthOperation op, IntPtr data) { AuthStartedCallback callback = Callbacks.IntPtrToPermanentCallback<AuthStartedCallback>(data); try { if (callback != null) { callback(op); } } catch (Exception e) { Logger.e("Error encountered executing InternalAuthStartedCallback. " + "Smothering to avoid passing exception into Native: " + e); } }
private static void InternalOnTurnBasedMatchEventCallback(Types.MultiplayerEvent eventType, string matchId, IntPtr match, IntPtr userData) { var callback = Callbacks.IntPtrToPermanentCallback <Action<Types.MultiplayerEvent, string, NativeTurnBasedMatch>>(userData); using (var nativeMatch = NativeTurnBasedMatch.FromPointer(match)) { try { if (callback != null) { callback(eventType, matchId, nativeMatch); } } catch (Exception e) { Logger.e("Error encountered executing InternalOnTurnBasedMatchEventCallback. " + "Smothering to avoid passing exception into Native: " + e); } } }
private static void InternalAuthFinishedCallback(Types.AuthOperation op, Status.AuthStatus status, IntPtr data) { AuthFinishedCallback callback = Callbacks.IntPtrToPermanentCallback<AuthFinishedCallback>(data); if (callback == null) { return; } try { callback(op, status); } catch (Exception e) { Logger.e("Error encountered executing InternalAuthFinishedCallback. " + "Smothering to avoid passing exception into Native: " + e); } }
private static void InternalOnMultiplayerInvitationEventCallback( Types.MultiplayerEvent eventType, string matchId, IntPtr match, IntPtr userData) { var callback = Callbacks.IntPtrToPermanentCallback <Action<Types.MultiplayerEvent, string, MultiplayerInvitation>>(userData); using (var nativeInvitation = MultiplayerInvitation.FromPointer(match)) { try { if (callback != null) { callback(eventType, matchId, nativeInvitation); } } catch (Exception e) { GooglePlayGames.OurUtils.Logger.e("Error encountered executing " + "InternalOnMultiplayerInvitationEventCallback. " + "Smothering to avoid passing exception into Native: " + e); } } }
internal ParticipantResults WithResult(string participantId, uint placing, Types.MatchResult result) { return new ParticipantResults(C.ParticipantResults_WithResult( SelfPtr(), participantId, placing, result)); }
private static TBM.MatchStatus ToMatchStatus( string pendingParticipantId, Types.MatchStatus status) { switch (status) { case Types.MatchStatus.CANCELED: return TBM.MatchStatus.Cancelled; case Types.MatchStatus.COMPLETED: return TBM.MatchStatus.Complete; case Types.MatchStatus.EXPIRED: return TBM.MatchStatus.Expired; case Types.MatchStatus.INVITED: return TBM.MatchStatus.Active; case Types.MatchStatus.MY_TURN: return TBM.MatchStatus.Active; case Types.MatchStatus.PENDING_COMPLETION: return TBM.MatchStatus.Complete; case Types.MatchStatus.THEIR_TURN: // If it's their turn, but we don't have a valid pending participant, it's because // we're still automatching against that participant. return pendingParticipantId == null ? TBM.MatchStatus.AutoMatching : TBM.MatchStatus.Active; default: return TBM.MatchStatus.Unknown; } }
private static TBM.MatchTurnStatus ToTurnStatus(Types.MatchStatus status) { switch (status) { case Types.MatchStatus.CANCELED: return TBM.MatchTurnStatus.Complete; case Types.MatchStatus.COMPLETED: return TBM.MatchTurnStatus.Complete; case Types.MatchStatus.EXPIRED: return TBM.MatchTurnStatus.Complete; case Types.MatchStatus.INVITED: return TBM.MatchTurnStatus.Invited; case Types.MatchStatus.MY_TURN: return TBM.MatchTurnStatus.MyTurn; case Types.MatchStatus.PENDING_COMPLETION: return TBM.MatchTurnStatus.Complete; case Types.MatchStatus.THEIR_TURN: return TBM.MatchTurnStatus.TheirTurn; default: return TBM.MatchTurnStatus.Unknown; } }