riversong code showcase
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DanieleMarotta.RiversongCodeShowcase
|
||||
{
|
||||
public class DemoPanelUIController : UIControllerSystem<DemoPanelUIView>, IDisposable
|
||||
{
|
||||
[InjectService]
|
||||
private ISignalBus _signalBus;
|
||||
|
||||
[InjectService]
|
||||
private World _world;
|
||||
|
||||
public DemoPanelUIController(IServiceLocator serviceLocator) : base(serviceLocator)
|
||||
{
|
||||
}
|
||||
|
||||
protected override DemoPanelUIView View => UIRoot.GetView<DemoPanelUIView>();
|
||||
|
||||
public override async UniTask InitializeAsync()
|
||||
{
|
||||
await base.InitializeAsync();
|
||||
|
||||
View.FeedbackButtonClick += OnFeedbackButtonClick;
|
||||
_signalBus.Subscribe<DemoCompletedSignal>(OnDemoCompleted);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
View.FeedbackButtonClick -= OnFeedbackButtonClick;
|
||||
_signalBus.Unsubscribe<DemoCompletedSignal>(OnDemoCompleted);
|
||||
}
|
||||
|
||||
private void OnDemoCompleted(DemoCompletedSignal signal)
|
||||
{
|
||||
View.OnDemoCompleted(_world.PopulationState.Population, signal.GameTime);
|
||||
}
|
||||
|
||||
private void OnFeedbackButtonClick()
|
||||
{
|
||||
Application.OpenURL(AppLinks.DemoFeedbackUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user