internal static void InstallEvents() { LobbyInvite_t.Install(x => OnLobbyInvite?.Invoke(new Friend(x.SteamIDUser), new Lobby(x.SteamIDLobby))); LobbyEnter_t.Install(x => OnLobbyEntered?.Invoke(new Lobby(x.SteamIDLobby))); LobbyCreated_t.Install(x => OnLobbyCreated?.Invoke(x.Result, new Lobby(x.SteamIDLobby))); LobbyGameCreated_t.Install(x => OnLobbyGameCreated?.Invoke(new Lobby(x.SteamIDLobby), x.IP, x.Port, x.SteamIDGameServer)); LobbyDataUpdate_t.Install(x => { if (x.Success == 0) { return; } if (x.SteamIDLobby == x.SteamIDMember) { OnLobbyDataChanged?.Invoke(new Lobby(x.SteamIDLobby)); } else { OnLobbyMemberDataChanged?.Invoke(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDMember)); } }); LobbyChatUpdate_t.Install(x => { if ((x.GfChatMemberStateChange & (int)ChatMemberStateChange.Entered) != 0) { OnLobbyMemberJoined?.Invoke(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDUserChanged)); } if ((x.GfChatMemberStateChange & (int)ChatMemberStateChange.Left) != 0) { OnLobbyMemberLeave?.Invoke(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDUserChanged)); } if ((x.GfChatMemberStateChange & (int)ChatMemberStateChange.Disconnected) != 0) { OnLobbyMemberDisconnected?.Invoke(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDUserChanged)); } if ((x.GfChatMemberStateChange & (int)ChatMemberStateChange.Kicked) != 0) { OnLobbyMemberKicked?.Invoke(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDUserChanged), new Friend(x.SteamIDMakingChange)); } if ((x.GfChatMemberStateChange & (int)ChatMemberStateChange.Banned) != 0) { OnLobbyMemberBanned?.Invoke(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDUserChanged), new Friend(x.SteamIDMakingChange)); } }); LobbyChatMsg_t.Install(OnLobbyChatMessageRecievedAPI); }
internal static void InstallEvents() { LobbyInvite_t.Install((LobbyInvite_t x) => { Action <Friend, Lobby> onLobbyInvite = SteamMatchmaking.OnLobbyInvite; if (onLobbyInvite != null) { onLobbyInvite(new Friend(x.SteamIDUser), new Lobby(x.SteamIDLobby)); } else { } }, false); LobbyDataUpdate_t.Install((LobbyDataUpdate_t x) => { if (x.Success != 0) { if (x.SteamIDLobby != x.SteamIDMember) { Action <Lobby, Friend> onLobbyMemberDataChanged = SteamMatchmaking.OnLobbyMemberDataChanged; if (onLobbyMemberDataChanged != null) { onLobbyMemberDataChanged(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDMember)); } else { } } else { Action <Lobby> onLobbyDataChanged = SteamMatchmaking.OnLobbyDataChanged; if (onLobbyDataChanged != null) { onLobbyDataChanged(new Lobby(x.SteamIDLobby)); } else { } } } }, false); LobbyChatUpdate_t.Install((LobbyChatUpdate_t x) => { if ((x.GfChatMemberStateChange & 1) != 0) { Action <Lobby, Friend> onLobbyMemberJoined = SteamMatchmaking.OnLobbyMemberJoined; if (onLobbyMemberJoined != null) { onLobbyMemberJoined(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDUserChanged)); } else { } } if ((x.GfChatMemberStateChange & 2) != 0) { Action <Lobby, Friend> onLobbyMemberLeave = SteamMatchmaking.OnLobbyMemberLeave; if (onLobbyMemberLeave != null) { onLobbyMemberLeave(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDUserChanged)); } else { } } if ((x.GfChatMemberStateChange & 4) != 0) { Action <Lobby, Friend> onLobbyMemberDisconnected = SteamMatchmaking.OnLobbyMemberDisconnected; if (onLobbyMemberDisconnected != null) { onLobbyMemberDisconnected(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDUserChanged)); } else { } } if ((x.GfChatMemberStateChange & 8) != 0) { Action <Lobby, Friend, Friend> onLobbyMemberKicked = SteamMatchmaking.OnLobbyMemberKicked; if (onLobbyMemberKicked != null) { onLobbyMemberKicked(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDUserChanged), new Friend(x.SteamIDMakingChange)); } else { } } if ((x.GfChatMemberStateChange & 16) != 0) { Action <Lobby, Friend, Friend> onLobbyMemberBanned = SteamMatchmaking.OnLobbyMemberBanned; if (onLobbyMemberBanned != null) { onLobbyMemberBanned(new Lobby(x.SteamIDLobby), new Friend(x.SteamIDUserChanged), new Friend(x.SteamIDMakingChange)); } else { } } }, false); LobbyChatMsg_t.Install(new Action <LobbyChatMsg_t>(SteamMatchmaking.OnLobbyChatMessageRecievedAPI), false); }
void OnLobbyChatUpdate(LobbyChatUpdate_t pCallback) { Debug.Log("[" + LobbyChatUpdate_t.k_iCallback + " - LobbyChatUpdate] - " + pCallback.m_ulSteamIDLobby + " -- " + pCallback.m_ulSteamIDUserChanged + " -- " + pCallback.m_ulSteamIDMakingChange + " -- " + pCallback.m_rgfChatMemberStateChange); }