2023-03-03 18:52:31 +00:00
|
|
|
using System.Linq;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using Comfort.Common;
|
|
|
|
using EFT;
|
|
|
|
|
|
|
|
namespace Aki.SinglePlayer.Models.RaidFix
|
|
|
|
{
|
|
|
|
public struct BundleLoader
|
|
|
|
{
|
|
|
|
Profile Profile;
|
|
|
|
TaskScheduler TaskScheduler { get; }
|
|
|
|
|
|
|
|
public BundleLoader(TaskScheduler taskScheduler)
|
|
|
|
{
|
|
|
|
Profile = null;
|
|
|
|
TaskScheduler = taskScheduler;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Task<Profile> LoadBundles(Task<Profile> task)
|
|
|
|
{
|
|
|
|
Profile = task.Result;
|
|
|
|
|
|
|
|
var loadTask = Singleton<PoolManager>.Instance.LoadBundlesAndCreatePools(
|
|
|
|
PoolManager.PoolsCategory.Raid,
|
|
|
|
PoolManager.AssemblyType.Local,
|
2024-01-27 14:23:50 +00:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|