_TheStrongestSnail/TheStrongestSnail/Assets/Scripts/Scene_shop/BaseUIPanel.cs

74 lines
1.5 KiB
C#
Raw Normal View History

2024-11-25 14:35:28 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using DG.Tweening;
2024-11-26 02:09:38 +08:00
using System.Threading.Tasks;
2024-11-25 14:35:28 +08:00
//panel<65><6C><EFBFBD><EFBFBD><E0A3AC>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>panel<65><6C><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
//<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Panel
//<2F>뽫panel<65><6C><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD>սڵ<D5BD><DAB5>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ű<EFBFBD><C5B1>ſսڵ<D5BD>
2024-11-25 23:31:50 +08:00
public class BaseUIPanel : Base
2024-11-25 14:35:28 +08:00
{
2024-11-26 17:03:30 +08:00
[Header("<22><>ʾor<6F><72>ʧ<EFBFBD><CAA7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD>Բ<EFBFBD><D4B2><EFBFBD>")]
2024-11-25 14:35:28 +08:00
public GameObject Panel;
2024-11-26 15:33:45 +08:00
[Header("CloseBTN,<2C><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD><EFBFBD>Բ<EFBFBD><D4B2><EFBFBD>")]
2024-11-25 14:35:28 +08:00
public Button CloseBTN;
// Start is called before the first frame update
public virtual void Start()
{
2024-11-26 15:33:45 +08:00
if (Panel!=null)
{
2024-11-25 14:35:28 +08:00
HidePanel();
2024-11-26 15:33:45 +08:00
}
if (CloseBTN!=null)
{
CloseBTN.onClick.AddListener(() => {
HidePanel();
});
}
2024-11-25 14:35:28 +08:00
}
/// <summary>
/// <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><E5A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д
/// </summary>
public virtual void ShopPanel()
{
Panel.gameObject.SetActive(true);
2024-11-26 02:09:38 +08:00
if (CloseBTN != null)
{
2024-11-26 17:03:30 +08:00
CloseBTN.gameObject.SetActive(true);
2024-11-26 02:09:38 +08:00
}
2024-11-25 14:35:28 +08:00
Panel.transform.DOScale(1f, 0.3f);
}
/// <summary>
2024-11-26 15:33:45 +08:00
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E5A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д
2024-11-25 14:35:28 +08:00
/// </summary>
2024-11-26 02:09:38 +08:00
public virtual async Task HidePanel()
2024-11-25 14:35:28 +08:00
{
Panel.transform.DOScale(0.5f,0.2f);
2024-11-26 02:09:38 +08:00
if (CloseBTN != null)
{
CloseBTN.gameObject.SetActive(false);
}
2024-11-25 14:35:28 +08:00
Panel.gameObject.SetActive(false);
2024-11-26 02:09:38 +08:00
await Task.Delay(200);
2024-11-25 14:35:28 +08:00
}
2024-11-26 02:59:54 +08:00
public async void closure()
{
await HidePanel();
Destroy(gameObject);
}
2024-11-27 11:25:42 +08:00
2024-11-25 14:35:28 +08:00
}