using UnityEngine; using UnityEngine.Localization; using UnityEngine.Localization.Components; using UnityEngine.UI; namespace DDD { public class InteractionMessageUi : BaseUi, IEventHandler, IEventHandler { [SerializeField] private Image _filledImage; [SerializeField] private LocalizeStringEvent _textLabelLocalizeStringEvent; private LocalizedString _previousLocalizedString; protected override void Start() { base.Start(); _filledImage.fillAmount = 0f; EventBus.Register(this); EventBus.Register(this); } protected override void OnDestroy() { base.OnDestroy(); EventBus.Unregister(this); EventBus.Unregister(this); } public void Invoke(ShowInteractionUiEvent evt) { _previousLocalizedString = LocalizationManager.Instance.GetLocalizedString(evt.TextKey); if (_textLabelLocalizeStringEvent.StringReference != _previousLocalizedString) { _textLabelLocalizeStringEvent.StringReference = _previousLocalizedString; } _filledImage.fillAmount = evt.HoldProgress; if (_panel.activeInHierarchy == false) { OpenPanel(); } } public void Invoke(HideInteractionUiEvent evt) { _filledImage.fillAmount = 0f; ClosePanel(); } } }