#pragma once #include "AssetLoadingContext.h" #include "Game/IAsset.h" #include "Pool/XAssetInfo.h" #include "Utils/ClassUtils.h" #include "Zone/ZoneTypes.h" #include class IAssetLoadingManager { public: IAssetLoadingManager() = default; virtual ~IAssetLoadingManager() = default; IAssetLoadingManager(const IAssetLoadingManager& other) = default; IAssetLoadingManager(IAssetLoadingManager&& other) noexcept = default; IAssetLoadingManager& operator=(const IAssetLoadingManager& other) = default; IAssetLoadingManager& operator=(IAssetLoadingManager&& other) noexcept = default; _NODISCARD virtual AssetLoadingContext* GetAssetLoadingContext() const = 0; template XAssetInfo* AddAsset(const std::string& assetName, typename AssetType::Type* asset) { static_assert(std::is_base_of_v); return static_cast*>(AddAsset(std::make_unique( AssetType::EnumEntry, assetName, asset, std::vector(), std::vector(), std::vector()))); } template XAssetInfo* AddAsset(const std::string& assetName, typename AssetType::Type* asset, std::vector dependencies) { static_assert(std::is_base_of_v); return static_cast*>(AddAsset(std::make_unique( AssetType::EnumEntry, assetName, asset, std::move(dependencies), std::vector(), std::vector()))); } template XAssetInfo* AddAsset(const std::string& assetName, typename AssetType::Type* asset, std::vector dependencies, std::vector usedScriptStrings) { static_assert(std::is_base_of_v); return static_cast*>(AddAsset(std::make_unique( AssetType::EnumEntry, assetName, asset, std::move(dependencies), std::move(usedScriptStrings), std::vector()))); } template XAssetInfo* AddAsset(const std::string& assetName, typename AssetType::Type* asset, std::vector dependencies, std::vector usedScriptStrings, std::vector indirectAssetReferences) { static_assert(std::is_base_of_v); return static_cast*>(AddAsset(std::make_unique( AssetType::EnumEntry, assetName, asset, std::move(dependencies), std::move(usedScriptStrings), std::move(indirectAssetReferences)))); } template XAssetInfo* AddAsset(std::unique_ptr> xAssetInfo) { static_assert(std::is_base_of_v); return static_cast*>(AddAsset(std::unique_ptr(xAssetInfo.release()))); } template XAssetInfo* LoadDependency(const std::string& assetName) { static_assert(std::is_base_of_v); return static_cast*>(LoadDependency(AssetType::EnumEntry, assetName)); } template IndirectAssetReference LoadIndirectAssetReference(const std::string& assetName) { static_assert(std::is_base_of_v); return LoadIndirectAssetReference(AssetType::EnumEntry, assetName); } protected: virtual XAssetInfoGeneric* AddAsset(std::unique_ptr xAssetInfo) = 0; virtual XAssetInfoGeneric* LoadDependency(asset_type_t assetType, const std::string& assetName) = 0; virtual IndirectAssetReference LoadIndirectAssetReference(asset_type_t assetType, const std::string& assetName) = 0; };