mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
Render loading message/indicator when receiving rcon commands
Render a progress spinner and message in the remote console while receiving rcon commands.
This commit is contained in:
parent
1d0bb0dfcf
commit
ce81f7b45f
|
@ -200,6 +200,7 @@ public:
|
|||
virtual bool RconAuthed() const = 0;
|
||||
virtual bool UseTempRconCommands() const = 0;
|
||||
virtual void Rcon(const char *pLine) = 0;
|
||||
virtual bool ReceivingRconCommands() const = 0;
|
||||
|
||||
// server info
|
||||
virtual void GetServerInfo(class CServerInfo *pServerInfo) const = 0;
|
||||
|
|
|
@ -543,6 +543,7 @@ void CClient::DisconnectWithReason(const char *pReason)
|
|||
mem_zero(m_aRconPassword, sizeof(m_aRconPassword));
|
||||
m_ServerSentCapabilities = false;
|
||||
m_UseTempRconCommands = 0;
|
||||
m_ReceivingRconCommands = false;
|
||||
m_pConsole->DeregisterTempAll();
|
||||
m_aNetClient[CONN_MAIN].Disconnect(pReason);
|
||||
SetState(IClient::STATE_OFFLINE);
|
||||
|
@ -1605,6 +1606,7 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy)
|
|||
if(Old != 0 && m_UseTempRconCommands == 0)
|
||||
{
|
||||
m_pConsole->DeregisterTempAll();
|
||||
m_ReceivingRconCommands = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1940,6 +1942,14 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket, int Conn, bool Dummy)
|
|||
GameClient()->OnRconType(UsernameReq);
|
||||
}
|
||||
}
|
||||
else if(Conn == CONN_MAIN && (pPacket->m_Flags & NET_CHUNKFLAG_VITAL) != 0 && Msg == NETMSG_RCON_CMD_GROUP_START)
|
||||
{
|
||||
m_ReceivingRconCommands = true;
|
||||
}
|
||||
else if(Conn == CONN_MAIN && (pPacket->m_Flags & NET_CHUNKFLAG_VITAL) != 0 && Msg == NETMSG_RCON_CMD_GROUP_END)
|
||||
{
|
||||
m_ReceivingRconCommands = false;
|
||||
}
|
||||
}
|
||||
else if((pPacket->m_Flags & NET_CHUNKFLAG_VITAL) != 0)
|
||||
{
|
||||
|
|
|
@ -116,6 +116,7 @@ class CClient : public IClient, public CDemoPlayer::IListener
|
|||
char m_aRconUsername[32] = "";
|
||||
char m_aRconPassword[sizeof(g_Config.m_SvRconPassword)] = "";
|
||||
int m_UseTempRconCommands = 0;
|
||||
bool m_ReceivingRconCommands = false;
|
||||
char m_aPassword[sizeof(g_Config.m_Password)] = "";
|
||||
bool m_SendPassword = false;
|
||||
|
||||
|
@ -283,6 +284,7 @@ public:
|
|||
bool UseTempRconCommands() const override { return m_UseTempRconCommands != 0; }
|
||||
void RconAuth(const char *pName, const char *pPassword) override;
|
||||
void Rcon(const char *pCmd) override;
|
||||
bool ReceivingRconCommands() const override { return m_ReceivingRconCommands; }
|
||||
|
||||
bool ConnectionProblems() const override;
|
||||
|
||||
|
|
|
@ -1279,10 +1279,15 @@ void CGameConsole::OnRender()
|
|||
str_format(aBuf, sizeof(aBuf), Localize("Lines %d - %d (%s)"), pConsole->m_BacklogCurLine + 1, pConsole->m_BacklogCurLine + pConsole->m_LinesRendered, pConsole->m_BacklogCurLine != 0 ? Localize("Locked") : Localize("Following"));
|
||||
TextRender()->Text(10.0f, FONT_SIZE / 2.f, FONT_SIZE, aBuf);
|
||||
|
||||
if(m_ConsoleType == CONSOLETYPE_REMOTE && Client()->ReceivingRconCommands())
|
||||
{
|
||||
UI()->RenderProgressSpinner(vec2(Screen.w / 4.0f + FONT_SIZE / 2.f, FONT_SIZE), FONT_SIZE / 2.f);
|
||||
TextRender()->Text(Screen.w / 4.0f + FONT_SIZE + 2.0f, FONT_SIZE / 2.f, FONT_SIZE, Localize("Loading commands…"));
|
||||
}
|
||||
|
||||
// render version
|
||||
str_copy(aBuf, "v" GAME_VERSION " on " CONF_PLATFORM_STRING " " CONF_ARCH_STRING);
|
||||
float Width = TextRender()->TextWidth(FONT_SIZE, aBuf, -1, -1.0f);
|
||||
TextRender()->Text(Screen.w - Width - 10.0f, FONT_SIZE / 2.f, FONT_SIZE, aBuf);
|
||||
TextRender()->Text(Screen.w - TextRender()->TextWidth(FONT_SIZE, aBuf) - 10.0f, FONT_SIZE / 2.f, FONT_SIZE, aBuf);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue