public static MatchType ToEMMatchType(this GPGS_Invitation inv) { switch (inv.InvitationType()) { case GPGS_InvType.RealTime: return(MatchType.RealTime); case GPGS_InvType.TurnBased: return(MatchType.TurnBased); case GPGS_InvType.Unknown: default: return(MatchType.Unknown); } }
/// <summary> /// Invokes consumer invitation delegate if one is registered. Otherwise /// stores this handler in a queue so that it can be repeated later when a consumer /// delegate is registered. When being repeated, it also runs on main thread. /// </summary> /// <param name="gpgsInv">Gpgs inv.</param> /// <param name="shouldAutoAccept">If set to <c>true</c> should auto accept.</param> private static void OnGPGSInvitationReceived(GPGS_Invitation gpgsInv, bool shouldAutoAccept) { if (sInvitationDelegate != null) { // Invoke consumer delegate immediately. sInvitationDelegate(Invitation.FromGPGSInvitation(gpgsInv), shouldAutoAccept); } else { // Enqueue this invitation for later invoking when a consumer invitation delegate is registered. if (sGPGSPendingInvitations == null) { sGPGSPendingInvitations = new Queue <Action>(); } sGPGSPendingInvitations.Enqueue(RuntimeHelper.ToMainThread(() => OnGPGSInvitationReceived(gpgsInv, shouldAutoAccept))); } }
public static GPGS_InvType InvitationType(this GPGS_Invitation inv) { var variant = inv.Variant < 0 ? 0 : inv.Variant; return((variant & (MatchRequest.MaxVariant + 1)) > 0 ? GPGS_InvType.TurnBased : GPGS_InvType.RealTime); }