codecat / unet

Unified Lobby Networking library in C++, providing cross-play between Steam lobbies, Gog Galaxy lobbies, and Enet sockets.
MIT License
7 stars 1 forks source link

Add download progress #14

Closed xMyran closed 4 years ago

xMyran commented 4 years ago

We need the ability to see the download progress for other lobby members

codecat commented 4 years ago

This is already in, and can be fetched via the OnLobbyFileDataReceiveProgress callback. You can use file->GetPercentage() to get the percentage of download progress (between 0.0 and 1.0).

virtual void OnLobbyFileDataReceiveProgress(Unet::LobbyMember* sender, const Unet::LobbyFile* file) override
{
    LOG_FROM_CALLBACK("Receiving file \"%s\" from %s: %.1f%%", file->m_filename.c_str(), sender->Name.c_str(), file->GetPercentage() * 100.0);
}