gamecircle.GetBatchFriends()

类型 函数
gamecircle.*
返回值
版本 版本 2024.3703
关键字 gamecircle、玩家、个人资料

概述

此函数允许您根据提供的 ID 获取本地玩家好友的 Player 信息。

语法

gamecircle.GetBatchFriends(idsTable, callback)
idsTable (必需)

Table. 本地玩家好友的 Id 表。可使用 [GetFriendsIds][gamecircle.GetFriendsIds] 获取这些 ID。如下面的示例所示,[GetFriendsIds][gamecircle.GetFriendsIds] 的结果可直接输入到该函数中以提供 Id。但是,如果您希望自己创建 Id 表,则必须正确存储这些 Id。它们必须为 String 类型,并通过连续编号的方括号访问器存储在表中。

callback (必需)

Function. 传递给回调函数,因为请求需要 GameCircle SDK 联系 Amazon 服务器。回调将接收一个 [FriendIdsReturn][gamecircle.FriendIdsReturn] 的参数。

示例

local gamecircle = require("plugin.gamecircle")  
gamecircle.Init(true, false, false)  
function FriendIdsCallback(returnTable)
    if returnTable.isError == true then
        print("Friend Ids Callback had an error: " .. returnTable.errorMessage)
    else
        print("===================Friend Ids Callback has returned!")
        for i = 1, returnTable.num do
            print("Friend Ids Found + " .. returnTable[i])
        end
        gamecircle.GetBatchFriends(returnTable, BatchFriendsCallback)
    end
end

function BatchFriendsCallback(returnTable)
    if returnTable.isError == true then
        print("Batch Friends Callback had an error: " .. returnTable.errorMessage)
    else
        print("===================Batch Friends Callback has returned!")
        for i = 1, returnTable.num do
            print("--Friend Found: " .. returnTable[i].alias)
        end
        gamecircle.GetBatchFriends(returnTable, BatchFriendsCallback)
    end
end
gamecircle.GetFriendIds(FriendIdsCallback)