123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using DG.Tweening;
- using Plugins.CxShine.page;
- using Unity.VisualScripting;
- using UnityEngine;
- using UnityEngine.UI;
- namespace UI.Common
- {
- public class TipsComp : MonoBehaviour
- {
- public static void ShowTips(string str)
- {
- Debug.Log(str);
- var o = PageManagerComp.singleton.OpenPage("Items/TipsPrefab");
- o.GetComponent<TipsComp>()._show(str);
- }
- public Text TextContent;
- public Image Main;
- private void Start()
- {
- }
- private void close()
- {
- if (gameObject.IsDestroyed())
- {
- return;
- }
- Destroy(gameObject);
- }
- private void _show(string testString)
- {
- TextContent.text = testString;
- Invoke(nameof(close), 2f);
- var sq = DOTween.Sequence();
- // sq.Append(Main.transform.DOLocalMove(
- // new Vector3(Main.transform.position.x, Main.transform.position.y + 300, Main.transform.position.z),
- // 1f));
- // sq.Append(DOTween.Sequence().Append(Main.DOFade(0, 0.5f)).Join(TextContent.DOFade(0, 2f)));
- sq.Append(Main.transform.DOMoveY(
- Main.transform.position.y + 300,
- 1f));
- sq.Append(DOTween.Sequence().Append(Main.DOFade(0, 2f)).Join(TextContent.DOFade(0, 2f)));
- sq.onComplete += () => { close(); };
- sq.Play();
- }
- }
- }
|