_TheStrongestSnail/TheStrongestSnail/Assets/common/base/base.cs

31 lines
976 B
C#
Raw Normal View History

2024-11-25 23:31:50 +08:00
using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;
public class Base : MonoBehaviour
{
public async Task ButtonClickAnimationAsync(GameObject button)
{
TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>();
Sequence mySequence = DOTween.Sequence();
mySequence.Append(button.transform.DOScale(1.25f, 0.1f)) // <20><>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
.Append(button.transform.DOScale(1f, 0.2f)).OnComplete(() => {
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɺ<EFBFBD>ִ<EFBFBD>еĴ<D0B5><C4B4><EFBFBD>
tcs.SetResult(true);
}); // <20>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
await tcs.Task;
}
public void addEventPopUp(string Details)
{
GameObject prefab = Resources.Load<GameObject>("base/EventPopUp");
Canvas canvas = GetComponentInParent<Canvas>();
prefab.GetComponent<EventPopUp>().text = Details;
Instantiate(prefab, canvas.transform);
}
}