using System;
using System.Collections.Generic;
using UnityEngine.Serialization;
namespace LobbyRelaySample
{
///
/// Used when displaying the lobby list, to indicate when we are awaiting an updated lobby query.
///
public enum LobbyQueryState
{
Empty,
Fetching,
Error,
Fetched
}
///
/// Holds data related to the Lobby service itself - The latest retrieved lobby list, the state of retrieval.
///
[System.Serializable]
public class LocalLobbyList
{
LobbyQueryState m_CurrentState = LobbyQueryState.Empty;
public CallbackValue QueryState = new CallbackValue();
public Action> onLobbyListChange;
Dictionary m_currentLobbies = new Dictionary();
///
/// Maps from a lobby's ID to the local representation of it. This allows us to remember which remote lobbies are which LocalLobbies.
/// Will only trigger if the dictionary is set wholesale. Changes in the size or contents will not trigger OnChanged.
///
public Dictionary CurrentLobbies
{
get { return m_currentLobbies; }
set
{
m_currentLobbies = value;
onLobbyListChange?.Invoke(m_currentLobbies);
}
}
}
}