UINotifacationController.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System;
  2. using System.Collections;
  3. using UnityEngine;
  4. public class UINotifacationController : MonoBehaviour
  5. {
  6. private void Start()
  7. {
  8. this._label = base.GetComponentInChildren<UILabel>();
  9. this._playAnimation = base.GetComponent<UIPlayAnimation>();
  10. this._animClipLength = this._playAnimation.target.clip.length;
  11. }
  12. public void FadeIn(string str)
  13. {
  14. R.Audio.PlayEffect(363, null);
  15. str = "[-]" + str;
  16. str = str.Replace("[-]", "[FFFFFF]");
  17. this._label.text = str;
  18. this._label.alpha = 0.8f;
  19. this._playAnimation.Play(true, false);
  20. }
  21. public Coroutine Show(string str, float delayTime)
  22. {
  23. R.Audio.PlayEffect(363, null);
  24. this.FadeIn(str);
  25. return this.FadeOut(this._animClipLength + delayTime, 1f);
  26. }
  27. public void SetText(string str)
  28. {
  29. this._label.text = str;
  30. }
  31. public Coroutine FadeOut(float delayTime = 0f, float duration = 1f)
  32. {
  33. return base.StartCoroutine(this.FadeOutCo(delayTime, duration));
  34. }
  35. private IEnumerator FadeOutCo(float delayTime, float duration)
  36. {
  37. yield return WorldTime.WaitForSecondsIgnoreTimeScale(delayTime);
  38. this._playAnimation.Play(false, false);
  39. yield return WorldTime.WaitForSecondsIgnoreTimeScale(this._animClipLength);
  40. yield break;
  41. }
  42. private UILabel _label;
  43. private UIPlayAnimation _playAnimation;
  44. private float _animClipLength;
  45. }