当前位置: 首页 > news >正文

湛江企业网站seo智能网站

湛江企业网站seo,智能网站,佛山市做网站,怀化招标网站排行榜需求解决方案一(嗯目前只有一)UnityEngine.SocialPlatformsiOS GameCenterAppStoreConnect配置Unity 调用(如果使用GameCenter系统的面板#xff0c;看到这里就可以了#xff09;坑(需要获取数据做自定义面板的看这里)iOS代码Unity 代码吐槽需求 需求#xff1a;接入… 排行榜需求解决方案一(嗯目前只有一)UnityEngine.SocialPlatformsiOS GameCenterAppStoreConnect配置Unity 调用(如果使用GameCenter系统的面板看到这里就可以了坑(需要获取数据做自定义面板的看这里)iOS代码Unity 代码吐槽需求 需求接入排行榜每关都有单独的分数排行在关卡结束后可点击弹出或主动弹出。 ps:没有做自己的服务器统计数据及好友关系等 解决方案一(嗯目前只有一) UnityEngine.SocialPlatforms UnityEngine.SocialPlatforms API点这里 Unity社交模型集成了一些诸如好友排行成就等功能。 我这里只接入了iOS,所以以下只做iOS的分析 优点 使用方便使用方便使用方便不用导入sdk什么的Unity做了封装 缺点 Unity做了封装但有些api并不好用。另外玩家只有开启GameCenter才能使用本功能。再另外面板并不是很好看 o(╥﹏╥)o 默认情况下在 iOS 上使用 GameCenter。其他所有 平台均默认为可用于测试的本地实现Android 一般用Google Play Games。   iOS GameCenter iOS GameCenter 能设置500个排行榜并没有看到官方文档据说有那么多足够用了。   AppStoreConnect配置 重复以上步骤需要几个排行榜加几个暂时没找到批量的方法 Unity 调用(如果使用GameCenter系统的面板看到这里就可以了 using UnityEngine; using UnityEngine.SocialPlatforms;namespace HZH {public class RankingList{private static RankingList _instance;public RankingList Instance _instance??new RankingList();public void Init (){if (Application.platform RuntimePlatform.IPhonePlayer) {Social.localUser.Authenticate (success {Debug.Log(success ? GameCenter初始化成功 : GameCenter初始化失败);});}}/// summary/// 上传数据/// /summary/// param namescore分数/param/// param nameleaderboardID指定的排行榜id/parampublic void ReportScore (long score, string leaderboardID){if (Application.platform ! RuntimePlatform.IPhonePlayer) return;if (Social.localUser.authenticated) {Social.ReportScore (score, leaderboardID, success {Debug.Log(success? $GameCenter:{leaderboardID}分数{score}上报成功: $GameCenter:{leaderboardID}分数{score}上报失败);});}}/// summary/// 拉起排行榜数据/// /summarypublic void ShowLeaderboard (){if (Application.platform ! RuntimePlatform.IPhonePlayer) return;if (!Social.localUser.authenticated) return;Social.ShowLeaderboardUI ();}/// summary/// 获取指定排行榜数据/// /summary/// param nameboardId/parampublic void GetBoardData(string boardId){if (Application.platform ! RuntimePlatform.IPhonePlayer) return;ILeaderboard leaderboard Social.CreateLeaderboard();leaderboard.id boardId;leaderboard.LoadScores(result {Debug.Log(Received leaderboard.scores.Length scores);foreach (IScore score in leaderboard.scores)Debug.Log(score);});}} } 如果团队愿意用Native的GameCenter排行榜界面这里ShowLeaderboard已经能完成了。初始化数据上报拉取排行榜面板。 面板在不同机型上显示也不一样以下是一种机型作参考 坑(需要获取数据做自定义面板的看这里) 如果native面板不满足需求就需要拿到排行榜数据自己做实现。 上面的代码GetBoardData方法并不能正确获取到玩家昵称数据。测试2个账号一个昵称显示未知一个获取数据失败。账号所限没办法测试更多了。 这里我找到的解决方案是在iOS直接调用Native的api获取数据 iOS代码 GameCenterCtrl.h interface GameCenterCtrl : NSObject // 声明需要的字段 { } -(void)GetRankingListData:(const char*)boardId; endGameCenterCtrl.m #import Foundation/Foundation.h #import GameKit/GameKit.h #import GameCenterCtrl.himplementation GameCenterCtrl -(id)init {return self; } -(void) GetRankingListData:(const char*)boardId{GKLeaderboard *leaderboardRequest [[GKLeaderboard alloc] init];if (leaderboardRequest ! nil){NSString* board [[NSString alloc] initWithUTF8String:boardId];leaderboardRequest.playerScope GKLeaderboardPlayerScopeGlobal;leaderboardRequest.timeScope GKLeaderboardTimeScopeAllTime;leaderboardRequest.range NSMakeRange(1,10);leaderboardRequest.identifier board;[leaderboardRequest loadScoresWithCompletionHandler: ^(NSArray *scores, NSError *error) {if (error ! nil){// handle the error.NSLog(下载失败);NSLog(%, error);}if (scores ! nil){// process the score information.NSLog(下载成功....);NSArray *tempScore [NSArray arrayWithArray:leaderboardRequest.scores];NSMutableArray* array [NSMutableArray arrayWithCapacity:tempScore.count];for (GKScore *obj in tempScore) {GKPlayer *player obj.player;NSString *point [NSString stringWithFormat:%lld, obj.value];NSString *rank [NSString stringWithFormat:%ld, obj.rank];NSDictionary *dict {name:player.alias,point:point,rank:rank,};[array addObject:dict];}NSData *data [NSJSONSerialization dataWithJSONObject:array options:kNilOptions error:nil];NSLog(u3d_packageJosn data: %, data);// nsdata - nsstringNSString *jsonString [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];NSLog(u3d_packageJosn jsonString: %, jsonString);// nsstring - const char*const char* constStr [jsonString UTF8String];UnitySendMessage(你的GameObject名字, 接收数据的方法名, constStr);}}];} } endPortFile.h #import Foundation/Foundation.hinterface PortFile : NSObject void GetRankingListData(const char* boardId); endPortFile.m #import PortFile.h #import GameCenterCtrl.h // 这个对象用来接收Unity信息处理OC代码 void showAppStoreScoreView(){[[GameCenterCtrl alloc]GetRankingListData:boardId]; } 以上4个文件放到Assets/Plugins/ios 文件夹下,GameCenterCtrl也可以直接按PortFile的写法省了portFile俩文件。 或者用自己的unity2iOS通信方案,核心就GameCenterCtrl.m的GetRankingListData方法。 Unity 代码 获取数据 [DllImport(__Internal)]private static extern void GetRankingListData(string boardId);public void GetRankingData(string boardId){GetRankingListData(boardId)}接收数据(数据获取是异步进行的所以用的UnitySendMessage)这个Unity接收数据想来都懂就不一步步写了。拿到数据json解一下就可以为所欲为了 吐槽 搜索Unity排行榜帖子茫茫多全是教怎么写界面的写界面用你教呀 -_-||
http://www.w-s-a.com/news/685359/

相关文章:

  • 网站优秀网站地址做宣传册的公司
  • 苏州高端网站建设咨询wordpress云图插件
  • 河北省建设厅网站重新安装优秀中文网页设计
  • 如何在腾讯云做网站开源站群cms
  • 公司网站建设的意义网易做网站
  • 网络营销案例分析与实践搜外seo
  • 手机建网站挣钱吗wordpress面包屑
  • 淘客做网站怎么备案网站开发工具的是什么
  • 提供大良网站建设郑州网站建设网站开发
  • 邢台做wap网站价格wordpress评论滑动
  • 绝味鸭脖网站建设规划书江苏建设人才网 官网
  • 网站源码授权破解centos wordpress 整站
  • 建设一个私人视频网站wordpress js
  • 手机企业网站制作流程3d建模自学
  • 网站优化方案和实施wordpress的归档
  • 建设事业单位网站多少钱集艾设计公司官网
  • 网站建设与管理方案书图片的制作方法
  • 中文建网站美发网站模板带手机版
  • 免费聊天不充值软件windows优化大师下载安装
  • 网站优化的关键词自己怎么做外贸网站空间
  • 现在建设的网站有什么劣势温州互联网公司
  • 重庆自助企业建站模板淘宝关键词top排行榜
  • 平邑网站制作买高端品牌网站
  • 深圳建网站三千网站安全代维
  • 西宁市精神文明建设网站装饰设计甲级资质
  • 做教育行业营销类型的网站徐州做网站多少钱
  • 临沂品牌网站制作企业网站建设搜集资料
  • wordpress注册验证码手机网站优化
  • 往建设厅网站上传东西做衣服的教程网站有哪些
  • 网上商城网站设计免费咨询口腔科医生回答在线