0

我正在使用Shephertz Appwarp API为 Windows 手机游戏设置多人配对功能。我已按照此文档进行操作:使用 Appwarp 进行匹配并成功设置了通过 ID 查找朋友的功能,但在与随机对手进行匹配时遇到了问题。

我正在创建一个字典,如下所示:

public class Matchmake : Microsoft.Xna.Framework.Game
{
    public static Dictionary<string, object> tableProperties = new Dictionary<string, object>();

    protected override void Initialize()
    {
        tableProperties.Add("IsPrivateRoom", "false");
    }
}

然后执行这个:

WarpClient.GetInstance().JoinRoomWithProperties(tableProperties);

然后在我的房间请求监听器中检查结果:

public void onJoinRoomDone(RoomEvent eventObj)
    {
        if (Matchmake.searchGame == true)
        {
            if (eventObj.getResult() == WarpResponseResultCode.SUCCESS)
            {
                if (Matchmake.hostingRandomGame == false)
                {
                    Matchmake.UIstate = 7;
                    Matchmake.idRef = eventObj.getData().getId();
                }
                Matchmake.warpClient.SubscribeRoom(Matchmake.idRef);
            }
            else
            {
                Matchmake.warpClient.CreateRoom("CreatedRoom", Matchmake.localUsername, 2, Matchmake.tableProperties);
                Matchmake.UIstate = 8;
            }
        }

完成其余代码和调试后,我可以看到从 Else 代码为 player1 创建了房间,并且他们已订阅并获得实时更新。但是当 player2 在另一台手机上执行相同的代码时,它在通过 Dictionary 查找房间后没有得到 SUCCESS 结果,而是通过执行 Else 代码也创建了一个新游戏。它也不是由 hostingRandomGame 布尔引起的。有人有想法么?任何帮助将不胜感激,我在 API 文档中找不到解决方案,而且我在这方面处于死胡同。-XDev

4

0 回答 0