【发布时间】:2014-04-03 01:15:25
【问题描述】:
我正在尝试让 gamecenter 排行榜工作,但卡住了。我正在 Xcode 模拟器上进行测试,因为我无法在设备上登录我们的沙盒帐户。我可以使用init函数通过游戏登录沙盒帐户,但排行榜没有显示在gamecenter中。在游戏下方显示我们的游戏,但在下方显示“没有排行榜或成就”。我在 itunes connect 中设置了排行榜,并在似乎有效的代码中请求 setHighScore。以下是相关代码:
local function updateCallback(e)
local data = json.encode( e.data )
-- show encoded json string via native alert
native.showAlert( "e.data", data, { "OK" } )
end
--[[
Update the gamecenter learderboard for gamescore.
]]--
function [app name]GameNetwork.updateGamescore()
--Sets the score if it is higher than the one on Apple's server
gameNetwork.request( "setHighScore",
{
localPlayerScore = { category = "com.[domain].[game].gamescore", value = gamescore },
listener = updateCallback
})
end
按预期显示更新回调
{"value": 25,"category":"com.[domain].[game].gamescore"}
当updateGamescore 函数被调用时。我错过了什么吗? gamenetwork api有什么好的教程吗?
【问题讨论】:
-
我在设备上测试 Google Play 游戏服务时遇到了同样的问题。 “setHighScore”请求似乎发送成功,但在 Gamecenter 或 Google Play 游戏中没有显示排行榜。我觉得我在某个地方错过了一步,但不确定是什么。
标签: ios lua coronasdk game-center google-play-games