-
Notifications
You must be signed in to change notification settings - Fork 1
/
InfoUseCase.cs
34 lines (29 loc) · 1 KB
/
InfoUseCase.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System;
using Lycoris102.Unity1Week202008.Entity.Interface;
using Lycoris102.Unity1Week202008.UseCase.Main.Interface;
using Lycoris102.Unity1Week202008.View.Main.Interface;
using UniRx;
using VContainer.Unity;
namespace Lycoris102.Unity1Week202008.UseCase.Main
{
public class InfoUseCase : IInitializable, IDisposable, IInfoUseCase
{
private IInfoEntity InfoEntity { get; }
private IInfoRenderer InfoRenderer { get; }
private CompositeDisposable Disposable { get; } = new CompositeDisposable();
public void Dispose() => Disposable?.Clear();
public InfoUseCase(IInfoEntity infoEntity, IInfoRenderer infoRenderer)
{
InfoEntity = infoEntity;
InfoRenderer = infoRenderer;
}
public void Initialize()
{
InfoEntity.OnUpdateAsObservable()
.Subscribe(Render)
.AddTo(Disposable);
}
private void Render(string text)
=> InfoRenderer.Render(text);
}
}