Пример #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);
        }
        internal async Task <LobbyEnter_t?> JoinLobby(SteamId steamIDLobby)
        {
            var returnValue = _JoinLobby(Self, steamIDLobby);

            return(await LobbyEnter_t.GetResultAsync(returnValue));
        }
Пример #3
0
 private static void LobbyEnter(LobbyEnter_t param)
 {
     try
     {
         CSteamID id = new CSteamID(param.m_ulSteamIDLobby);
         if (id.IsValid() && param.m_EChatRoomEnterResponse == 1u)
         {
             CoopLobbyInfo lobbyInfo = CoopLobbyManager.GetLobbyInfo(id);
             lobbyInfo.UpdateData();
             CoopLobby.SetActive(lobbyInfo);
             if (CoopLobbyManager.enterCallback != null)
             {
                 CoopLobbyManager.enterCallback();
             }
         }
         else if (CoopLobbyManager.enterFailCallback != null)
         {
             CoopLobbyManager.enterFailCallback();
         }
     }
     finally
     {
         CoopLobbyManager.enterCallback = null;
         CoopLobbyManager.enterFailCallback = null;
     }
 }
 internal async Task <LobbyEnter_t?> JoinLobby(SteamId steamIDLobby)
 {
     return(await LobbyEnter_t.GetResultAsync(_JoinLobby( Self, steamIDLobby )));
 }
Пример #5
0
        internal async Task <LobbyEnter_t?> JoinLobby(SteamId steamIDLobby)
        {
            LobbyEnter_t?resultAsync = await LobbyEnter_t.GetResultAsync(this._JoinLobby(this.Self, steamIDLobby));

            return(resultAsync);
        }
	void OnLobbyEnter(LobbyEnter_t pCallback, bool bIOFailure) {
		Debug.Log("[" + LobbyEnter_t.k_iCallback + " - LobbyEnter] - " + pCallback.m_ulSteamIDLobby + " -- " + pCallback.m_rgfChatPermissions + " -- " + pCallback.m_bLocked + " -- " + pCallback.m_EChatRoomEnterResponse);
		m_Lobby = (CSteamID)pCallback.m_ulSteamIDLobby;
	}
		private void OnLobbyEntered(LobbyEnter_t result, bool failure)
		{
			SteamNetworking.AllowP2PPacketRelay(true);
			this.SendAuthTicket(this._lobby.Owner);
			int num = 0;
			P2PSessionState_t p2PSessionState_t;
			while (SteamNetworking.GetP2PSessionState(this._lobby.Owner, out p2PSessionState_t) && p2PSessionState_t.m_bConnectionActive != 1)
			{
				switch (p2PSessionState_t.m_eP2PSessionError)
				{
				case 1:
					this.ClearAuthTicket();
					return;
				case 2:
					this.ClearAuthTicket();
					return;
				case 3:
					this.ClearAuthTicket();
					return;
				case 4:
					if (++num > 5)
					{
						this.ClearAuthTicket();
						return;
					}
					SteamNetworking.CloseP2PSessionWithUser(this._lobby.Owner);
					this.SendAuthTicket(this._lobby.Owner);
					break;
				case 5:
					this.ClearAuthTicket();
					return;
				}
			}
			this._connectionStateMap[this._lobby.Owner] = NetSocialModule.ConnectionState.Connected;
			SteamFriends.SetPlayedWith(this._lobby.Owner);
			SteamFriends.SetRichPresence("status", "Playing online.");
			Main.clrInput();
			Netplay.ServerPassword = "";
			Main.GetInputText("");
			Main.autoPass = false;
			Main.netMode = 1;
			Netplay.OnConnectedToSocialServer(new SocialSocket(new SteamAddress(this._lobby.Owner)));
		}