TipsView.cs 823 B

12345678910111213141516171819202122232425262728293031323334353637
  1. using DG.Tweening;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using UnityEngine;
  6. using UnityEngine.UI;
  7. public class TipsView : MonoBehaviour
  8. {
  9. public Text txt_Info;
  10. public Image img_tips;
  11. // Start is called before the first frame update
  12. void Start()
  13. {
  14. MessageManager.Instance.OnAddlisten((int)MessageId.Tips, SetContent);
  15. }
  16. private void SetContent(object obj)
  17. {
  18. object[] content = obj as object[];
  19. txt_Info.text = content[0].ToString();
  20. img_tips.gameObject.SetActive(true);
  21. img_tips.DOFade(1, 2).OnComplete(()=> { img_tips.DOFade(0, 2); img_tips.gameObject.SetActive(false); } );
  22. }
  23. private void OnEnable()
  24. {
  25. }
  26. // Update is called once per frame
  27. void Update()
  28. {
  29. }
  30. }