Second commit
This commit is contained in:
commit
36840f3ad4
999 files changed
+61364
No files matched your search
@@ -0,0 +1,32 @@
|
||||
using System.Collections.Generic;
|
||||
using Cysharp.Threading.Tasks;
|
||||
|
||||
namespace Code.Infrastructure.Volume
|
||||
{
|
||||
public interface IVolumeService
|
||||
{
|
||||
UniTask LoadVolume(VolumeId volumeId);
|
||||
void RemoveVolume(VolumeId volumeId);
|
||||
}
|
||||
|
||||
public class VolumeService : IVolumeService
|
||||
{
|
||||
private readonly Dictionary<VolumeId, UnityEngine.Rendering.Volume> _loadedVolumes = new();
|
||||
private readonly IVolumeFactory _factory;
|
||||
|
||||
public VolumeService(IVolumeFactory factory)
|
||||
{
|
||||
_factory = factory;
|
||||
}
|
||||
public async UniTask LoadVolume(VolumeId volumeId)
|
||||
{
|
||||
var volume = await _factory.LoadVolume(volumeId);
|
||||
_loadedVolumes.Add(volumeId, volume);
|
||||
}
|
||||
public void RemoveVolume(VolumeId volumeId)
|
||||
{
|
||||
_factory.ReleaseVolume(_loadedVolumes[volumeId]);
|
||||
_loadedVolumes.Remove(volumeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user