Example #1
0
        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);
        }
	void OnLobbyGameCreated(LobbyGameCreated_t pCallback) {
		Debug.Log("[" + LobbyGameCreated_t.k_iCallback + " - LobbyGameCreated] - " + pCallback.m_ulSteamIDLobby + " -- " + pCallback.m_ulSteamIDGameServer + " -- " + pCallback.m_unIP + " -- " + pCallback.m_usPort);
	}