상호작용 메세지 처리 최적화
This commit is contained in:
parent
c40adf2eb6
commit
7b8f4cc245
@ -15,7 +15,7 @@ public class InteractionMessageUi : BaseUi, IEventHandler<ShowInteractionUiEvent
|
|||||||
[SerializeField] private Color _canInteractTextColor = Color.white;
|
[SerializeField] private Color _canInteractTextColor = Color.white;
|
||||||
[SerializeField] private Color _cannotInteractTextColor = Color.gray2;
|
[SerializeField] private Color _cannotInteractTextColor = Color.gray2;
|
||||||
|
|
||||||
private LocalizedString _previousLocalizedString;
|
private string _previousMessageKey;
|
||||||
|
|
||||||
protected override void OnDestroy()
|
protected override void OnDestroy()
|
||||||
{
|
{
|
||||||
@ -56,16 +56,19 @@ public void HandleEvent(HideInteractionUiEvent evt)
|
|||||||
|
|
||||||
private void ShowInteractionUiEvent(ShowInteractionUiEvent evt)
|
private void ShowInteractionUiEvent(ShowInteractionUiEvent evt)
|
||||||
{
|
{
|
||||||
_previousLocalizedString = LocalizationManager.Instance.GetLocalizedString(evt.TextKey);
|
var currentMessageKey = evt.TextKey;
|
||||||
_textLabel.color = evt.CanInteract ? _canInteractTextColor : _cannotInteractTextColor;
|
if (string.IsNullOrWhiteSpace(currentMessageKey)) return;
|
||||||
|
|
||||||
if (_textLabelLocalizeStringEvent.StringReference != _previousLocalizedString)
|
if (_previousMessageKey != currentMessageKey)
|
||||||
{
|
{
|
||||||
_textLabelLocalizeStringEvent.StringReference = _previousLocalizedString;
|
_textLabelLocalizeStringEvent.StringReference = LocalizationManager.Instance.GetLocalizedString(currentMessageKey);
|
||||||
|
_previousMessageKey = currentMessageKey;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
_textLabel.color = evt.CanInteract ? _canInteractTextColor : _cannotInteractTextColor;
|
||||||
_filledImage.fillAmount = evt.HoldProgress;
|
_filledImage.fillAmount = evt.HoldProgress;
|
||||||
|
|
||||||
if (_panel.activeInHierarchy == false)
|
if (IsOpenPanel() == false)
|
||||||
{
|
{
|
||||||
OpenPanel();
|
OpenPanel();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user