using System; using Cysharp.Threading.Tasks; using Stary.Evo; using Stary.Evo.AudioCore; using Stary.Evo.InformationSave; using Stary.Evo.UIFarme; using UnityEngine; using UnityEngine.UI; using YooAsset; namespace Main { public class ProgressBarPanel : BasePanel { static readonly string path = "ProgressBarPanel"; private Image _fill; private Text _fillText; private Text _fillMessage; public ProgressBarPanel() { } public override void Initialize(GameObject panelGo) { base.Initialize(panelGo); _fill = activePanel.transform.Find("Fill").GetComponent(); _fillText = _fill.transform.Find("FillText").GetComponent(); _fillMessage= _fill.transform.Find("FillMessage").GetComponent(); _fill.fillAmount = 0; _fillText.text = "0%"; } public override void OnEnter() { base.OnEnter(); this.RegisterEvent(ProgressBarType.Add, SetProgressBarValue); } public override void OnExit(float delay = 0) { base.OnExit(delay); _fill.fillAmount = 0; _fillText.text = "0%"; this.UnRegisterEvent(ProgressBarType.Add, SetProgressBarValue); } public async void SetProgressBarValue(string message,float value) { _fill.fillAmount = value; _fillMessage.text = message; _fillText.text = $"{value:P0}"; if (value >= 1) { this.PanelSystem.PopQueue(); } } public enum ProgressBarType { Add, } } }