상호작용 메세지 처리 최적화

This commit is contained in:
NTG 2025-08-29 14:12:05 +09:00
parent c40adf2eb6
commit 7b8f4cc245

View File

@ -15,7 +15,7 @@ public class InteractionMessageUi : BaseUi, IEventHandler<ShowInteractionUiEvent
[SerializeField] private Color _canInteractTextColor = Color.white;
[SerializeField] private Color _cannotInteractTextColor = Color.gray2;
private LocalizedString _previousLocalizedString;
private string _previousMessageKey;
protected override void OnDestroy()
{
@ -56,16 +56,19 @@ public void HandleEvent(HideInteractionUiEvent evt)
private void ShowInteractionUiEvent(ShowInteractionUiEvent evt)
{
_previousLocalizedString = LocalizationManager.Instance.GetLocalizedString(evt.TextKey);
_textLabel.color = evt.CanInteract ? _canInteractTextColor : _cannotInteractTextColor;
if (_textLabelLocalizeStringEvent.StringReference != _previousLocalizedString)
var currentMessageKey = evt.TextKey;
if (string.IsNullOrWhiteSpace(currentMessageKey)) return;
if (_previousMessageKey != currentMessageKey)
{
_textLabelLocalizeStringEvent.StringReference = _previousLocalizedString;
_textLabelLocalizeStringEvent.StringReference = LocalizationManager.Instance.GetLocalizedString(currentMessageKey);
_previousMessageKey = currentMessageKey;
}
_textLabel.color = evt.CanInteract ? _canInteractTextColor : _cannotInteractTextColor;
_filledImage.fillAmount = evt.HoldProgress;
if (_panel.activeInHierarchy == false)
if (IsOpenPanel() == false)
{
OpenPanel();
}