Fixes OnChatStringRecieved returning previous message data

This commit is contained in:
Garry Newman 2018-02-14 11:35:16 +00:00
parent c4f33a1d3d
commit a82f6fc8ed

View File

@ -13,8 +13,8 @@ public Lobby Lobby
{ {
get get
{ {
if (_lobby == null) if ( _lobby == null )
_lobby = new Steamworks.Lobby(this); _lobby = new Steamworks.Lobby( this );
return _lobby; return _lobby;
} }
} }
@ -33,15 +33,15 @@ public enum Type : int
internal Client client; internal Client client;
public Lobby(Client c) public Lobby( Client c )
{ {
client = c; client = c;
SteamNative.LobbyDataUpdate_t.RegisterCallback(client, OnLobbyDataUpdatedAPI); SteamNative.LobbyDataUpdate_t.RegisterCallback( client, OnLobbyDataUpdatedAPI );
SteamNative.LobbyChatMsg_t.RegisterCallback(client, OnLobbyChatMessageRecievedAPI); SteamNative.LobbyChatMsg_t.RegisterCallback( client, OnLobbyChatMessageRecievedAPI );
SteamNative.LobbyChatUpdate_t.RegisterCallback(client, OnLobbyStateUpdatedAPI); SteamNative.LobbyChatUpdate_t.RegisterCallback( client, OnLobbyStateUpdatedAPI );
SteamNative.GameLobbyJoinRequested_t.RegisterCallback(client, OnLobbyJoinRequestedAPI); SteamNative.GameLobbyJoinRequested_t.RegisterCallback( client, OnLobbyJoinRequestedAPI );
SteamNative.LobbyInvite_t.RegisterCallback(client, OnUserInvitedToLobbyAPI); SteamNative.LobbyInvite_t.RegisterCallback( client, OnUserInvitedToLobbyAPI );
SteamNative.PersonaStateChange_t.RegisterCallback(client, OnLobbyMemberPersonaChangeAPI); SteamNative.PersonaStateChange_t.RegisterCallback( client, OnLobbyMemberPersonaChangeAPI );
} }
/// <summary> /// <summary>
@ -63,23 +63,23 @@ public Lobby(Client c)
/// Join a Lobby through its LobbyID. OnLobbyJoined is called with the result of the Join attempt. /// Join a Lobby through its LobbyID. OnLobbyJoined is called with the result of the Join attempt.
/// </summary> /// </summary>
/// <param name="lobbyID">CSteamID of lobby to join</param> /// <param name="lobbyID">CSteamID of lobby to join</param>
public void Join(ulong lobbyID) public void Join( ulong lobbyID )
{ {
Leave(); Leave();
client.native.matchmaking.JoinLobby(lobbyID, OnLobbyJoinedAPI); client.native.matchmaking.JoinLobby( lobbyID, OnLobbyJoinedAPI );
} }
void OnLobbyJoinedAPI(LobbyEnter_t callback, bool error) void OnLobbyJoinedAPI( LobbyEnter_t callback, bool error )
{ {
if (error || (callback.EChatRoomEnterResponse != (uint)(SteamNative.ChatRoomEnterResponse.Success))) if ( error || (callback.EChatRoomEnterResponse != (uint)(SteamNative.ChatRoomEnterResponse.Success)) )
{ {
if (OnLobbyJoined != null) { OnLobbyJoined(false); } if ( OnLobbyJoined != null ) { OnLobbyJoined( false ); }
return; return;
} }
CurrentLobby = callback.SteamIDLobby; CurrentLobby = callback.SteamIDLobby;
UpdateLobbyData(); UpdateLobbyData();
if (OnLobbyJoined != null) { OnLobbyJoined(true); } if ( OnLobbyJoined != null ) { OnLobbyJoined( true ); }
} }
/// <summary> /// <summary>
@ -92,33 +92,33 @@ void OnLobbyJoinedAPI(LobbyEnter_t callback, bool error)
/// </summary> /// </summary>
/// <param name="lobbyType">The Lobby.Type of Lobby to be created</param> /// <param name="lobbyType">The Lobby.Type of Lobby to be created</param>
/// <param name="maxMembers">The maximum amount of people you want to be able to be in this lobby, including yourself</param> /// <param name="maxMembers">The maximum amount of people you want to be able to be in this lobby, including yourself</param>
public void Create(Lobby.Type lobbyType, int maxMembers) public void Create( Lobby.Type lobbyType, int maxMembers )
{ {
client.native.matchmaking.CreateLobby((SteamNative.LobbyType)lobbyType, maxMembers, OnLobbyCreatedAPI); client.native.matchmaking.CreateLobby( (SteamNative.LobbyType)lobbyType, maxMembers, OnLobbyCreatedAPI );
createdLobbyType = lobbyType; createdLobbyType = lobbyType;
} }
internal Type createdLobbyType; internal Type createdLobbyType;
internal void OnLobbyCreatedAPI(LobbyCreated_t callback, bool error) internal void OnLobbyCreatedAPI( LobbyCreated_t callback, bool error )
{ {
//from SpaceWarClient.cpp 793 //from SpaceWarClient.cpp 793
if (error || (callback.Result != Result.OK)) if ( error || (callback.Result != Result.OK) )
{ {
if ( OnLobbyCreated != null) { OnLobbyCreated(false); } if ( OnLobbyCreated != null ) { OnLobbyCreated( false ); }
return; return;
} }
//set owner specific properties //set owner specific properties
Owner = client.SteamId; Owner = client.SteamId;
CurrentLobby = callback.SteamIDLobby; CurrentLobby = callback.SteamIDLobby;
CurrentLobbyData = new LobbyData(client, CurrentLobby); CurrentLobbyData = new LobbyData( client, CurrentLobby );
Name = client.Username + "'s Lobby"; Name = client.Username + "'s Lobby";
CurrentLobbyData.SetData("appid", client.AppId.ToString()); CurrentLobbyData.SetData( "appid", client.AppId.ToString() );
LobbyType = createdLobbyType; LobbyType = createdLobbyType;
CurrentLobbyData.SetData("lobbytype", LobbyType.ToString()); CurrentLobbyData.SetData( "lobbytype", LobbyType.ToString() );
Joinable = true; Joinable = true;
if (OnLobbyCreated != null) { OnLobbyCreated(true); } if ( OnLobbyCreated != null ) { OnLobbyCreated( true ); }
} }
/// <summary> /// <summary>
@ -135,7 +135,7 @@ public class LobbyData
internal ulong lobby; internal ulong lobby;
internal Dictionary<string, string> data; internal Dictionary<string, string> data;
public LobbyData(Client c, ulong l) public LobbyData( Client c, ulong l )
{ {
client = c; client = c;
lobby = l; lobby = l;
@ -147,9 +147,9 @@ public LobbyData(Client c, ulong l)
/// </summary> /// </summary>
/// <param name="k">The key to find</param> /// <param name="k">The key to find</param>
/// <returns>The value at key</returns> /// <returns>The value at key</returns>
public string GetData(string k) public string GetData( string k )
{ {
if (data.ContainsKey(k)) if ( data.ContainsKey( k ) )
{ {
return data[k]; return data[k];
} }
@ -161,12 +161,12 @@ public string GetData(string k)
/// Get a list of all the data in the Lobby /// Get a list of all the data in the Lobby
/// </summary> /// </summary>
/// <returns>Dictionary of all the key/value pairs in the data</returns> /// <returns>Dictionary of all the key/value pairs in the data</returns>
public Dictionary<string,string> GetAllData() public Dictionary<string, string> GetAllData()
{ {
Dictionary<string, string> returnData = new Dictionary<string, string>(); Dictionary<string, string> returnData = new Dictionary<string, string>();
foreach(KeyValuePair<string, string> item in data) foreach ( KeyValuePair<string, string> item in data )
{ {
returnData.Add(item.Key, item.Value); returnData.Add( item.Key, item.Value );
} }
return returnData; return returnData;
} }
@ -177,12 +177,12 @@ public Dictionary<string,string> GetAllData()
/// <param name="k">The key to set the value for</param> /// <param name="k">The key to set the value for</param>
/// <param name="v">The value of the Key</param> /// <param name="v">The value of the Key</param>
/// <returns>True if data successfully set</returns> /// <returns>True if data successfully set</returns>
public bool SetData(string k, string v) public bool SetData( string k, string v )
{ {
if (data.ContainsKey(k)) if ( data.ContainsKey( k ) )
{ {
if (data[k] == v) { return true; } if ( data[k] == v ) { return true; }
if (client.native.matchmaking.SetLobbyData(lobby, k, v)) if ( client.native.matchmaking.SetLobbyData( lobby, k, v ) )
{ {
data[k] = v; data[k] = v;
return true; return true;
@ -190,9 +190,9 @@ public bool SetData(string k, string v)
} }
else else
{ {
if (client.native.matchmaking.SetLobbyData(lobby, k, v)) if ( client.native.matchmaking.SetLobbyData( lobby, k, v ) )
{ {
data.Add(k, v); data.Add( k, v );
return true; return true;
} }
} }
@ -205,13 +205,13 @@ public bool SetData(string k, string v)
/// </summary> /// </summary>
/// <param name="k">The key to remove</param> /// <param name="k">The key to remove</param>
/// <returns>True if Key successfully removed</returns> /// <returns>True if Key successfully removed</returns>
public bool RemoveData(string k) public bool RemoveData( string k )
{ {
if (data.ContainsKey(k)) if ( data.ContainsKey( k ) )
{ {
if (client.native.matchmaking.DeleteLobbyData(lobby, k)) if ( client.native.matchmaking.DeleteLobbyData( lobby, k ) )
{ {
data.Remove(k); data.Remove( k );
return true; return true;
} }
} }
@ -224,10 +224,10 @@ public bool RemoveData(string k)
/// <summary> /// <summary>
/// Sets user data for the Lobby. Things like Character, Skin, Ready, etc. Can only set your own member data /// Sets user data for the Lobby. Things like Character, Skin, Ready, etc. Can only set your own member data
/// </summary> /// </summary>
public void SetMemberData(string key, string value) public void SetMemberData( string key, string value )
{ {
if(CurrentLobby == 0) { return; } if ( CurrentLobby == 0 ) { return; }
client.native.matchmaking.SetLobbyMemberData(CurrentLobby, key, value); client.native.matchmaking.SetLobbyMemberData( CurrentLobby, key, value );
} }
/// <summary> /// <summary>
@ -236,23 +236,23 @@ public void SetMemberData(string key, string value)
/// <param name="steamID">ulong SteamID of the user you want to get data from</param> /// <param name="steamID">ulong SteamID of the user you want to get data from</param>
/// <param name="key">String key of the type of data you want to get</param> /// <param name="key">String key of the type of data you want to get</param>
/// <returns></returns> /// <returns></returns>
public string GetMemberData(ulong steamID, string key) public string GetMemberData( ulong steamID, string key )
{ {
if (CurrentLobby == 0) { return "ERROR: NOT IN ANY LOBBY"; } if ( CurrentLobby == 0 ) { return "ERROR: NOT IN ANY LOBBY"; }
return client.native.matchmaking.GetLobbyMemberData(CurrentLobby, steamID, key); return client.native.matchmaking.GetLobbyMemberData( CurrentLobby, steamID, key );
} }
internal void OnLobbyDataUpdatedAPI(LobbyDataUpdate_t callback, bool error) internal void OnLobbyDataUpdatedAPI( LobbyDataUpdate_t callback, bool error )
{ {
if(error || (callback.SteamIDLobby != CurrentLobby)) { return; } if ( error || (callback.SteamIDLobby != CurrentLobby) ) { return; }
if(callback.SteamIDLobby == CurrentLobby) //actual lobby data was updated by owner if ( callback.SteamIDLobby == CurrentLobby ) //actual lobby data was updated by owner
{ {
UpdateLobbyData(); UpdateLobbyData();
} }
if(UserIsInCurrentLobby(callback.SteamIDMember)) //some member of this lobby updated their information if ( UserIsInCurrentLobby( callback.SteamIDMember ) ) //some member of this lobby updated their information
{ {
if (OnLobbyMemberDataUpdated != null) { OnLobbyMemberDataUpdated(callback.SteamIDMember); } if ( OnLobbyMemberDataUpdated != null ) { OnLobbyMemberDataUpdated( callback.SteamIDMember ); }
} }
} }
@ -261,17 +261,17 @@ internal void OnLobbyDataUpdatedAPI(LobbyDataUpdate_t callback, bool error)
/// </summary> /// </summary>
internal void UpdateLobbyData() internal void UpdateLobbyData()
{ {
int dataCount = client.native.matchmaking.GetLobbyDataCount(CurrentLobby); int dataCount = client.native.matchmaking.GetLobbyDataCount( CurrentLobby );
CurrentLobbyData = new LobbyData(client, CurrentLobby); CurrentLobbyData = new LobbyData( client, CurrentLobby );
for (int i = 0; i < dataCount; i++) for ( int i = 0; i < dataCount; i++ )
{ {
if (client.native.matchmaking.GetLobbyDataByIndex(CurrentLobby, i, out string key, out string value)) if ( client.native.matchmaking.GetLobbyDataByIndex( CurrentLobby, i, out string key, out string value ) )
{ {
CurrentLobbyData.SetData(key, value); CurrentLobbyData.SetData( key, value );
} }
} }
if(OnLobbyDataUpdated != null) { OnLobbyDataUpdated(); } if ( OnLobbyDataUpdated != null ) { OnLobbyDataUpdated(); }
} }
/// <summary> /// <summary>
@ -289,12 +289,12 @@ public Type LobbyType
{ {
get get
{ {
if (!IsValid) { return Type.Error; } //if we're currently in a valid server if ( !IsValid ) { return Type.Error; } //if we're currently in a valid server
//we know that we've set the lobby type via the lobbydata in the creation function //we know that we've set the lobby type via the lobbydata in the creation function
//ps this is important because steam doesn't have an easy way to get lobby type (why idk) //ps this is important because steam doesn't have an easy way to get lobby type (why idk)
string lobbyType = CurrentLobbyData.GetData("lobbytype"); string lobbyType = CurrentLobbyData.GetData( "lobbytype" );
switch (lobbyType) switch ( lobbyType )
{ {
case "Private": case "Private":
return Type.Private; return Type.Private;
@ -310,32 +310,37 @@ public Type LobbyType
} }
set set
{ {
if(!IsValid) { return; } if ( !IsValid ) { return; }
if(client.native.matchmaking.SetLobbyType(CurrentLobby, (SteamNative.LobbyType)value)) if ( client.native.matchmaking.SetLobbyType( CurrentLobby, (SteamNative.LobbyType)value ) )
{ {
CurrentLobbyData.SetData("lobbytype", value.ToString()); CurrentLobbyData.SetData( "lobbytype", value.ToString() );
} }
} }
} }
private static byte[] chatMessageData = new byte[1024 * 4]; private static byte[] chatMessageData = new byte[1024 * 4];
private unsafe void OnLobbyChatMessageRecievedAPI(LobbyChatMsg_t callback, bool error) private unsafe void OnLobbyChatMessageRecievedAPI( LobbyChatMsg_t callback, bool error )
{ {
//from Client.Networking //from Client.Networking
if(error || callback.SteamIDLobby != CurrentLobby) if ( error || callback.SteamIDLobby != CurrentLobby )
return; return;
SteamNative.CSteamID steamid = 1; SteamNative.CSteamID steamid = 1;
ChatEntryType chatEntryType; // "If set then this will just always return k_EChatEntryTypeChatMsg. This can usually just be set to NULL." ChatEntryType chatEntryType; // "If set then this will just always return k_EChatEntryTypeChatMsg. This can usually just be set to NULL."
int readData = 0; int readData = 0;
fixed (byte* p = chatMessageData) fixed ( byte* p = chatMessageData )
{ {
readData = client.native.matchmaking.GetLobbyChatEntry(CurrentLobby, (int)callback.ChatID, out steamid, (IntPtr)p, chatMessageData.Length, out chatEntryType); readData = client.native.matchmaking.GetLobbyChatEntry( CurrentLobby, (int)callback.ChatID, out steamid, (IntPtr)p, chatMessageData.Length, out chatEntryType );
} }
OnChatMessageRecieved?.Invoke(steamid, chatMessageData, readData);
OnChatStringRecieved?.Invoke(steamid, Encoding.UTF8.GetString(chatMessageData)); OnChatMessageRecieved?.Invoke( steamid, chatMessageData, readData );
if ( readData > 0 )
{
OnChatStringRecieved?.Invoke( steamid, Encoding.UTF8.GetString( chatMessageData, 0, readData ) );
}
} }
/// <summary> /// <summary>
@ -352,14 +357,14 @@ private unsafe void OnLobbyChatMessageRecievedAPI(LobbyChatMsg_t callback, bool
/// Broadcasts a chat message to the all the users in the lobby users in the lobby (including the local user) will receive a LobbyChatMsg_t callback. /// Broadcasts a chat message to the all the users in the lobby users in the lobby (including the local user) will receive a LobbyChatMsg_t callback.
/// </summary> /// </summary>
/// <returns>True if message successfully sent</returns> /// <returns>True if message successfully sent</returns>
public unsafe bool SendChatMessage(string message) public unsafe bool SendChatMessage( string message )
{ {
var data = Encoding.UTF8.GetBytes(message); var data = Encoding.UTF8.GetBytes( message );
fixed (byte* p = data) fixed ( byte* p = data )
{ {
// pvMsgBody can be binary or text data, up to 4k // pvMsgBody can be binary or text data, up to 4k
// if pvMsgBody is text, cubMsgBody should be strlen( text ) + 1, to include the null terminator // if pvMsgBody is text, cubMsgBody should be strlen( text ) + 1, to include the null terminator
return client.native.matchmaking.SendLobbyChatMsg(CurrentLobby, (IntPtr)p, data.Length); return client.native.matchmaking.SendLobbyChatMsg( CurrentLobby, (IntPtr)p, data.Length );
} }
} }
@ -375,16 +380,16 @@ public enum MemberStateChange
Banned = ChatMemberStateChange.Banned, Banned = ChatMemberStateChange.Banned,
} }
internal void OnLobbyStateUpdatedAPI(LobbyChatUpdate_t callback, bool error) internal void OnLobbyStateUpdatedAPI( LobbyChatUpdate_t callback, bool error )
{ {
if (error || callback.SteamIDLobby != CurrentLobby) if ( error || callback.SteamIDLobby != CurrentLobby )
return; return;
MemberStateChange change = (MemberStateChange)callback.GfChatMemberStateChange; MemberStateChange change = (MemberStateChange)callback.GfChatMemberStateChange;
ulong initiator = callback.SteamIDMakingChange; ulong initiator = callback.SteamIDMakingChange;
ulong affected = callback.SteamIDUserChanged; ulong affected = callback.SteamIDUserChanged;
OnLobbyStateChanged?.Invoke(change, initiator, affected); OnLobbyStateChanged?.Invoke( change, initiator, affected );
} }
/// <summary> /// <summary>
@ -401,13 +406,13 @@ public string Name
{ {
get get
{ {
if (!IsValid) { return ""; } if ( !IsValid ) { return ""; }
return CurrentLobbyData.GetData("name"); return CurrentLobbyData.GetData( "name" );
} }
set set
{ {
if (!IsValid) { return; } if ( !IsValid ) { return; }
CurrentLobbyData.SetData("name", value); CurrentLobbyData.SetData( "name", value );
} }
} }
@ -418,16 +423,16 @@ public ulong Owner
{ {
get get
{ {
if (IsValid) if ( IsValid )
{ {
return client.native.matchmaking.GetLobbyOwner(CurrentLobby); return client.native.matchmaking.GetLobbyOwner( CurrentLobby );
} }
return 0; return 0;
} }
set set
{ {
if (Owner == value) return; if ( Owner == value ) return;
client.native.matchmaking.SetLobbyOwner(CurrentLobby, value); client.native.matchmaking.SetLobbyOwner( CurrentLobby, value );
} }
} }
@ -438,9 +443,9 @@ public bool Joinable
{ {
get get
{ {
if (!IsValid) { return false; } if ( !IsValid ) { return false; }
string joinable = CurrentLobbyData.GetData("joinable"); string joinable = CurrentLobbyData.GetData( "joinable" );
switch (joinable) switch ( joinable )
{ {
case "true": case "true":
return true; return true;
@ -452,10 +457,10 @@ public bool Joinable
} }
set set
{ {
if (!IsValid) { return; } if ( !IsValid ) { return; }
if (client.native.matchmaking.SetLobbyJoinable(CurrentLobby, value)) if ( client.native.matchmaking.SetLobbyJoinable( CurrentLobby, value ) )
{ {
CurrentLobbyData.SetData("joinable", value.ToString()); CurrentLobbyData.SetData( "joinable", value.ToString() );
} }
} }
} }
@ -467,13 +472,13 @@ public int MaxMembers
{ {
get get
{ {
if (!IsValid) { return 0; } //0 is default, but value is inited when lobby is created. if ( !IsValid ) { return 0; } //0 is default, but value is inited when lobby is created.
return client.native.matchmaking.GetLobbyMemberLimit(CurrentLobby); return client.native.matchmaking.GetLobbyMemberLimit( CurrentLobby );
} }
set set
{ {
if (!IsValid) { return; } if ( !IsValid ) { return; }
client.native.matchmaking.SetLobbyMemberLimit(CurrentLobby, value); client.native.matchmaking.SetLobbyMemberLimit( CurrentLobby, value );
} }
} }
@ -482,7 +487,7 @@ public int MaxMembers
/// </summary> /// </summary>
public int NumMembers public int NumMembers
{ {
get { return client.native.matchmaking.GetNumLobbyMembers(CurrentLobby);} get { return client.native.matchmaking.GetNumLobbyMembers( CurrentLobby ); }
} }
/// <summary> /// <summary>
@ -490,9 +495,9 @@ public int NumMembers
/// </summary> /// </summary>
public void Leave() public void Leave()
{ {
if (CurrentLobby != 0) if ( CurrentLobby != 0 )
{ {
client.native.matchmaking.LeaveLobby(CurrentLobby); client.native.matchmaking.LeaveLobby( CurrentLobby );
} }
CurrentLobby = 0; CurrentLobby = 0;
@ -513,9 +518,9 @@ public void Dispose()
public ulong[] GetMemberIDs() public ulong[] GetMemberIDs()
{ {
ulong[] memIDs = new ulong[NumMembers]; ulong[] memIDs = new ulong[NumMembers];
for (int i = 0; i < NumMembers; i++) for ( int i = 0; i < NumMembers; i++ )
{ {
memIDs[i] = client.native.matchmaking.GetLobbyMemberByIndex(CurrentLobby, i); memIDs[i] = client.native.matchmaking.GetLobbyMemberByIndex( CurrentLobby, i );
} }
return memIDs; return memIDs;
} }
@ -525,14 +530,14 @@ public ulong[] GetMemberIDs()
/// </summary> /// </summary>
/// <param name="steamID">SteamID of the user to check for</param> /// <param name="steamID">SteamID of the user to check for</param>
/// <returns></returns> /// <returns></returns>
public bool UserIsInCurrentLobby(ulong steamID) public bool UserIsInCurrentLobby( ulong steamID )
{ {
if ( CurrentLobby == 0 ) if ( CurrentLobby == 0 )
return false; return false;
ulong[] mems = GetMemberIDs(); ulong[] mems = GetMemberIDs();
for (int i = 0; i < mems.Length; i++) for ( int i = 0; i < mems.Length; i++ )
{ {
if ( mems[i] == steamID ) if ( mems[i] == steamID )
return true; return true;
@ -545,15 +550,15 @@ public bool UserIsInCurrentLobby(ulong steamID)
/// Invites the specified user to the CurrentLobby the user is in. /// Invites the specified user to the CurrentLobby the user is in.
/// </summary> /// </summary>
/// <param name="friendID">ulong ID of person to invite</param> /// <param name="friendID">ulong ID of person to invite</param>
public bool InviteUserToLobby(ulong friendID) public bool InviteUserToLobby( ulong friendID )
{ {
return client.native.matchmaking.InviteUserToLobby(CurrentLobby, friendID); return client.native.matchmaking.InviteUserToLobby( CurrentLobby, friendID );
} }
internal void OnUserInvitedToLobbyAPI(LobbyInvite_t callback, bool error) internal void OnUserInvitedToLobbyAPI( LobbyInvite_t callback, bool error )
{ {
if (error || (callback.GameID != client.AppId)) { return; } if ( error || (callback.GameID != client.AppId) ) { return; }
if (OnUserInvitedToLobby != null) { OnUserInvitedToLobby(callback.SteamIDLobby, callback.SteamIDUser); } if ( OnUserInvitedToLobby != null ) { OnUserInvitedToLobby( callback.SteamIDLobby, callback.SteamIDUser ); }
} }
@ -565,19 +570,19 @@ internal void OnUserInvitedToLobbyAPI(LobbyInvite_t callback, bool error)
/// <summary> /// <summary>
/// Joins a lobby if 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> /// </summary>
internal void OnLobbyJoinRequestedAPI(GameLobbyJoinRequested_t callback, bool error) internal void OnLobbyJoinRequestedAPI( GameLobbyJoinRequested_t callback, bool error )
{ {
if (error) { return; } if ( error ) { return; }
Join(callback.SteamIDLobby); Join( callback.SteamIDLobby );
} }
/// <summary> /// <summary>
/// Makes sure we send an update callback if a Lobby user updates their information /// Makes sure we send an update callback if a Lobby user updates their information
/// </summary> /// </summary>
internal void OnLobbyMemberPersonaChangeAPI(PersonaStateChange_t callback, bool error) internal void OnLobbyMemberPersonaChangeAPI( PersonaStateChange_t callback, bool error )
{ {
if (error || !UserIsInCurrentLobby(callback.SteamID)) { return; } if ( error || !UserIsInCurrentLobby( callback.SteamID ) ) { return; }
if (OnLobbyMemberDataUpdated != null) { OnLobbyMemberDataUpdated(callback.SteamID); } if ( OnLobbyMemberDataUpdated != null ) { OnLobbyMemberDataUpdated( callback.SteamID ); }
} }
/*not implemented /*not implemented