private void LoadPlayers(GKPlayer[] players, NSError error) { foreach (GKPlayer player in players) { player.LoadPhoto(GKPhotoSize.Normal, (image, loadImageError) => { _playerImageCache.Add(player.PlayerID, image); BeginInvokeOnMainThread(() => { // TODO Refresh images }); }); } }
public override void DidRequestMatchWithPlayers(GKPlayer player, object[] playerIDsToInvite) { // send it to both realtime and turn-based if they are init'd if (RealTimeMatchesController._init) RealTimeMatchesController._MatchInviteHandler(null, playerIDsToInvite); if (TurnBasedMatchesController._init) { Player.LoadPlayersByIDs(playerIDsToInvite.Cast<string>().ToArray(), delegate(Player[] players) { if (players.Length > 0) { TurnBasedMatchesController._OnInvitePlayers(players); } }); } }
/// <summary> /// Gets (and download and cache if necessary) the profile image for a player /// </summary> /// <param name="playerId">Player identifier.</param> /// <param name="callback">Callback.</param> public static void GetProfileImage(GKPlayer player, Action<UIImage> callback) { Logger.I ("Loading player picture..." + player.PlayerID); // Ask Game center player.LoadPhoto (GKPhotoSize.Normal, (photo, error) => { if (error == null) { if (callback != null) { callback (photo); } } else { Logger.E ("GameCenterHelper.GetProfileImage", error); } }); }
public virtual void PlayerDidChangeConnectionState(GKMatch match, GKPlayer player, GKMatch.GKPlayerConnectionState state) { }
void DisplayScore (GKScore score, int rank, GKPlayer player) { PointF[] podiumPositions = new PointF[] { new PointF (0, 100), new PointF (-84, 75), new PointF (84, 50) }; PointF currentPoint = podiumPositions [rank]; SKLabelNode scoreLabel = new SKLabelNode ("GillSans-Bold") { Text = score.FormattedValue, FontSize = 14, Position = new PointF (FrameMidX + currentPoint.X, FrameMidY + currentPoint.Y - 32) }; player.LoadPhoto (GKPhotoSize.Small, delegate (UIImage photo, NSError error) { if (photo == null) photo = UIImage.FromFile ("Images/DefaultPlayerPhoto.png"); var image = SKSpriteNode.FromTexture (SKTexture.FromImage (photo), new SizeF (32, 32)); image.Position = new PointF (FrameMidX + currentPoint.X, FrameMidY + currentPoint.Y + 16); AddChild (image); }); AddChild (scoreLabel); }
public virtual void PlayerDidAcceptInvite(GKPlayer player, GKInvite invite) { }
public override void ReceivedExchangeRequest(GKPlayer player, GKTurnBasedExchange exchange, GKTurnBasedMatch match) { TurnBasedMatchesController._OnExchangeRequest(match, exchange); }
public override void DidAccept(GKPlayer player, GKInvite invite) { RealTimeMatchesController._MatchInviteHandler(invite, null); }
public override void DidReceive(GKPlayer player, GKChallenge challenge) { }
public virtual void MatchmakerViewControllerHostedPlayerDidAccept(GKMatchmakerViewController viewController, GKPlayer player) { }
public virtual void PlayerReceivedTurnEventForMatch(GKPlayer player, GKTurnBasedMatch match, bool didBecomeActive) { }
public virtual void PlayerWantsToQuitMatch(GKPlayer player, GKTurnBasedMatch match) { }
public virtual void PlayerMatchEnded(GKPlayer player, GKTurnBasedMatch match) { }
public virtual void PlayerDidRequestMatchWithOtherPlayers(GKPlayer player, GKPlayer[] playersToInvite) { }
public virtual void PlayerDidRequestMatchWithRecipients(GKPlayer player, GKPlayer[] recipientPlayers) { }
public virtual void MatchDidReceiveData(GKMatch match, NSData data, GKPlayer remotePlayer) { }
public override void Ended(GKPlayer player, GKTurnBasedMatch match) { TurnBasedMatchesController._OnMatchEnded(match); }
public override void IssuedChallengeWasCompleted(GKPlayer player, GKChallenge challenge, GKPlayer friendPlayer) { }
public override void ReceivedTurnEvent(GKPlayer player, GKTurnBasedMatch match, bool didBecomeActive) { TurnBasedMatchesController._OnTurnEvent(match, didBecomeActive); }
public override void WantsToPlay(GKPlayer player, GKChallenge challenge) { }
public override void DidComplete(GKPlayer player, GKChallenge challenge, GKPlayer friendPlayer) { }
public override void ReceivedExchangeCancellation(GKPlayer player, GKTurnBasedExchange exchange, GKTurnBasedMatch match) { TurnBasedMatchesController._OnExchangeCancellation(match, exchange); }
// Must be implemented. public abstract bool ShouldReinviteDisconnectedPlayer(GKMatch match, GKPlayer player);
public override void ReceivedExchangeReplies(GKPlayer player, object[] replies, GKTurnBasedExchange exchange, GKTurnBasedMatch match) { TurnBasedMatchesController._OnExchangeCompleted(match, exchange, replies); }
public override void DidReceiveChallenge (GKPlayer player, GKChallenge challenge) { var action = DidReceiveChallengeAction; if (action != null) action (player, challenge); }
public virtual void MatchDidReceiveDataForRecipient(GKMatch match, NSData data, GKPlayer recipient, GKPlayer remotePlayer) { }