mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Made the style of the code more consistent. Not much logic-wise had changed during the refactor, but there are some. Console: * Removed m_bSuggestUpdate and the logic bound to it, this var was never set and the logic was never used. This was the initial workaround for resetting the autocomplete selection pos to kPark (-1), but this is currently done in a more mature way, but the old code was never removed * CreateSuggestionsFromPartial() (previously, FindFromPartial()) would break if a ConCommand/ConVar was found that was already added in the list. Although this is an engine/sdk level bug, we shouldn't stop iterating there. Added an assert instead and made the loop continue. * Removed member m_bCopyToClipBoard, this was used to check if the copy button was pressed, to copy the text the next frame. The copy now happens directly in the site of the Copy button which is a better approach. * Due to the changes with removing m_bCopyToClipBoard, the mutex for m_colorTextLogger is now released right after rendering the color text to fully minimize blocking time between other threads. Browser: * Moved ImGui::Begin() call from RunFrame() to DrawSurface(), it fits better there and we can now also return false if the frame didn't render. * Improved the "Broadcasting" text formatting when server browser is hosting and broadcasting without a server token (public server). Both: * Added virtual Shutdown() method.
77 lines
2.1 KiB
C++
77 lines
2.1 KiB
C++
#pragma once
|
|
#ifndef DEDICATED
|
|
#include "common/sdkdefs.h"
|
|
#include "windows/resource.h"
|
|
#include "networksystem/serverlisting.h"
|
|
#include "networksystem/pylon.h"
|
|
#include "thirdparty/imgui/misc/imgui_utility.h"
|
|
|
|
#include "imgui_surface.h"
|
|
|
|
class CBrowser : public CImguiSurface
|
|
{
|
|
public:
|
|
CBrowser(void);
|
|
virtual ~CBrowser(void);
|
|
|
|
virtual bool Init(void);
|
|
virtual void Shutdown(void);
|
|
|
|
virtual void RunFrame(void);
|
|
void RunTask(void);
|
|
|
|
virtual bool DrawSurface(void);
|
|
|
|
void DrawBrowserPanel(void);
|
|
void RefreshServerList(void);
|
|
|
|
void HiddenServersModal(void);
|
|
void DrawHostPanel(void);
|
|
|
|
void UpdateHostingStatus(void);
|
|
void InstallHostingDetails(const bool postFailed, const char* const hostMessage, const char* const hostToken, const string& hostIp);
|
|
void SendHostingPostRequest(const NetGameServer_t& gameServer);
|
|
|
|
void ProcessCommand(const char* pszCommand) const;
|
|
|
|
public:
|
|
// Command callbacks
|
|
static void ToggleBrowser_f();
|
|
|
|
private:
|
|
inline void SetServerListMessage(const char* const message) { m_serverListMessage = message; };
|
|
inline void SetHostMessage(const char* const message) { m_hostMessage = message; }
|
|
inline void SetHostToken(const char* const message) { m_hostToken = message; }
|
|
|
|
private:
|
|
bool m_reclaimFocusOnTokenField;
|
|
bool m_queryNewListNonRecursive; // When set, refreshes the server list once the next frame.
|
|
bool m_queryGlobalBanList;
|
|
char m_serverAddressTextBuf[128];
|
|
char m_serverNetKeyTextBuf[30];
|
|
|
|
ID3D11ShaderResourceView* m_lockedIconShaderResource;
|
|
MODULERESOURCE m_lockedIconDataResource;
|
|
|
|
////////////////////
|
|
// Server List //
|
|
////////////////////
|
|
ImGuiTextFilter m_serverBrowserTextFilter;
|
|
string m_serverListMessage;
|
|
|
|
////////////////////
|
|
// Host Server //
|
|
////////////////////
|
|
string m_hostMessage;
|
|
string m_hostToken;
|
|
ImVec4 m_hostMessageColor;
|
|
|
|
////////////////////
|
|
// Private Server //
|
|
////////////////////
|
|
string m_hiddenServerRequestMessage;
|
|
ImVec4 m_hiddenServerMessageColor;
|
|
};
|
|
|
|
extern CBrowser g_Browser;
|
|
#endif |