Отправка идентификаторов при подключении клиентов

This commit is contained in:
2026-01-04 20:47:48 +06:00
parent 01ea7eee74
commit 6dd1f93221
4 changed files with 65 additions and 67 deletions

View File

@@ -421,6 +421,31 @@ AssetsPreloader::Out_bakeId AssetsPreloader::bakeIdTables() {
return result;
}
AssetsPreloader::Out_fullSync AssetsPreloader::collectFullSync() const {
Out_fullSync out;
for(size_t type = 0; type < static_cast<size_t>(AssetType::MAX_ENUM); ++type) {
out.IdToDK[type] = IdToDK[type];
}
for(size_t type = 0; type < static_cast<size_t>(AssetType::MAX_ENUM); ++type) {
for(const auto& [id, resource] : MediaResources[type]) {
out.HashHeaders[type].push_back(BindHashHeaderInfo{
.Id = id,
.Hash = resource.Hash,
.Header = resource.Header
});
out.Resources.emplace_back(
static_cast<AssetType>(type),
id,
&resource
);
}
}
return out;
}
std::tuple<AssetsNodestate, std::vector<AssetsModel>, std::vector<AssetsTexture>>
AssetsPreloader::getNodeDependency(const std::string& domain, const std::string& key) {
(void)domain;

View File

@@ -143,6 +143,20 @@ public:
> IdToDK;
};
struct Out_fullSync {
std::array<
std::vector<BindDomainKeyInfo>,
static_cast<size_t>(AssetType::MAX_ENUM)
> IdToDK;
std::array<
std::vector<BindHashHeaderInfo>,
static_cast<size_t>(AssetType::MAX_ENUM)
> HashHeaders;
std::vector<std::tuple<AssetType, ResourceId, const MediaResource*>> Resources;
};
struct ReloadStatus {
/// TODO: callback'и для обновления статусов
/// TODO: многоуровневый статус std::vector<std::string>. Этапы/Шаги/Объекты
@@ -218,6 +232,9 @@ public:
*/
Out_bakeId bakeIdTables();
// Выдаёт полный список привязок и ресурсов для новых клиентов.
Out_fullSync collectFullSync() const;
/*
Выдаёт пакет со всеми текущими привязками id -> домен+ключ.
Используется при подключении новых клиентов.