0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 09:50:43 -05:00

40 lines
1.1 KiB
C#
Raw Normal View History

2023-03-03 18:52:31 +00:00
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Comfort.Common;
using EFT;
2024-05-21 19:10:17 +01:00
namespace SPT.SinglePlayer.Models.RaidFix
2023-03-03 18:52:31 +00:00
{
public struct BundleLoader
{
private Profile _profile;
2023-03-03 18:52:31 +00:00
TaskScheduler TaskScheduler { get; }
public BundleLoader(TaskScheduler taskScheduler)
{
_profile = null;
2023-03-03 18:52:31 +00:00
TaskScheduler = taskScheduler;
}
public Task<Profile> LoadBundles(Task<Profile> task)
{
_profile = task.Result;
2023-03-03 18:52:31 +00:00
var loadTask = Singleton<PoolManager>.Instance.LoadBundlesAndCreatePools(
PoolManager.PoolsCategory.Raid,
PoolManager.AssemblyType.Local,
_profile.GetAllPrefabPaths(false).Where(x => !x.IsNullOrEmpty()).ToArray(),
2023-03-03 18:52:31 +00:00
JobPriority.General,
null,
default(CancellationToken));
return loadTask.ContinueWith(GetProfile, TaskScheduler);
}
private Profile GetProfile(Task task)
{
return _profile;
2023-03-03 18:52:31 +00:00
}
}
}