Facebook SDK Unity邀请

时间:2014-05-28 09:49:53

标签: android facebook unity3d facebook-unity-sdk

我正在开发一个我连接到Facebook的女巫游戏。如果用户已连接,他可以邀请他的5个Facebook进入该应用程序。我用过这段代码。我想在用户点击邀请按钮时脚本InteractiveConsole.cs中的问题,他只能邀请他的5个朋友,当他选择5个朋友时,他不能邀请5个以上。 这是我的代码:

#region FB.AppRequest() Friend Selector

public string FriendSelectorTitle = "";
public string FriendSelectorMessage = "Derp";
public string FriendSelectorFilters = "[\"all\",\"app_users\",\"app_non_users\"]";
public string FriendSelectorData = "{}";
public string FriendSelectorExcludeIds = "";
public string FriendSelectorMax = "";

private void CallAppRequestAsFriendSelector()
{
    // If there's a Max Recipients specified, include it
    int? maxRecipients = null;
    if (FriendSelectorMax != "")
    {
        try
        {
            maxRecipients = Int32.Parse(FriendSelectorMax);
        }
        catch (Exception e)
        {
            status = e.Message;
        }
    }

    // include the exclude ids
    string[] excludeIds = (FriendSelectorExcludeIds == "") ? null : FriendSelectorExcludeIds.Split(',');

    FB.AppRequest(
        FriendSelectorMessage,
        null,
        FriendSelectorFilters,
        excludeIds,
        maxRecipients,
        FriendSelectorData,
        FriendSelectorTitle,
        Callback
    );
}
#endregion

感谢您的帮助。

1 个答案:

答案 0 :(得分:0)

我发现它为什么不起作用。 首先要限制我的应用程序中邀请的朋友数量,我应该改变这个:

public string FriendSelectorMax = "5";

我再次取消了文件记录并且说出来了。

" maxRecipients:依赖于平台用户应该能够在平台多朋友选择器对话框中选择的最大收件人数。仅保证在Unity Web Player应用程序中工作。"

以下是链接:https://developers.facebook.com/docs/unity/reference/current/FB.Apprequest

认为maxRecipients在WebPlayer中工作,而不是到现在为止。

我测试了统一网络播放器中的代码,我只能邀请5位朋友,当我将平台切换到android时,它没有像文档中所说的那样工作。

相关问题