备份CatanBuilding瘦身独立工程
This commit is contained in:
44
Assets/Scripts/UI/Social/ClubChat/EmojiTips.cs
Normal file
44
Assets/Scripts/UI/Social/ClubChat/EmojiTips.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user