Files
AliceBall/Assets/_Alice/Scripts/UI/HUDPanel.cs
2025-07-25 14:30:55 +08:00

61 lines
1.3 KiB
C#

using System;
using System.Collections.Generic;
using DG.Tweening;
using DragonLi.Core;
using LitJson;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using XUI;
using Random = UnityEngine.Random;
public class HUDPanel : UIBehaviour
{
/// <summary>
/// 倒计时文本
/// </summary>
public TextMeshProUGUI LessTimeText;
public Image eggImage;
public static HUDPanel Ins;
private void Awake()
{
Ins = this;
}
public static void Show()
{
OverlayUIManager.Ins.Cover("UI/HUDPanel", false);
}
public override void OnUIShow(params object[] args)
{
base.OnUIShow(args);
eggImage.gameObject.SetActive(false);
}
public void ShowEgg()
{
var go=Instantiate(eggImage,transform).GetComponent<Image>();
go.gameObject.SetActive(true);
int randomX = Random.Range(-300, 300);
int randomY = Random.Range(-300, 300);
go.rectTransform.anchoredPosition=new Vector2(randomX,randomY);
MonoSingleton<CoroutineTaskManager>.Instance.WaitSecondTodo(() =>
{
go.GetComponent<CanvasGroup>().DOFade(0, 2).OnComplete(() =>
{
Destroy(go.gameObject);
});
},2f);
}
void Update()
{
}
}