mirror of
https://github.com/Facepunch/Facepunch.Steamworks.git
synced 2024-12-25 06:05:46 +03:00
Small README update and adjusts doc tags for Lobby functions.
This commit is contained in:
parent
bef249000a
commit
5067c32eed
@ -49,6 +49,9 @@ public Lobby(Client c)
|
||||
/// </summary>
|
||||
public ulong CurrentLobby { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// The LobbyData of the CurrentLobby. Note this is the global data for the lobby. Use SetMemberData to set specific member data.
|
||||
/// </summary>
|
||||
public LobbyData CurrentLobbyData { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
@ -139,6 +142,11 @@ public LobbyData(Client c, ulong l)
|
||||
data = new Dictionary<string, string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the lobby value for the specific key
|
||||
/// </summary>
|
||||
/// <param name="k">The key to find</param>
|
||||
/// <returns>The value at key</returns>
|
||||
public string GetData(string k)
|
||||
{
|
||||
if (data.ContainsKey(k))
|
||||
@ -149,16 +157,26 @@ public string GetData(string k)
|
||||
return "ERROR: key not found";
|
||||
}
|
||||
|
||||
public List<KeyValuePair<string,string>> GetAllData()
|
||||
/// <summary>
|
||||
/// Get a list of all the data in the Lobby
|
||||
/// </summary>
|
||||
/// <returns>Dictionary of all the key/value pairs in the data</returns>
|
||||
public Dictionary<string,string> GetAllData()
|
||||
{
|
||||
List<KeyValuePair<string, string>> returnData = new List<KeyValuePair<string, string>>();
|
||||
Dictionary<string, string> returnData = new Dictionary<string, string>();
|
||||
foreach(KeyValuePair<string, string> item in data)
|
||||
{
|
||||
returnData.Add(new KeyValuePair<string, string>(item.Key, item.Value));
|
||||
returnData.Add(item.Key, item.Value);
|
||||
}
|
||||
return returnData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Set the value for specified Key. Note that the keys "joinable", "appid", "name", and "lobbytype" are reserved for internal library use.
|
||||
/// </summary>
|
||||
/// <param name="k">The key to set the value for</param>
|
||||
/// <param name="v">The value of the Key</param>
|
||||
/// <returns>True if data successfully set</returns>
|
||||
public bool SetData(string k, string v)
|
||||
{
|
||||
if (data.ContainsKey(k))
|
||||
@ -182,6 +200,11 @@ public bool SetData(string k, string v)
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove the key from the LobbyData. Note that the keys "joinable", "appid", "name", and "lobbytype" are reserved for internal library use.
|
||||
/// </summary>
|
||||
/// <param name="k">The key to remove</param>
|
||||
/// <returns>True if Key successfully removed</returns>
|
||||
public bool RemoveData(string k)
|
||||
{
|
||||
if (data.ContainsKey(k))
|
||||
@ -339,6 +362,9 @@ public unsafe bool SendChatMessage(string message)
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enums to catch the state of a user when their state has changed
|
||||
/// </summary>
|
||||
public enum MemberStateChange
|
||||
{
|
||||
Entered = ChatMemberStateChange.Entered,
|
||||
@ -490,6 +516,11 @@ public ulong[] GetMemberIDs()
|
||||
return memIDs;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if a user is in your CurrentLobby
|
||||
/// </summary>
|
||||
/// <param name="steamID">SteamID of the user to check for</param>
|
||||
/// <returns></returns>
|
||||
public bool UserIsInCurrentLobby(ulong steamID)
|
||||
{
|
||||
if(CurrentLobby == 0) { return false; }
|
||||
@ -527,7 +558,7 @@ internal void OnUserInvitedToLobbyAPI(LobbyInvite_t callback, bool error)
|
||||
public Action<ulong, ulong> OnUserInvitedToLobby;
|
||||
|
||||
/// <summary>
|
||||
/// Joins a lobby is a request was made to join the lobby through the friends list or an invite
|
||||
/// Joins a lobby if a request was made to join the lobby through the friends list or an invite
|
||||
/// </summary>
|
||||
internal void OnLobbyJoinRequestedAPI(GameLobbyJoinRequested_t callback, bool error)
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ You can view examples of everything in the Facepunch.Steamworks.Test project.
|
||||
|
||||
## Client
|
||||
|
||||
Compile and add the library to your project. To create a client you can do this.
|
||||
Compile the Facepunch.Steamworks project and add the library to your Unity project. To create a client you can do this.
|
||||
|
||||
```csharp
|
||||
var client = new Facepunch.Steamworks.Client( 252490 );
|
||||
@ -72,7 +72,6 @@ This will register a secure server for game 252490, any ip, port 28015. Again, m
|
||||
|
||||
To create a Lobby do this.
|
||||
```csharp
|
||||
var client = new Facepunch.Steamworks.Client( 252490 );
|
||||
client.Lobby.Create(Steamworks.Lobby.Type.Public, 10);
|
||||
```
|
||||
|
||||
@ -94,6 +93,8 @@ client.LobbyList.OnLobbiesUpdated = () =>
|
||||
client.Lobby.Join(LobbyList.Lobbies[0]);
|
||||
```
|
||||
|
||||
Your can find more examples of Lobby functionality in the Lobby.cs file in the test project. Sending chat messages, assinging lobby data and member data, etc.
|
||||
|
||||
|
||||
# Unity
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user