LibGDX: 如何实现 Google 玩游戏服务?

LibGDX: How to Implement Google Play Game Services?

我检查了 [https://github.com/libgdx/libgdx/wiki/Google-Play-Games-Services-in-LibGDX][1] but that tutorial requiers me to import BaseGameUtils from here: [https://github.com/playgameservices/android-basic-samples][2],但 BaseGameUtils 似乎已被删除。我该如何着手实施 GooglePlay 游戏服务?

我最近刚刚在我的一个 libgdx 项目中实现了 Google 玩游戏。不要看 libgdx 教程,因为它们已经过时了。您不需要 libgdx 特定的扩展名。可以在此处的示例项目中找到未弃用的现代 Google Play 游戏服务代码:

https://github.com/playgameservices/android-basic-samples

将整个 repo 下载到您的计算机,加载到 android studio,然后尝试代码。其中大部分可以简单地复制和粘贴以满足您的需要。对我来说效果很好。

我使用的一般方法是将代码写入项目的 android 部分,然后使用接口将其绑定到我的核心 libgdx 代码中。参考这个post(第二个答案,不是第一个):

即使您不打算显示上述 post 中所示的警报对话框,您也可以通过遵循此技术让您的核心 libgdx 项目做 android 特定的事情