UIEndTitleController.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using System;
  2. using System.Collections;
  3. using DG.Tweening;
  4. using UnityEngine;
  5. public class UIEndTitleController : MonoBehaviour
  6. {
  7. public YieldInstruction Show(bool type)
  8. {
  9. return base.StartCoroutine(this.ShowCoroutine(type));
  10. }
  11. private IEnumerator ShowCoroutine(bool type)
  12. {
  13. UILabel label = (!type) ? this._falseLabel : this._trueLabel;
  14. bool uiState = R.Ui.IsHide;
  15. R.Mode.EnterMode(Mode.AllMode.Story);
  16. if (!uiState)
  17. {
  18. R.Ui.HideUI(true);
  19. }
  20. int offset = label.height + UITools.ScreenHeight;
  21. this._background.gameObject.SetActive(true);
  22. label.transform.parent.gameObject.SetActive(true);
  23. yield return DOTween.To(delegate(float a)
  24. {
  25. this._background.alpha = a;
  26. }, 0f, 1f, 1f).WaitForCompletion();
  27. yield return label.transform.parent.DOLocalMoveY((float)offset, (float)offset / (float)this._speed, false).SetEase(Ease.Linear).WaitForCompletion();
  28. yield return new WaitForSeconds(1f);
  29. if (type)
  30. {
  31. yield return DOTween.To(delegate(float a)
  32. {
  33. label.alpha = a;
  34. }, 1f, 0f, 5f).WaitForCompletion();
  35. }
  36. yield return DOTween.To(delegate(float a)
  37. {
  38. this._background.alpha = a;
  39. }, 1f, 0f, 1f).WaitForCompletion();
  40. label.transform.parent.gameObject.SetActive(false);
  41. this._background.gameObject.SetActive(false);
  42. label.transform.parent.localPosition = new Vector3(0f, (float)(-(float)UITools.ScreenHeight), 0f);
  43. label.alpha = 1f;
  44. if (!uiState)
  45. {
  46. R.Ui.ShowUI(false);
  47. }
  48. R.Mode.ExitMode(Mode.AllMode.Story);
  49. yield break;
  50. }
  51. [SerializeField]
  52. private UISprite _background;
  53. [SerializeField]
  54. private UILabel _falseLabel;
  55. [SerializeField]
  56. private UILabel _trueLabel;
  57. [SerializeField]
  58. private int _speed;
  59. }