76 lines
2.1 KiB
C#
76 lines
2.1 KiB
C#
using System.Threading.Tasks;
|
|
using asap.core;
|
|
using cfg;
|
|
using game;
|
|
using GameCore;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Event1v1Battle.Panel.InfoPanel
|
|
{
|
|
/// <summary>
|
|
/// 1v1扇耳光大赛信息弹窗面板 Event1v1BattleSlapInfoPopupPanel
|
|
/// </summary>
|
|
public class Event1v1BattleSlapInfoPopupPanel : BasePanel
|
|
{
|
|
#region UI Elements
|
|
|
|
private Button _btnClose;
|
|
private Event1v1BattleSlapInfoCell[] _cells;
|
|
#endregion
|
|
|
|
private Animation _uiAnimation;
|
|
|
|
private void Awake()
|
|
{
|
|
_btnClose = gameObject.FindChildGameObject("btn_close")?.GetComponentInChildren<Button>();
|
|
if (_btnClose != null)
|
|
_btnClose.onClick.AddListener(OnClickClose);
|
|
_cells = gameObject.GetComponentsInChildren<Event1v1BattleSlapInfoCell>();
|
|
_uiAnimation = GetComponent<Animation>();
|
|
|
|
}
|
|
|
|
protected override void OnDestroy()
|
|
{
|
|
base.OnDestroy();
|
|
|
|
if (_btnClose != null)
|
|
_btnClose.onClick.RemoveAllListeners();
|
|
}
|
|
|
|
protected override void Start()
|
|
{
|
|
//if (_uiAnimation != null)
|
|
//_uiAnimation.Play("popup_common_show");
|
|
var data = GContext.container.Resolve<Tables>().TbEventSlapSpinach.DataList;
|
|
for (int i = 0; i < _cells.Length; i++)
|
|
{
|
|
if (i < data.Count)
|
|
{
|
|
_cells[i].gameObject.SetActive(true);
|
|
_cells[i].SetData(data[i]);
|
|
}
|
|
else
|
|
{
|
|
_cells[i].gameObject.SetActive(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void OnClickClose()
|
|
{
|
|
_ = ClosePanel();
|
|
}
|
|
|
|
public async Task ClosePanel()
|
|
{
|
|
//if (_uiAnimation != null)
|
|
// _uiAnimation.Play("popup_common_out");
|
|
|
|
//await Awaiters.Seconds(0.25f);
|
|
UIManager.Instance.DestroyUI(UITypes.Event1v1BattleSlapInfoPopupPanel);
|
|
}
|
|
}
|
|
}
|