Refactor startup messages

This commit is contained in:
FutureRave 2022-01-10 15:28:37 +00:00
parent 62bca7f3b2
commit 0fe6a80429
No known key found for this signature in database
GPG Key ID: E883E2BC9657D955
2 changed files with 9 additions and 2 deletions

View File

@ -23,16 +23,22 @@ namespace Components
StartupMessages::TotalMessages = StartupMessages::MessageList.size();
}
std::string message = StartupMessages::MessageList.front();
StartupMessages::MessageList.pop_front();
const auto& message = StartupMessages::MessageList.front();
Game::Dvar_SetStringByName("ui_startupMessage", message.data());
Game::Dvar_SetStringByName("ui_startupMessageTitle", Utils::String::VA("Messages (%d/%d)", StartupMessages::TotalMessages - StartupMessages::MessageList.size(), StartupMessages::TotalMessages));
Game::Dvar_SetStringByName("ui_startupNextButtonText", StartupMessages::MessageList.size() ? "Next" : "Close");
Game::Cbuf_AddText(0, "openmenu startup_messages");
StartupMessages::MessageList.pop_front();
});
}
StartupMessages::~StartupMessages()
{
StartupMessages::MessageList.clear();
}
void StartupMessages::AddMessage(const std::string& message)
{
StartupMessages::MessageList.push_back(message);

View File

@ -6,6 +6,7 @@ namespace Components
{
public:
StartupMessages();
~StartupMessages();
static void AddMessage(const std::string& message);