备份CatanBuilding瘦身独立工程
This commit is contained in:
73
Assets/Scripts/Duel/UI/event_fishingduel_chat.cs
Normal file
73
Assets/Scripts/Duel/UI/event_fishingduel_chat.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class event_fishingduel_chat : MonoBehaviour
|
||||
{
|
||||
Transform layout_chat;
|
||||
GameObject layout_chat_item;
|
||||
Transform emoji_tips;
|
||||
GameObject emoji_tips_item;
|
||||
Button btnClose;
|
||||
FishingDuelManager FDM;
|
||||
private void Awake()
|
||||
{
|
||||
btnClose = transform.Find("btn_close").GetComponent<Button>();
|
||||
FDM = GContext.container.Resolve<FishingDuelManager>();
|
||||
layout_chat = transform.Find("root/layout_chat");
|
||||
if (layout_chat != null)
|
||||
{
|
||||
layout_chat_item = layout_chat.Find("bubble_chat").gameObject;
|
||||
layout_chat_item.SetActive(false);
|
||||
}
|
||||
|
||||
emoji_tips = transform.Find("root/emoji_tips");
|
||||
if (emoji_tips != null)
|
||||
{
|
||||
emoji_tips_item = emoji_tips.Find("emoji").gameObject;
|
||||
emoji_tips_item.SetActive(false);
|
||||
}
|
||||
btnClose.onClick.AddListener(() => { gameObject.SetActive(false); });
|
||||
}
|
||||
private void Start()
|
||||
{
|
||||
IUIService uiService = GContext.container.Resolve<IUIService>();
|
||||
List<EventSoloQuickMessage> messages = GContext.container.Resolve<Tables>().TbEventSoloQuickMessage.DataList;
|
||||
for (int i = 0; i < messages.Count; i++)
|
||||
{
|
||||
EventSoloQuickMessage message = messages[i];
|
||||
GameObject item = null;
|
||||
if (message.Type == 1)
|
||||
{
|
||||
item = Instantiate(emoji_tips_item, emoji_tips);
|
||||
item.SetActive(true);
|
||||
Image image = item.transform.Find("icon").GetComponent<Image>();
|
||||
uiService.SetImageSprite(image, message.Emoji);
|
||||
|
||||
}
|
||||
else if (message.Type == 2)
|
||||
{
|
||||
item = Instantiate(layout_chat_item, layout_chat);
|
||||
item.SetActive(true);
|
||||
TMP_Text text = item.transform.Find("text_chat").GetComponent<TMP_Text>();
|
||||
text.text = LocalizationMgr.GetText(message.Text_l10n_key);
|
||||
}
|
||||
if (item != null)
|
||||
{
|
||||
Button button = item.GetComponent<Button>();
|
||||
if (button != null)
|
||||
{
|
||||
button.onClick.AddListener(() =>
|
||||
{
|
||||
FDM.SendQuickMessage(message.ID);
|
||||
gameObject.SetActive(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user