使用谷歌Play游戏服务于iOS和Android游戏Libgdx [英] Libgdx game using Google Play Game Services on iOS and Android

查看:293
本文介绍了使用谷歌Play游戏服务于iOS和Android游戏Libgdx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建使用Libgdx一个游戏,想在两个iOS和Android设备播放器,排行榜,高分集成。理想情况下,我会用谷歌Play游戏服务,但​​我可以被说服使用其他技术(如解析)。

I am creating a game using Libgdx and would like to integrate player, Leaderboard, high score on both iOS and Android devices. Ideally I would use Google Play Game Services but I could be convinced to use other technologies (like Parse).

有教程使用谷歌Android设备播放服务:(的http://theinvader360.blogspot.co.uk/2013/10/google-play-game-services-tutorial-example.html).但据我了解,这不会对iOS设备(根据这个:的https:/ /developers.google.com/games/services/integration/

There are tutorials to use Google Play services for Android devices: (http://theinvader360.blogspot.co.uk/2013/10/google-play-game-services-tutorial-example.html). But as far as I understand, this will not work for iOS devices (according to this:https://developers.google.com/games/services/integration/)

还有一些教程,在iOS设备上做到这一点,使用RoboVM:的 http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=11424 但据我了解,这将仅适用于iOS设备的正常工作。

There are also tutorials to do so on iOS devices, using RoboVM: http://www.badlogicgames.com/forum/viewtopic.php?f=11&t=11424 but as far as I understand this will only work for iOS devices.

由于libgdx的好处之一,就是写一次,但运行跨平台的,
我的问题是这样的:
我该如何与谷歌Play游戏服务整合,iOS和Android上运行。

Since one of libgdx benefit is to write once but to run cross platforms, my Question is the following: How do I integrate with Google Play Game Services and run on iOS and Android.

在我看来,答案是使用REST API(的https:/ /developers.google.com/games/services/web/api/ ),因为这在技术上是不可知的,但是这意味着我需要实现相当多的事情(登录,通知...)

It seems to me that the answer is to use the REST API (https://developers.google.com/games/services/web/api/) since this is technologically agnostic, but that means that I then need to implement quite a few things (login, notifications...)

我无法想象我将面临这第一个,但它似乎没有关于这个问题可用的例子。

I cannot imagine I am the first one to be facing this but it seems there are no examples available on the subject.

推荐答案

您不必使用REST API对于这一点,尽管这肯定是一种选择。

You don't have to use the REST API for this, even though that would certainly be an option.

较容易的方法是通过的接口。

The easier way is the use of platform specific code via interfacing.

这是不是直接集成到libGDX将不通过一切工作的一次编写,到处运行。这也适用于成就,排行榜和其他的东西,谷歌Play游戏服务的报价。但是,你是幸运的,GPGS团结一个统一的框架内这些功能,至少Android,iOS和网络。

Everything that is not directly integrated into libGDX won't work via "write once, run everywhere". This also applies to achievements, leaderboards and other things that Google Play Game Services offer. However, you are lucky that GPGS unites these features within one framework for at least Android, iOS and Web.

所以,你会做什么,是增加特定于平台的库依赖于已生成的平台,具体项目。然后实现一个通用的接口,E。 G。 AchievementHandler unlockAchievement方法(字符串achievementId)

So what you would do, is adding the platform specific library dependencies to the platform specific projects you have generated. Then implement a generic interface, e. g. AchievementHandler with methods like unlockAchievement(String achievementId).

然后,你将实现通过 AndroidAchievementHandler 此接口,使得使用全球公共产品。同样将与一个 IOSAchievementHandler

Then you would implement this interface via AndroidAchievementHandler that makes use of GPGS. The same will work with an IOSAchievementHandler.

在你的核心code,你将只使用 AchievementHandler 和每个平台将利用自身实现这一点。

In your core code, you will only use AchievementHandler and each platform will use its own implementation of this.

这篇关于使用谷歌Play游戏服务于iOS和Android游戏Libgdx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆