UIFlashItem.cs 955 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using System;
  2. using DG.Tweening;
  3. using ExtensionMethods;
  4. using UnityEngine;
  5. public class UIFlashItem : MonoBehaviour
  6. {
  7. public void Appear()
  8. {
  9. this._bg.alpha = 0f;
  10. this._bg.gameObject.SetActive(true);
  11. this._effect.alpha = 0f;
  12. this._effect.transform.localScale = Vector3.one;
  13. this._effect.gameObject.SetActive(true);
  14. Sequence s = DOTween.Sequence();
  15. s.Append(this._bg.DOFade(0.7058824f, 0.5f));
  16. s.Append(this._bg.DOFade(1f, 0.0833333358f));
  17. this._effect.transform.DOScale(new Vector3(2f, 2.5f, 1f), 0.333333343f).SetEase(Ease.OutSine).OnPlay(delegate
  18. {
  19. this._effect.alpha = 1f;
  20. }).SetDelay(0.5f);
  21. this._effect.DOFade(0f, 0.333333343f).OnComplete(delegate
  22. {
  23. this._effect.gameObject.SetActive(false);
  24. }).SetDelay(0.5f);
  25. }
  26. public void Disapper()
  27. {
  28. this._bg.gameObject.SetActive(false);
  29. }
  30. [SerializeField]
  31. private UISprite _effect;
  32. [SerializeField]
  33. private UISprite _bg;
  34. }