using System; using Cysharp.Threading.Tasks; using UnityEngine; namespace DanieleMarotta.RiversongCodeShowcase { public class DemoPanelUIController : UIControllerSystem, IDisposable { [InjectService] private ISignalBus _signalBus; [InjectService] private World _world; public DemoPanelUIController(IServiceLocator serviceLocator) : base(serviceLocator) { } protected override DemoPanelUIView View => UIRoot.GetView(); public override async UniTask InitializeAsync() { await base.InitializeAsync(); View.FeedbackButtonClick += OnFeedbackButtonClick; _signalBus.Subscribe(OnDemoCompleted); } public void Dispose() { View.FeedbackButtonClick -= OnFeedbackButtonClick; _signalBus.Unsubscribe(OnDemoCompleted); } private void OnDemoCompleted(DemoCompletedSignal signal) { View.OnDemoCompleted(_world.PopulationState.Population, signal.GameTime); } private void OnFeedbackButtonClick() { Application.OpenURL(AppLinks.DemoFeedbackUrl); } } }