45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using asap.core;
|
|
using cfg;
|
|
using game;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
public class EmojiTips : MonoBehaviour
|
|
{
|
|
GameObject item;
|
|
Button btn_close;
|
|
IChatService chatService;
|
|
private void Awake()
|
|
{
|
|
chatService = GContext.container.Resolve<IChatService>();
|
|
btn_close = transform.Find("btn_close").GetComponent<Button>();
|
|
item = transform.Find("emoji1").gameObject;
|
|
item.SetActive(false);
|
|
}
|
|
private void Start()
|
|
{
|
|
btn_close.onClick.AddListener(OnClose);
|
|
List<ClubEmoji> clubEmojis = GContext.container.Resolve<Tables>().TbClubEmoji.DataList;
|
|
Image icon;
|
|
IUIService uIService = GContext.container.Resolve<IUIService>();
|
|
foreach (var emoji in clubEmojis)
|
|
{
|
|
GameObject go = Instantiate(item, transform);
|
|
go.SetActive(true);
|
|
icon = go.transform.Find("icon").GetComponent<Image>();
|
|
uIService.SetImageSprite(icon, emoji.Frame, BasePanel.PanelName);
|
|
go.GetComponent<Button>().onClick.AddListener(() => OnClick(emoji.Frame));
|
|
}
|
|
}
|
|
void OnClick(string icon)
|
|
{
|
|
chatService.SendEmoji(icon);
|
|
OnClose();
|
|
}
|
|
void OnClose()
|
|
{
|
|
gameObject.SetActive(false);
|
|
}
|
|
}
|