成果
功能:点击一个按钮可以远程下载文件 并看得到进度条
先上代码
.h文件
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "UObject/Object.h"
#include "Interfaces/IHttpRequest.h"
#include "RuntimeFilesDownloaderLibrary.generated.h"
/**
*
*/
UENUM(BlueprintType, Category = "Runtime Files Downloader")
enum DownloadResult
{
SuccessDownloading UMETA(DisplayName = "Success"),
DownloadFailed UMETA(DisplayName = "Download failed"),
SaveFailed UMETA(DisplayName = "Save failed"),
DirectoryCreationFailed UMETA(DisplayName = "Directory creation failed")
};
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FOnFilesDownloaderProgress, const int32, BytesSent, const int32, BytesReceived,
const int32, ContentLength);
/**
*/
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnFilesDownloaderResult, TEnumAsByte < DownloadResult >, Result);
UCLASS()
class DOWNLOAD_API URuntimeFilesDownloaderLibrary : public UObject
{
GENERATED_BODY()
public:
UPROPERTY(BlueprintAssignable, Category = "Runtime Files Downloader")
FOnFilesDownloaderProgress OnProgress;
/**
*/
UPROPERTY(BlueprintAssignable