Check IsInactive in custom room

Hi!

Client getting list of rooms via PhotonNetwork.WebRpc.
Each room generating a button. I need to know, is current user ID already in room or not. If yes - button's function will be Rejoin, else -- Join.

How can I check IsInactive property from lobby on each of rooms?

Answers

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @dNazarik,

    Since a client can be joined to a single room at the same time and since the room state contains list of actors you can:

    a- the WebRPC that returns the list of rooms: (recommended) returns only list of room for the player calling the WebRPC (using UserID check) OR (not recommended) return all rooms with their respective joined actors' UserIDs.
    b- get the room name of the currently joined room if any.

    using a and b you can tell if a player:
    • is already joined and active in the room
    • can rejoin a room (optional: there is also the PlayerTTL expiration factor)
    • can join a room as a new actor
  • dNazarik
    dNazarik
    edited August 2017
    @JohnTube

    using UserID check

    How can I check?
  • @JohnTube , that's how i getting rooms:
    if (webResponse.Name == Res.GetRoomListMessage)
    {
    SavedGames.Clear();

    if (response.Parameters == null)
    {
    Debug.Log("WebRpcResponse for GetGameList contains no rooms: " + response.ToStringFull());
    return;
    }

    var param = response.Parameters;
    if (!param.ContainsKey(208))
    {
    Debug.Log("Saved rooms list is empty (!)for you");
    return;
    }
    var pair = param[208] as Dictionary;

    foreach (var room in pair)
    {
    var roomValues = room.Value as Dictionary;

    int actorNumber = (int) roomValues["ActorNr"];
    var savedRoomProps = roomValues["Properties"] as Dictionary;

    Debug.Log("Room names: " + room.Key + " . Actor number: " + actorNumber + " . Props: " + savedRoomProps.Count);
    }
    }

    How can I check user's ID?