2024-12-09 18:01:59 +08:00
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
using DG.Tweening;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
public class BaseUI :Base
|
|
|
|
|
{
|
|
|
|
|
[Header("<22><><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><D4B6><EFBFBD>panel<65><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>,<2C><><EFBFBD><EFBFBD><EFBFBD>ɵ<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>Զ<EFBFBD><D4B6>ж<EFBFBD><D0B6><EFBFBD>")]
|
|
|
|
|
public GameObject _panel;
|
|
|
|
|
|
|
|
|
|
public List<Button> BTNs = new List<Button>();
|
|
|
|
|
public virtual async Task showPanel(GameObject panel)
|
|
|
|
|
{
|
|
|
|
|
if (panel == null)
|
|
|
|
|
{
|
|
|
|
|
Debug.LogError("panel==null");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
panel.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
|
|
|
|
|
panel.transform.DOScale(1f, 0.5f);
|
|
|
|
|
await Task.Delay(500);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void addEventPopUp(string Details, float time = 5f)//<2F><><EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD>
|
|
|
|
|
{
|
|
|
|
|
GameObject prefab = Resources.Load<GameObject>("base/EventPopUp");
|
|
|
|
|
prefab.GetComponent<EventPopUp>().time = time;
|
|
|
|
|
Canvas canvas = GetComponentInParent<Canvas>();
|
|
|
|
|
prefab.GetComponent<EventPopUp>().text = Details;
|
|
|
|
|
Instantiate(prefab, canvas.transform);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ע<>ᰴť<E1B0B4><C5A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>¼<EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="btn"><3E><>ť</param>
|
|
|
|
|
/// <param name="action"><3E>¼<EFBFBD></param>
|
|
|
|
|
public void RegisterButton(Button btn, UnityEngine.Events.UnityAction action)
|
|
|
|
|
{
|
|
|
|
|
if (btn != null && action != null)
|
|
|
|
|
{
|
|
|
|
|
btn.onClick.AddListener(action);
|
|
|
|
|
BTNs.Add(btn); // <20><><EFBFBD><EFBFBD>ť<EFBFBD><C5A5><EFBFBD>뵽<EFBFBD><EBB5BD>ť<EFBFBD><C5A5>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Debug.LogError("Button or action is null!");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ע<><D7A2><EFBFBD><EFBFBD>ť<EFBFBD><C5A5>Ӧ<EFBFBD>¼<EFBFBD>
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="btn"><3E><>ť</param>
|
|
|
|
|
/// <param name="action"><3E>¼<EFBFBD></param>
|
|
|
|
|
public void UnregisterButton(Button btn, UnityEngine.Events.UnityAction action)
|
|
|
|
|
{
|
|
|
|
|
if (btn != null && action != null)
|
|
|
|
|
{
|
|
|
|
|
btn.onClick.RemoveListener(action);
|
|
|
|
|
BTNs.Remove(btn); // <20>Ӱ<EFBFBD>ť<EFBFBD><C5A5><EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD><C6B3><EFBFBD>ť
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// ע<><D7A2><EFBFBD><EFBFBD><EFBFBD>а<EFBFBD>ť<EFBFBD><C5A5><EFBFBD><EFBFBD>Ӧ<EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>հ<EFBFBD>ť<EFBFBD><C5A5>
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void UnregisterAllButtons()
|
|
|
|
|
{
|
|
|
|
|
foreach (Button btn in BTNs)
|
|
|
|
|
{
|
|
|
|
|
if (btn != null)
|
|
|
|
|
{
|
|
|
|
|
// ȡ<><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
btn.onClick.RemoveAllListeners();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD>հ<EFBFBD>ť<EFBFBD><C5A5>
|
|
|
|
|
BTNs.Clear();
|
|
|
|
|
}
|
2024-12-13 22:28:16 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//public
|
2024-12-09 18:01:59 +08:00
|
|
|
|
}
|