Counter Strike : Global Offensive Source Code
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.

70 lines
1.4 KiB

  1. //=========== (C) Copyright Valve, L.L.C. All rights reserved. ===========
  2. #include "cbase.h"
  3. #include "ui_nugget.h"
  4. class CUiNuggetSessions : public CUiNuggetBase
  5. {
  6. DECLARE_NUGGET_FN_MAP( CUiNuggetSessions, CUiNuggetBase );
  7. NUGGET_FN( CloseSession )
  8. {
  9. g_pMatchFramework->CloseSession();
  10. return NULL;
  11. }
  12. NUGGET_FN( CreateSession )
  13. {
  14. args->SetName( "settings" );
  15. g_pMatchFramework->CreateSession( args );
  16. return NULL;
  17. }
  18. NUGGET_FN( MatchSession )
  19. {
  20. args->SetName( "settings" );
  21. g_pMatchFramework->MatchSession( args );
  22. return NULL;
  23. }
  24. NUGGET_FN( SessionSystemData )
  25. {
  26. if ( IMatchSession *p = g_pMatchFramework->GetMatchSession() )
  27. {
  28. KeyValues *kv = p->GetSessionSystemData();
  29. return kv ? kv->MakeCopy() : NULL;
  30. }
  31. return NULL;
  32. }
  33. NUGGET_FN( SessionSettings )
  34. {
  35. if ( IMatchSession *p = g_pMatchFramework->GetMatchSession() )
  36. {
  37. KeyValues *kv = p->GetSessionSettings();
  38. return kv ? kv->MakeCopy() : NULL;
  39. }
  40. return NULL;
  41. }
  42. NUGGET_FN( SessionUpdateSettings )
  43. {
  44. if ( IMatchSession *p = g_pMatchFramework->GetMatchSession() )
  45. {
  46. args->SetName( "settings" );
  47. p->UpdateSessionSettings( args );
  48. }
  49. return NULL;
  50. }
  51. NUGGET_FN( SessionCommand )
  52. {
  53. if ( IMatchSession *p = g_pMatchFramework->GetMatchSession() )
  54. {
  55. p->Command( args->GetFirstSubKey() );
  56. }
  57. return NULL;
  58. }
  59. };
  60. UI_NUGGET_FACTORY_SINGLETON( CUiNuggetSessions, "sessions" );