Ejemplo n.º 1
0
 internal static void InstallEvents()
 {
     FriendStateChange_t.Install(x => OnPersonaStateChange?.Invoke(new Friend(x.SteamID)));
     GameRichPresenceJoinRequested_t.Install(x => OnGameRichPresenceJoinRequested?.Invoke(new Friend(x.SteamIDFriend), x.Connect));
     GameConnectedFriendChatMsg_t.Install(OnFriendChatMessage);
     GameOverlayActivated_t.Install(x => OnGameOverlayActivated?.Invoke());
     GameServerChangeRequested_t.Install(x => OnGameServerChangeRequested?.Invoke(x.Server, x.Password));
     GameLobbyJoinRequested_t.Install(x => OnGameLobbyJoinRequested?.Invoke(x.SteamIDLobby, x.SteamIDFriend));
     FriendRichPresenceUpdate_t.Install(x => OnFriendRichPresenceUpdate?.Invoke(new Friend(x.SteamIDFriend)));
 }
Ejemplo n.º 2
0
 internal static void InstallEvents()
 {
     FriendStateChange_t.Install((FriendStateChange_t x) => {
         Action <Friend> onPersonaStateChange = SteamFriends.OnPersonaStateChange;
         if (onPersonaStateChange != null)
         {
             onPersonaStateChange(new Friend(x.SteamID));
         }
         else
         {
         }
     }, false);
     GameRichPresenceJoinRequested_t.Install((GameRichPresenceJoinRequested_t x) => {
         Action <Friend, string> onGameRichPresenceJoinRequested = SteamFriends.OnGameRichPresenceJoinRequested;
         if (onGameRichPresenceJoinRequested != null)
         {
             onGameRichPresenceJoinRequested(new Friend(x.SteamIDFriend), x.Connect);
         }
         else
         {
         }
     }, false);
     GameConnectedFriendChatMsg_t.Install(new Action <GameConnectedFriendChatMsg_t>(SteamFriends.OnFriendChatMessage), false);
     GameOverlayActivated_t.Install((GameOverlayActivated_t x) => {
         Action onGameOverlayActivated = SteamFriends.OnGameOverlayActivated;
         if (onGameOverlayActivated != null)
         {
             onGameOverlayActivated();
         }
         else
         {
         }
     }, false);
     GameServerChangeRequested_t.Install((GameServerChangeRequested_t x) => {
         Action <string, string> onGameServerChangeRequested = SteamFriends.OnGameServerChangeRequested;
         if (onGameServerChangeRequested != null)
         {
             onGameServerChangeRequested(x.Server, x.Password);
         }
         else
         {
         }
     }, false);
     GameLobbyJoinRequested_t.Install((GameLobbyJoinRequested_t x) => {
         Action <Lobby, SteamId> onGameLobbyJoinRequested = SteamFriends.OnGameLobbyJoinRequested;
         if (onGameLobbyJoinRequested != null)
         {
             onGameLobbyJoinRequested(new Lobby(x.SteamIDLobby), x.SteamIDFriend);
         }
         else
         {
         }
     }, false);
     FriendRichPresenceUpdate_t.Install((FriendRichPresenceUpdate_t x) => {
         Action <Friend> onFriendRichPresenceUpdate = SteamFriends.OnFriendRichPresenceUpdate;
         if (onFriendRichPresenceUpdate != null)
         {
             onFriendRichPresenceUpdate(new Friend(x.SteamIDFriend));
         }
         else
         {
         }
     }, false);
 }
	void OnGameLobbyJoinRequested(GameLobbyJoinRequested_t pCallback) {
		Debug.Log("[" + GameLobbyJoinRequested_t.k_iCallback + " - GameLobbyJoinRequested] - " + pCallback.m_steamIDLobby + " -- " + pCallback.m_steamIDFriend);
	}
		private void OnLobbyJoinRequest(GameLobbyJoinRequested_t result)
		{
			if (this._lobby.State != LobbyState.Inactive)
			{
				this._lobby.Leave();
			}
			string friendName = SteamFriends.GetFriendPersonaName(result.m_steamIDFriend);
			Main.OpenPlayerSelect(delegate(PlayerFileData playerData)
			{
				Main.ServerSideCharacter = false;
				playerData.SetAsActive();
				Main.menuMode = 882;
				Main.statusText = "Joining " + friendName + "...";
				this._lobby.Join(result.m_steamIDLobby, new CallResult<LobbyEnter_t>.APIDispatchDelegate(this.OnLobbyEntered));
			});
		}