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.

72 lines
2.2 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Interface for the client to acknowledge/view notifications sent from the GC
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #ifndef C_TF_NOTIFICATIONS_H
  8. #define C_TF_NOTIFICATIONS_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "econ/econ_notifications.h"
  13. #include "tf_notification.h"
  14. class CClientNotification : public CEconNotification
  15. {
  16. friend class CTFSupportNotificationDialog;
  17. public:
  18. CClientNotification();
  19. virtual ~CClientNotification() OVERRIDE;
  20. virtual EType NotificationType() OVERRIDE;
  21. virtual void Deleted() OVERRIDE;
  22. virtual void Expired() OVERRIDE;
  23. virtual void Trigger() OVERRIDE;
  24. virtual bool BHighPriority() OVERRIDE;
  25. // Should show up on the main menu only -- these go away on dismissal
  26. virtual bool BShowInGameElements() const OVERRIDE { return false; }
  27. void Update( const CTFNotification* notification );
  28. uint64 NotificationID() const { return m_ulNotificationID; }
  29. private:
  30. void OnDialogAcknowledged();
  31. void GCAcknowledge();
  32. uint64 m_ulNotificationID;
  33. uint32 m_unAccountID;
  34. // m_pText sometimes points to a static string we don't own, so this guy owns any text that we do.
  35. CUtlString m_strText;
  36. // Is this a support message? If so, the user must trigger the notification to view the message in a pop-up before they can dismiss.
  37. bool m_bSupportMessage;
  38. };
  39. class CAutobalanceVolunteerNotification : public CEconNotification
  40. {
  41. public:
  42. CAutobalanceVolunteerNotification() : CEconNotification() {}
  43. virtual ~CAutobalanceVolunteerNotification() OVERRIDE {}
  44. virtual bool BShowInGameElements() const OVERRIDE { return true; }
  45. virtual EType NotificationType() OVERRIDE { return eType_AcceptDecline; }
  46. virtual void Accept() OVERRIDE { SendResponse( true ); }
  47. virtual void Decline() OVERRIDE { SendResponse( false ); }
  48. virtual void Expired() OVERRIDE { Decline(); }
  49. static bool IsNotificationType( CEconNotification *pNotification ) { return dynamic_cast<CAutobalanceVolunteerNotification *>( pNotification ) != NULL; }
  50. private:
  51. void SendResponse( bool bResponse );
  52. };
  53. #endif // C_TF_NOTIFICATIONS_H