1

我的游戏有问题,我已经创建了房间并允许 2 个用户进入,如下所示

if(GUI.Button (new Rect(220,300,120,20), "Create Room"))
{   
    RoomSettings settings = new RoomSettings(roomName);   
    settings.MaxSpectators = 1;  
    settings.MaxUsers = 2;  
    settings.Name = roomName;  
    settings.Variables.Add(new SFSRoomVariable("AceOnAce", GameLogics.AceOnAce));
    settings.Variables.Add(new SFSRoomVariable("NoTrickWithAce", GameLogics.NoTricksWithAce));
    settings.Extension = new RoomExtension(extensionId, extensionClass);  
    NetworkCon.sfs.Send(new CreateRoomRequest(settings, true, NetworkCon.sfs.LastJoinedRoom));
}  

并在 onRoomAdded 方法中

public void OnRoomAdded(BaseEvent evt) 
{   
    Debug.Log ("Created");  
    Room room = (Room)evt.Params["room"];  
    //room.IsGame = true;  
    if ( room.IsGame ) 
    {  
        SetupRoomList();  
    }  
    room.GetVariables ();  
    Debug.Log (room.Name);
}

我的问题是我自己创建房间时看不到两个用户,但是当我加入其他用户创建的房间时会显示两个用户。看起来 onJoinRoom 工作正常,但问题必须在创建房间。请帮忙谢谢。

4

0 回答 0