Apple Game Center

类型
修订版 版本 2024.3703
关键字 gameNetwork、Game Center
平台 iOS

概述

Game Center让好友能够参与游戏,提供排行榜和成就功能。Solar2D API 中用于 Game Center 的命名规则尽量与官方 Game Center API 保持一致,使你能够交叉引用官方 Game Center 文档。

重要提示
  • 从 2023 年 8 月 16 日起,提供 Game Center 功能的新应用和应用更新需要包括 Game Center 权限。请参见下面的项目设置,并启用 Apple App ID 配置中的“Game Center 支持”。

疑难解答

模拟器不支持 Game Center。

语法

local gameNetwork = require( "gameNetwork" )

函数

gameNetwork.init()

gameNetwork.request()

gameNetwork.show()

项目设置

如需使用此插件,请在 `build.settings` 的 `plugins` 表中添加一个条目。添加后,构建服务器将在构建阶段集成该插件。

另请务必添加下面所示的 iPhone 权限表

settings =
{
    plugins =
    {
        ["CoronaProvider.gameNetwork.apple"] =
        {
            publisherId = "com.coronalabs"
        },
    },
    iphone = {
        entitlements = {
            ["com.apple.developer.game-center"] = true,
        },
    }
}

示例项目