void FShooterMainMenu::Tick(float DeltaSeconds) { IPlatformChunkInstall* ChunkInstaller = FPlatformMisc::GetPlatformChunkInstall(); if (ChunkInstaller) { EMap SelectedMap = GetSelectedMap(); // use assetregistry when maps are added to it. int32 MapChunk = ChunkMapping[(int)SelectedMap]; EChunkLocation::Type ChunkLocation = ChunkInstaller->GetChunkLocation(MapChunk); FText UpdatedText; bool bUpdateText = false; if (ChunkLocation == EChunkLocation::NotAvailable) { float PercentComplete = FMath::Min(ChunkInstaller->GetChunkProgress(MapChunk, EChunkProgressReportingType::PercentageComplete), 100.0f); UpdatedText = FText::FromString(FString::Printf(TEXT("%s %4.0f%%"),*LOCTEXT("SELECTED_LEVEL", "Map").ToString(), PercentComplete)); bUpdateText = true; bShowingDownloadPct = true; } else if (bShowingDownloadPct) { UpdatedText = LOCTEXT("SELECTED_LEVEL", "Map"); bUpdateText = true; bShowingDownloadPct = false; } if (bUpdateText) { MapOption->SetText(UpdatedText); } } }
static void PlayGoNext() { IPlatformChunkInstall* ChunkInstaller = FPlatformMisc::GetPlatformChunkInstall(); if (ChunkInstaller) { ChunkInstaller->DebugStartNextChunk(); } }
virtual bool Visit(const TCHAR* FilenameOrDirectory, bool bIsDirectory) { if (bIsDirectory == false) { FString Filename(FilenameOrDirectory); if (FPaths::GetExtension(Filename) == TEXT("pak")) { // if a platform supports chunk style installs, make sure that the chunk a pak file resides in is actually fully installed before accepting pak files from it if (ChunkInstall) { FString ChunkIdentifier(TEXT("pakchunk")); FString BaseFilename = FPaths::GetBaseFilename(Filename); if (BaseFilename.StartsWith(ChunkIdentifier)) { int32 DelimiterIndex = 0; int32 StartOfChunkIndex = ChunkIdentifier.Len(); BaseFilename.FindChar(TEXT('-'), DelimiterIndex); FString ChunkNumberString = BaseFilename.Mid(StartOfChunkIndex, DelimiterIndex-StartOfChunkIndex); int32 ChunkNumber = 0; TTypeFromString<int32>::FromString(ChunkNumber, *ChunkNumberString); if (ChunkInstall->GetChunkLocation(ChunkNumber) == EChunkLocation::NotAvailable) { return true; } } } FoundPakFiles.Add(Filename); } } return true; }
bool FShooterMainMenu::IsMapReady() const { bool bReady = true; IPlatformChunkInstall* ChunkInstaller = FPlatformMisc::GetPlatformChunkInstall(); if (ChunkInstaller) { EMap SelectedMap = GetSelectedMap(); // should use the AssetRegistry as soon as maps are added to the AssetRegistry int32 MapChunk = ChunkMapping[(int)SelectedMap]; EChunkLocation::Type ChunkLocation = ChunkInstaller->GetChunkLocation(MapChunk); if (ChunkLocation == EChunkLocation::NotAvailable) { bReady = false; } } return bReady; }