Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

69 lines
2.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Interface to a Steam Add On
  4. //
  5. //=============================================================================//
  6. #ifndef ISTEAMADDON_H
  7. #define ISTEAMADDON_H
  8. #pragma once
  9. #include "interface.h"
  10. #include "AddOnTypes.h"
  11. #include <vgui_controls/Panel.h>
  12. class CUtlMsgBuffer;
  13. class ISteamAddOn : public IBaseInterface
  14. {
  15. public:
  16. // allows SteamAddOn to link to the core vgui factories
  17. virtual bool Initialize(CreateInterfaceFn *vguiFactories, int factoryCount) = 0;
  18. // allows SteamAddOns to link to all other modules
  19. virtual bool PostInitialize(CreateInterfaceFn *modules, int factoryCount) = 0;
  20. // when Friends closes down - all SteamAddOns are notified
  21. virtual void Deactivate() = 0;
  22. // notifies the addon who its VGUI parent panel is
  23. virtual void SetParent( vgui::Panel *parent ) = 0;
  24. // notifies the SteamAddOn of the user's ID and username.
  25. // Note: username can be set mulitple times due to changing of name
  26. virtual void SetUserID(unsigned int userID) = 0;
  27. virtual void SetUserName(const char *userName) = 0;
  28. // Query if there are any 'open' sessions - open meaning allowing new users to join the sessions
  29. virtual int QueryOpenSessionCount() = 0;
  30. // will be valid right after a call to QueryOpenInviteCount will set the addOnSessionID and hostname for
  31. // any open sessions for this addOn. Return true if it's a valid index
  32. virtual bool QueryOpenSessionInfo(int nOpenGameIndex, SessionInt64 &addOnSessionID, char *pszHostName) = 0;
  33. // returns true if this userID is involved in an addOnSession with this ID
  34. virtual bool QueryUserInvolved(SessionInt64 addOnSessionID, unsigned int userID) = 0;
  35. // if session doesn't exist, then the SteamAddOn body should deal with it
  36. virtual bool OnReceiveMsg(SessionInt64 addOnSessionID, CUtlMsgBuffer *msgBuffer) = 0;
  37. // Let's the SteamAddOn know when when any friend's status has changed
  38. virtual void OnFriendStatusChanged() = 0;
  39. // A request to start/join this AddOn with this user ID/name. addOnSessionID will be zero if it's a new session request
  40. virtual void OnInviteUser(unsigned int targetUserID, const char *username, SessionInt64 addOnSessionID) = 0;
  41. // user accepted this host's invite request
  42. virtual void OnAcceptInviteRequest(unsigned int hostID, const char *hostUserName, SessionInt64 addOnSessionID, const char *pAppData, int dataLen) = 0;
  43. // user accepted this host's rejoin request
  44. virtual void OnAcceptRejoinRequest(unsigned int hostID, const char *hostUserName, SessionInt64 addOnSessionID, const char *pAppData, int dataLen) = 0;
  45. // user starts this addOn from a menu
  46. virtual void StartAddOn() = 0;
  47. };
  48. #define STEAMADDON_INTERFACE_VERSION "SteamAddOn007"
  49. #endif // ISTEAMADDON_H