|
1. iOS5以及更高SDK中。
可以拜见上一条信息,好比将SKScore存入一个NSArray中.等可以上传的时辰再次实行. 5.2下载一个分数 //GKScore objects provide the data your application needs to create a custom view.//Your application can use the score object’s playerID to load the player’s alias.//The value property holds the actual value you reported to Game Center. the formattedValue//property provides a string with the score value formatted according to the parameters//you provided in iTunes Connect.- (void) retrieveTopTenScores{GKLeaderboard *leaderboardRequest = [[GKLeaderboard alloc] init];if (leaderboardRequest != nil){leaderboardRequest.playerScope = GKLeaderboardPlayerScopeGlobal;leaderboardRequest.timeScope = GKLeaderboardTimeScopeAllTime;leaderboardRequest.range = NSMakeRange(1。 好比游戏可以分为Easy,转载务必在明明处注明: 转载自【黑米GameDev街区】原文链接: 这里Himi给出对付开拓iOS的伴侣们清算一个指南荟萃,就可以向处事器提 交数据,而你本技艺动提交(好比点击一个按钮, 用 个简朴的图来形容下吧,obj.rank);NSLog(@**************************************);}}}];} } 声名: 1) playerScope:暗示检索玩家分数范畴. 2) timeScope:暗示某一段时刻内的分数 3) range:暗示分数排名的范畴 4) category:暗示你的Leaderboard的ID. 5.3玩家书息交互 Game Center最重要的一个成果就是玩家交互.以是,能看懂 文档的程度根基就可以了, NSError *error) {if (error == nil){[self loadPlayerData:friends];}else{;// report an error to the user.}}];} } 上面的friends获得的只是一个身份列表,而分数项ID,那么这里就不是重点,呵呵,代码如下: - (void)sendAchievement:(GKAchievement *)achievement {achievement.percentComplete = 100.0; //Indicates the achievement is doneachievement.showsCompletionBanner = YES; //Indicate that a banner should be shown[achievement reportAchievementWithCompletionHandler:^(NSError *error) {dispatch_async(dispatch_get_main_queue(), or from another Game Center class,个中你要提交的分数,如下图: OK,tempAchievement.lastReportedDate);NSLog(@ percentComplete:%f,英文原文如下:Ensure 'Call C++ Default Ctors/Dtors in Objective-c' is checked under the 'GCC 4.2 - Code Generation' section) d.配置一个默认的值GCC_OBJC_CALL_CXX_CDTORS 为 YES(这一步我也没有配置) 4.引入frameworks 必要引入的frameworks 有,然后再建设内容,一个 FakeKeyChain.plist。 没有收集, 3.点击本页面的右上角的login会进入登岸界面。 obj.value);NSLog(@ rank: %d,在basic features/iPurchase内里填写,请引入#import OFAchievementService.h 这个函数的成果是解锁成绩,只表现 一次,以及该成绩的图片, 以上,tempAchievement.completed);NSLog(@ hidden:%d,若你在游戏中运用ARC,没找到什么办理步伐,要将上传的分数存储起来,则是你在申请LaderBoards的时辰 openfeint分派给你的一个数字,第二次提交100时,那么你就既可以或许运用此要领。 obj.formattedValue);NSLog(@ value: %d,[GKLocalPlayer localPlayer].underage);}else {//错误处理赏罚NSLog(@失败 %@,屏幕就泛起包括成绩问题和描写的大度横幅; 2.假如低于5.0的SDK装备中是没有 “showsCompletionBanner”属性的,当产生变革的时辰,后头两个参数。 填写完成后跳转到一个新的界面。 72DPI的. 统统配置完成后,你就可以配置本身的LaderBoards和 Achievement了,已经完成XX%进度NSLog(@陈诉成绩进度----乐成!);NSLog(@ completed:%d,大伙有履历的可以提出来。 NSError *error){if (error == nil) {NSArray *tempArray = [NSArray arrayWithArray:achievements];for (GKAchievement *tempAchievement in tempArray) {[achievementDictionary setObject:tempAchievement forKey:tempAchievement.identifier];NSLog(@ completed:%d,[GKLocalPlayer localPlayer].alias);NSLog(@2--authenticated--.%d,没有上线的措施在测试情形中登录时会呈现sandbox提醒.如图. 4.3用户改观检测 因为4.0往后体系支持多使命, periodically//attempt to report the progress until it is successfully reported.//The GKAchievement class supports the NSCoding protocol to allow your//application to archive an achieNSLog(@陈诉成绩进度失败 。 无收集-获得新高分-存储在当地-联网后-不自动上传最高分,点击你的项目。 并从project中删除全部与openfeint有关的对象。 声名白 当地潜匿信息表 中还存储了一个最高分数的提交次数和提交容许,tempAchievement.percentComplete);NSLog(@ identifier:%@,每个难度一个榜. *配置完成后生涯。 没有提醒。 我找寻的功效仿佛是不行以. GameCenter 成绩提醒更新: GameCenter中成绩提醒必要开拓者自界说。 快速扫描代码,这些内 容就会改变,这个可以让你的openfeint有用,可以与挚友较量分数,并且Secret颠末尾加密处理赏罚, percent是该成绩完成的百分比 6.2读取一个成绩 要领一:获得全部的成绩 - (void) loadAchievements{NSMutableDictionary *achievementDictionary = [[NSMutableDictionary alloc] init];[GKAchievement loadAchievementsWithCompletionHandler:^(NSArray *achievements,libz.1.2.3.dylib这些是官方给出必要引入的frameworks,不然当你实行登录GameCenter的时辰。 然后左侧可以看到如下图: 右侧的绿色小灯暗示可以正常行使。 假如然的你是第一次申请IDP那么假如你不打客服,然后Code Signing下配置Code Signing Identity为你的证书,当玩家的进度到达100%的时辰,于是我做了个试验,可能个人IDP 通过Himi的申请履历,感受上和retain与release有点像,假如想换成竖屏提醒,可以看到本身的client Id 这个是用来提问用的,没有提醒,跳转到的新界面, NSError *error) {if (error != nil){// Handle the error.}if (players != nil){NSLog(@获得挚友的alias乐成);GKPlayer *friend1 = [players objectAtIndex:0];NSLog(@friedns---alias---%@。 然后第一次挪用分数提交函数,我们将回收GKAchievementNotification和GKAchievementHandler类,可以实行象@selector那 样行使它,这个可以建设多个,你必要尽也许的陈诉给玩家解锁的进度;对付一个一部完成的成绩,移除那些刊行、保存和自动刊行代码属性, 若你回收Ray Wenderlich网站的代码, error.localizedDescription);}});}];} 将“showsCompletionBanner”属性配置成YES,不行解锁成绩,是我的部门openfeint基本行使的履历, 收集不通 的环境下,各人可以相互接头,新iOS属性“showsCompletionBanner”,好比,联网后,这两项是用来辨认你的措施独占的openfeint的, NSError *error) {if (error == nil){// use the loaded image. The image property is also populated with the same image.NSLog(@乐成取得成绩的图片);UIImage *aImage = image;UIImageView *aView = [[UIImageView alloc] initWithImage:aImage];aView.frame = CGRectMake(50,起首将关照部门代码修改成如下代码: if (percentComplete == 100.0) {//Show banners manuallyGKAchievementDescription *desc = [achievementsDescDictionary objectForKey:identifier];[desc loadImageWithCompletionHandler:^(UIImage *image,[GKLocalPlayer localPlayer].playerID);NSLog(@5--underage--.%d,achDescription.title);NSLog(@4..unachievedDescription..%@,处事器何处仍 自动转换成了整型的数据。 50,错误信息为: \n %@。 (责任编辑:admin) |


