ChallengeResult.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. using System;
  2. using System.Collections;
  3. using UnityEngine;
  4. public class ChallengeResult : Result_Display
  5. {
  6. private void Awake()
  7. {
  8. this.m_RankUIPanel = this.m_RankUI.GetComponent<UIPanel>();
  9. this.m_RankUIPanel.alpha = 0f;
  10. this.m_RankValueEnd = this.m_RankUI.localPosition;
  11. this.m_RankUI.localPosition += Vector3.down * this.m_RankUIPosDawn;
  12. this.m_RankValueStart = this.m_RankUI.localPosition;
  13. base.Initialize();
  14. base.StartCoroutine(this.UISlideIn());
  15. }
  16. protected override void Update()
  17. {
  18. base.Update();
  19. }
  20. protected override void UIInit(Transform child)
  21. {
  22. UISprite component = child.GetComponent<UISprite>();
  23. Vector3 localPosition = child.localPosition;
  24. localPosition.x = UI_ScreenFitBase.PointToScreenPos(Vector3.right * (float)UICamera.ScreenWidth).x;
  25. if (component)
  26. {
  27. localPosition.x += (float)(component.width / 2);
  28. }
  29. this.m_GroupEnd.Add(child.localPosition);
  30. this.m_GroupStart.Add(localPosition);
  31. child.localPosition = localPosition;
  32. }
  33. private IEnumerator UISlideIn()
  34. {
  35. float timer = 0f;
  36. int count = 0;
  37. GameMain.Instance.SoundMgr.PlaySe(this.m_SlideSEName, false);
  38. for (;;)
  39. {
  40. timer += base.m_MydeltaTime;
  41. this.m_ResultGroup.GetChild(count).localPosition = Vector3.Lerp(this.m_GroupStart[count], this.m_GroupEnd[count], base.SinRate01(timer, this.m_UISlide));
  42. if (timer > this.m_UISlide)
  43. {
  44. count++;
  45. timer = 0f;
  46. if (count == this.m_ResultGroup.childCount)
  47. {
  48. break;
  49. }
  50. yield return new WaitForSeconds(this.m_UISlideRug / (float)this.m_TimeSpeed);
  51. GameMain.Instance.SoundMgr.PlaySe(this.m_SlideSEName, false);
  52. }
  53. yield return null;
  54. }
  55. yield return new WaitForSeconds(this.m_RankWait / (float)this.m_TimeSpeed);
  56. base.StartCoroutine(this.RankFadeIn());
  57. yield break;
  58. yield break;
  59. }
  60. private IEnumerator RankFadeIn()
  61. {
  62. float timer = 0f;
  63. for (;;)
  64. {
  65. timer += base.m_MydeltaTime;
  66. this.m_RankUIPanel.alpha = base.SinRate01(timer, this.m_RankFade);
  67. this.m_RankUI.localPosition = Vector3.Lerp(this.m_RankValueStart, this.m_RankValueEnd, base.SinRate01(timer, this.m_RankFade));
  68. if (timer > this.m_RankFade)
  69. {
  70. break;
  71. }
  72. yield return null;
  73. }
  74. this.m_ButtonUI.SetActive(true);
  75. yield break;
  76. yield break;
  77. }
  78. [SerializeField]
  79. [Header("UIのスライド時間")]
  80. private float m_UISlide = 0.15f;
  81. [SerializeField]
  82. [Header("UI表示終了後の待機時間")]
  83. private float m_UISlideRug = 0.0625f;
  84. [SerializeField]
  85. [Header("評定表示UIのフェードイン時間")]
  86. private float m_RankFade = 0.5f;
  87. [SerializeField]
  88. [Header("評定表示UIの表示開始までの待機時間")]
  89. private float m_RankWait = 0.25f;
  90. [SerializeField]
  91. private float m_RankUIPosDawn = 1f;
  92. [SerializeField]
  93. [Header("評定表示UI")]
  94. private Transform m_RankUI;
  95. private UIPanel m_RankUIPanel;
  96. private Vector3 m_RankValueStart;
  97. private Vector3 m_RankValueEnd;
  98. }