Clients can now see download progress of large resources
This commit is contained in:
parent
2a213028c0
commit
3b12f630f8
11 changed files with 87 additions and 30 deletions
|
|
@ -37,7 +37,8 @@ enum ClientCommands : MessageCommandType {
|
|||
CLIENT_ERASE_MANY_COMPONENTS,
|
||||
CLIENT_UPDATE_COMPONENT,
|
||||
CLIENT_MOVE_MOUSE,
|
||||
CLIENT_NEW_RESOURCE,
|
||||
CLIENT_NEW_RESOURCE_ID,
|
||||
CLIENT_NEW_RESOURCE_DATA,
|
||||
CLIENT_CHAT_MESSAGE,
|
||||
CLIENT_NEW_BOOKMARK,
|
||||
CLIENT_REMOVE_BOOKMARK,
|
||||
|
|
|
|||
|
|
@ -63,8 +63,10 @@ MainServer::MainServer(World& initWorld, const std::string& serverLocalID):
|
|||
netServer->send_items_to_client(client, RELIABLE_COMMAND_CHANNEL, CLIENT_INITIAL_DATA, isDirectConnect, newClient.serverID, newClient.cursorColor);
|
||||
else {
|
||||
netServer->send_items_to_client(client, RELIABLE_COMMAND_CHANNEL, CLIENT_INITIAL_DATA, isDirectConnect, newClient.serverID, newClient.cursorColor, newClient.displayName, fileDisplayName, clients, data);
|
||||
for(auto& [id, rData] : data.resources)
|
||||
netServer->send_items_to_client(client, RESOURCE_COMMAND_CHANNEL, CLIENT_NEW_RESOURCE, id, rData);
|
||||
for(auto& [id, rData] : data.resources) {
|
||||
netServer->send_items_to_client(client, RESOURCE_COMMAND_CHANNEL, CLIENT_NEW_RESOURCE_ID, id);
|
||||
netServer->send_items_to_client(client, RESOURCE_COMMAND_CHANNEL, CLIENT_NEW_RESOURCE_DATA, rData);
|
||||
}
|
||||
}
|
||||
clients.emplace(newClient.serverID, newClient);
|
||||
});
|
||||
|
|
@ -190,7 +192,8 @@ MainServer::MainServer(World& initWorld, const std::string& serverLocalID):
|
|||
if(c.pendingResourceData.empty())
|
||||
c.pendingResourceID.emplace(newID);
|
||||
else {
|
||||
netServer->send_items_to_all_clients_except(client, RESOURCE_COMMAND_CHANNEL, CLIENT_NEW_RESOURCE, newID, c.pendingResourceData.front());
|
||||
netServer->send_items_to_all_clients_except(client, RESOURCE_COMMAND_CHANNEL, CLIENT_NEW_RESOURCE_ID, newID);
|
||||
netServer->send_items_to_all_clients_except(client, RESOURCE_COMMAND_CHANNEL, CLIENT_NEW_RESOURCE_DATA, c.pendingResourceData.front());
|
||||
data.resources.emplace(newID, c.pendingResourceData.front());
|
||||
c.pendingResourceData.pop();
|
||||
}
|
||||
|
|
@ -204,7 +207,8 @@ MainServer::MainServer(World& initWorld, const std::string& serverLocalID):
|
|||
c.pendingResourceData.back() = std::move(resourceData);
|
||||
}
|
||||
else {
|
||||
netServer->send_items_to_all_clients_except(client, RESOURCE_COMMAND_CHANNEL, CLIENT_NEW_RESOURCE, c.pendingResourceID.front(), resourceData);
|
||||
netServer->send_items_to_all_clients_except(client, RESOURCE_COMMAND_CHANNEL, CLIENT_NEW_RESOURCE_ID, c.pendingResourceID.front());
|
||||
netServer->send_items_to_all_clients_except(client, RESOURCE_COMMAND_CHANNEL, CLIENT_NEW_RESOURCE_DATA, resourceData);
|
||||
data.resources.emplace(c.pendingResourceID.front(), resourceData);
|
||||
c.pendingResourceID.pop();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue