game-center

Is there a way to update matchData in a GKTurnBasedMatch without sending out “Your Turn” push notifications?

落爺英雄遲暮 提交于 2020-01-11 06:51:14
问题 If my understanding is correct, the only way to update the matchData property of a GKTurnBasedMatch mid-turn is [_currentMatch endTurnWithNextParticipant:_currentParticipant matchData:matchData completionHandler:nil]. This works well if the Game Center player only has the game installed on one device because the notification is delivered to the device as a message to the app. Thus, the notification can be hidden while the user is currently playing his turn. However, if the user has the game

How do I send data from a GKPlayer to another in a match?

坚强是说给别人听的谎言 提交于 2020-01-07 06:13:02
问题 I would like to send NSData from a GKPlayer to another in a match. Therefore, the method sendDataToAllPlayers(_:withDataMode:error:) would be the most ideal. func sendDataToAllPlayers(data: Int, withDataMode Reliable: GKMatchSendDataMode, error: NSErrorPointer) -> Bool { return true } Though, how can I use the method above to send an Int variable? var score:Int = 0 回答1: This version for encapsulating an Int (or other type) into or extracting it from NSData should work even between devices

How do I send data from a GKPlayer to another in a match?

房东的猫 提交于 2020-01-07 06:11:43
问题 I would like to send NSData from a GKPlayer to another in a match. Therefore, the method sendDataToAllPlayers(_:withDataMode:error:) would be the most ideal. func sendDataToAllPlayers(data: Int, withDataMode Reliable: GKMatchSendDataMode, error: NSErrorPointer) -> Bool { return true } Though, how can I use the method above to send an Int variable? var score:Int = 0 回答1: This version for encapsulating an Int (or other type) into or extracting it from NSData should work even between devices

Cannot dismiss GKGameCenterViewController presented from SKScene

你。 提交于 2020-01-06 08:43:10
问题 I'm presenting a GKGameCenterViewController from an SKScene. This is my code: -(void)showLeaderboardAndAchievements:(BOOL)shouldShowLeaderboard{ GKGameCenterViewController *gcViewController = [[GKGameCenterViewController alloc] init]; gcViewController.viewState = GKGameCenterViewControllerStateLeaderboards; gcViewController.leaderboardIdentifier = _leaderboardIdentifier; // _spriteViewController references an UIViewController [_spriteViewController presentViewController:gcViewController

how to sync data in multiplayer game(game-center ios)

喜你入骨 提交于 2020-01-06 07:47:05
问题 I have been developing a game for Game Center. Description of game :- One player is initiator of game because game has 5 tiled-map (only one tile-map is selected randomly by either player(initiator)) . Initiator will send selected tile-map to second player, Now this tile-map will draw on second player side.(at this point both player have same tile-map) This is work fine when I start game by sending invitation to player. but when I start game by "automatch" , I am not able to find that who

Reporting score to GameCenter in iOS 9 (xCode 7.1.1)

只愿长相守 提交于 2020-01-06 01:57:14
问题 So I have a finished game, which I'm just tidying up before submitting to the App Store. Since I finished the majority of the coding, I've updated xCode to 7.1.1 and my device to iOS 9.1 from 8.1. The first thing I've learnt is there's no Sandbox toggle in Game Center (which is what I've mostly always used with no problems) Now, when I run the application, when it comes to reporting a score using this code: -(void)reportScore{ GKScore *this_score = [[GKScore alloc]

iTunes connect enable game center

烈酒焚心 提交于 2020-01-05 07:50:34
问题 I try to test Game Center in my iPhone game, but when I try to connect with the following lines of code I get an alert that says "This game is not recognized by Game Center.". [[GKLocalPlayer localPlayer] authenticateWithCompletionHandler:^(NSError *error) { if (error == nil) { // Insert code here to handle a successful authentication. } else { // Your application can process the error parameter to report the error to the player. } }]; Now I've read many forums and looked at the Apple

GKTurnBasedEventListener could not be set to delegate of my ViewController?

早过忘川 提交于 2020-01-05 07:07:18
问题 In objC the syntax written by Rawendrich for GKTurnBasedEventListener , which was GKTurnBasedEventHandler there at that time, now changed by Apple is as below. if (!gameCenterAvailable) return; void (^setGKEventHandlerDelegate)(NSError *) = ^ (NSError *error) { GKTurnBasedEventHandler *ev = [GKTurnBasedEventHandler sharedTurnBasedEventHandler]; ev.delegate = self; }; NSLog(@"Authenticating local user..."); if ([GKLocalPlayer localPlayer].authenticated == NO) { [[GKLocalPlayer localPlayer]

Social.localUser.Image returns null in Unity3d

喜欢而已 提交于 2020-01-05 02:54:08
问题 I want to access player avatar in Android and IOS, I could get userid and username using Social Class but image always returns null!! if ( Social.localUser.authenticated && Social.localUser.image != null ) { Material m = new Material(Shader.Find("Unlit/Transparent Colored")); m.mainTexture = Social.localUser.image; AvatarImage.material = m; } Any idea. 回答1: The Social API in Unity is only implemented for iOS. For the Google Play Services i really recommend buying the prime31 Google Play Game

Can I tell an iOS Gamecenter automatch from an explicit invitation?

那年仲夏 提交于 2020-01-04 05:56:14
问题 In my multiplayer iOS game, one player has to be the "host" and decide on certain game settings. When he invites friends via GC, it's clear that he is in the driver's seat, however when people are brought together by automatch, I need to do a draw-straw procedure to bring just one to the dialog of making the choices. Right now I have no clue how I can tell an automatched connection from a setup that was initiated clearly by one side. Any ideas whether it can be deducted from certain API