using asap.core; using cfg; using GameCore; using System.Collections; using TMPro; using UniRx; using UnityEngine; using UnityEngine.UI; public class DuelChatView : MonoBehaviour, IDuelChatView { public Animation dialogue; public TMP_Text text_chat; public Animation emoji; public Image image_emoji; IUIService uiService; protected virtual void Awake() { uiService = GContext.container.Resolve(); } public void SetDuelFishingEvent(int roleID) { GContext.OnEvent().Where(x => x.RoleID == roleID).Subscribe(SetMessage).AddTo(this); } void SetMessage(DuelChatEvent duelChatEvent) { EventSoloQuickMessage eventSoloQuickMessage = GContext.container.Resolve().TbEventSoloQuickMessage.GetOrDefault(duelChatEvent.MessageID); if (eventSoloQuickMessage != null) { switch (eventSoloQuickMessage.Type) { case 1: Emoji(eventSoloQuickMessage.Emoji); break; case 2: Dialogue(eventSoloQuickMessage.Text_l10n_key); break; default: break; } } } public void Dialogue(string chat) { if (this == null) { return; } emoji.gameObject.SetActive(false); dialogue.gameObject.SetActive(true); dialogue.Play(); text_chat.text = LocalizationMgr.GetText(chat); } public void Emoji(string chat) { if (this == null) { return; } emoji.gameObject.SetActive(true); dialogue.gameObject.SetActive(false); emoji.Play(); uiService.SetImageSprite(image_emoji, chat); } }