diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /tracker/AdminServer/DialogGameInfo.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'tracker/AdminServer/DialogGameInfo.h')
| -rw-r--r-- | tracker/AdminServer/DialogGameInfo.h | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/tracker/AdminServer/DialogGameInfo.h b/tracker/AdminServer/DialogGameInfo.h new file mode 100644 index 0000000..ef23223 --- /dev/null +++ b/tracker/AdminServer/DialogGameInfo.h @@ -0,0 +1,110 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +#ifndef DIALOGGAMEINFO_H +#define DIALOGGAMEINFO_H +#ifdef _WIN32 +#pragma once +#endif + +#include <VGUI_Frame.h> +#include "ServerList.h" +#include "IServerRefreshResponse.h" + +class KeyValues; + +namespace vgui +{ +class Button; +class ToggleButton; +class RadioButton; +class Label; +class TextEntry; +} + +//----------------------------------------------------------------------------- +// Purpose: Dialog for displaying information about a game server +//----------------------------------------------------------------------------- +class CDialogGameInfo : public vgui::Frame, public IServerRefreshResponse +{ +public: + CDialogGameInfo(class IGameList *gameList, unsigned int serverID, int serverIP = 0, int serverPort = 0); + ~CDialogGameInfo(); + + void Run(const char *titleName); + void ChangeGame(int serverIP, int serverPort); + + // forces the dialog to attempt to connect to the server + void Connect(); + + // implementation of IServerRefreshResponse interface + // called when the server has successfully responded + virtual void ServerResponded(serveritem_t &server); + + // called when a server response has timed out + virtual void ServerFailedToRespond(serveritem_t &server); + + // called when the current refresh list is complete + virtual void RefreshComplete(); + +protected: + // message handlers + void OnConnect(); + void OnRefresh(); + void OnButtonToggled(vgui::Panel *toggleButton); + + // response from the get password dialog + void OnJoinServerWithPassword(const char *password); + + DECLARE_PANELMAP(); + + // vgui overrides + void OnTick(); + virtual void OnClose(); + virtual void PerformLayout(); + virtual void ApplySchemeSettings(vgui::IScheme *pScheme); + +private: + long m_iRequestRetry; // time at which to retry the request + + // methods + void RequestInfo(); + void ConnectToServer(); + void ShowAutoRetryOptions(bool state); + + void SetControlText(const char *textEntryName, const char *text); + + vgui::Button *m_pConnectButton; + vgui::Button *m_pCloseButton; + vgui::Button *m_pRefreshButton; + vgui::Label *m_pInfoLabel; + vgui::ToggleButton *m_pAutoRetry; + vgui::RadioButton *m_pAutoRetryAlert; + vgui::RadioButton *m_pAutoRetryJoin; + + // the ID of the server we're watching + unsigned int m_iServerID; + + // server refreshing object + CServerList m_Servers; + + // true if we should try connect to the server when it refreshes + bool m_bConnecting; + + // password, if entered + char m_szPassword[64]; + + // state + bool m_bServerNotResponding; + bool m_bServerFull; + bool m_bShowAutoRetryToggle; + bool m_bShowingExtendedOptions; + + typedef vgui::Frame BaseClass; +}; + +#endif // DIALOGGAMEINFO_H |