using System.Collections.Generic; namespace Facepunch.Steamworks { public partial class Lobby { /// /// Class to hold global lobby data. This is stuff like maps/modes/etc. Data set here can be filtered by LobbyList. /// public class LobbyData { internal Client client; internal ulong lobby; internal Dictionary data; public LobbyData( Client c, ulong l ) { client = c; lobby = l; data = new Dictionary(); } /// /// Get the lobby value for the specific key /// /// The key to find /// The value at key public string GetData( string k ) { if ( data.ContainsKey( k ) ) { return data[k]; } return "ERROR: key not found"; } /// /// Get a list of all the data in the Lobby /// /// Dictionary of all the key/value pairs in the data public Dictionary GetAllData() { Dictionary returnData = new Dictionary(); foreach ( KeyValuePair item in data ) { returnData.Add( item.Key, item.Value ); } return returnData; } /// /// Set the value for specified Key. Note that the keys "joinable", "appid", "name", and "lobbytype" are reserved for internal library use. /// /// The key to set the value for /// The value of the Key /// True if data successfully set public bool SetData( string k, string v ) { if ( data.ContainsKey( k ) ) { if ( data[k] == v ) { return true; } if ( client.native.matchmaking.SetLobbyData( lobby, k, v ) ) { data[k] = v; return true; } } else { if ( client.native.matchmaking.SetLobbyData( lobby, k, v ) ) { data.Add( k, v ); return true; } } return false; } /// /// Remove the key from the LobbyData. Note that the keys "joinable", "appid", "name", and "lobbytype" are reserved for internal library use. /// /// The key to remove /// True if Key successfully removed public bool RemoveData( string k ) { if ( data.ContainsKey( k ) ) { if ( client.native.matchmaking.DeleteLobbyData( lobby, k ) ) { data.Remove( k ); return true; } } return false; } } /*not implemented //set the game server of the lobby client.native.matchmaking.GetLobbyGameServer; client.native.matchmaking.SetLobbyGameServer; //used with game server stuff SteamNative.LobbyGameCreated_t */ } }