Donghua.cs 932 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.UI;
  5. using DG.Tweening;
  6. public class Donghua : MonoBehaviour
  7. {
  8. RawImage rimage;
  9. // Start is called before the first frame update
  10. void Awake()
  11. {
  12. rimage = this.GetComponent<RawImage>();
  13. }
  14. // Update is called once per frame
  15. void Update()
  16. {
  17. }
  18. public void Show()
  19. {
  20. if(rimage ==null)
  21. rimage = this.GetComponent<RawImage>();
  22. rimage.DOKill();
  23. rimage.color = Color.black;
  24. rimage.DOColor(new Color(Color.black.r, Color.black.g, Color.black.b, 0),0.5f);
  25. }
  26. public void Hide()
  27. {
  28. if (rimage == null)
  29. rimage = this.GetComponent<RawImage>();
  30. rimage.DOKill();
  31. rimage.DOColor(Color.black, 0.5f).OnComplete(()=> { }).OnComplete(() => { this.transform.parent.parent.gameObject.SetActive(false); });
  32. }
  33. }