VSResult.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. public class VSResult : Result_Display
  6. {
  7. private void Awake()
  8. {
  9. this.m_IsWin = (GameMain.Instance.CharacterMgr.status.GetFlag("ダンス勝敗") == 1);
  10. if (!this.m_IsWin)
  11. {
  12. this.m_BattleResultEnd = this.m_BattleResultUI.localPosition;
  13. this.m_BattleResultUI.localPosition += Vector3.down * this.m_LoseUIDown;
  14. this.m_BattleResultStart = this.m_BattleResultUI.localPosition;
  15. this.m_BattlePanel = this.m_BattleResultUI.GetComponent<UIPanel>();
  16. this.m_BattlePanel.alpha = 0f;
  17. }
  18. base.Initialize();
  19. base.StartCoroutine(this.SlideIn());
  20. }
  21. protected override void UIInit(Transform child)
  22. {
  23. UISprite component = child.GetComponent<UISprite>();
  24. Vector3 localPosition = child.localPosition;
  25. localPosition.x = UI_ScreenFitBase.PointToScreenPos(Vector3.right * (float)UICamera.ScreenWidth).x;
  26. if (component)
  27. {
  28. localPosition.x += (float)(component.width / 2);
  29. }
  30. if (this.m_BattleResultUI != child)
  31. {
  32. this.m_GroupEnd.Add(child.localPosition);
  33. this.m_GroupStart.Add(localPosition);
  34. child.localPosition = localPosition;
  35. this.m_SlideUIList.Add(child);
  36. }
  37. else if (this.m_IsWin)
  38. {
  39. this.m_BattleResultStart = localPosition;
  40. this.m_BattleResultEnd = child.localPosition;
  41. child.localPosition = localPosition;
  42. }
  43. }
  44. protected override void Update()
  45. {
  46. base.Update();
  47. }
  48. private IEnumerator SlideIn()
  49. {
  50. while (GameMain.Instance.MainCamera.IsFadeOut())
  51. {
  52. yield return null;
  53. }
  54. float timer = 0f;
  55. int count = 0;
  56. GameMain.Instance.SoundMgr.PlaySe(this.m_SlideSEName, false);
  57. for (;;)
  58. {
  59. timer += base.m_MydeltaTime;
  60. this.m_SlideUIList[count].localPosition = Vector3.Lerp(this.m_GroupStart[count], this.m_GroupEnd[count], base.SinRate01(timer, this.m_UISlide));
  61. if (timer > this.m_UISlide)
  62. {
  63. count++;
  64. timer = 0f;
  65. if (count == this.m_SlideUIList.Count)
  66. {
  67. break;
  68. }
  69. GameMain.Instance.SoundMgr.PlaySe(this.m_SlideSEName, false);
  70. yield return new WaitForSeconds(this.m_UISlideRug / (float)this.m_TimeSpeed);
  71. }
  72. yield return null;
  73. }
  74. yield return new WaitForSeconds(this.m_BatteleResultWait / (float)this.m_TimeSpeed);
  75. base.StartCoroutine(this.DisplayBattleResult());
  76. yield break;
  77. yield break;
  78. }
  79. private IEnumerator DisplayBattleResult()
  80. {
  81. float timer = 0f;
  82. if (this.m_IsWin)
  83. {
  84. GameMain.Instance.SoundMgr.PlaySe(this.m_WinSEName, false);
  85. }
  86. else
  87. {
  88. GameMain.Instance.SoundMgr.PlaySe(this.m_LoseSEName, false);
  89. }
  90. for (;;)
  91. {
  92. timer += base.m_MydeltaTime;
  93. float time_rimmit = 0f;
  94. if (this.m_IsWin)
  95. {
  96. this.m_BattleResultUI.localPosition = Vector3.Lerp(this.m_BattleResultStart, this.m_BattleResultEnd, base.SinRate01(timer, this.m_WinSlide));
  97. time_rimmit = this.m_WinSlide;
  98. }
  99. else
  100. {
  101. this.m_BattleResultUI.localPosition = Vector3.Lerp(this.m_BattleResultStart, this.m_BattleResultEnd, base.SinRate01(timer, this.m_LoseUIFade));
  102. this.m_BattlePanel.alpha = base.SinRate01(timer, this.m_LoseUIFade);
  103. time_rimmit = this.m_LoseUIFade;
  104. }
  105. if (timer > time_rimmit)
  106. {
  107. break;
  108. }
  109. yield return null;
  110. }
  111. yield return new WaitForSeconds(this.m_ButtonActiveWait / (float)this.m_TimeSpeed);
  112. this.m_ButtonUI.SetActive(true);
  113. yield break;
  114. yield break;
  115. }
  116. [SerializeField]
  117. [Header("勝った時に鳴らすSE")]
  118. private string m_WinSEName = "4_battle_win.ogg";
  119. [SerializeField]
  120. [Header("負けた時に鳴らすSE")]
  121. private string m_LoseSEName = "5_battle_lose.ogg";
  122. [SerializeField]
  123. [Header("UIのスライド時間")]
  124. private float m_UISlide = 0.15f;
  125. [SerializeField]
  126. [Header("UI表示終了後の待機時間")]
  127. private float m_UISlideRug = 0.0625f;
  128. [SerializeField]
  129. [Header("対戦結果を表示するまでの待機時間")]
  130. private float m_BatteleResultWait = 1f;
  131. [SerializeField]
  132. [Header("勝利時のUIスライド時間")]
  133. private float m_WinSlide = 0.15f;
  134. [SerializeField]
  135. private float m_LoseUIDown = 1f;
  136. [SerializeField]
  137. [Header("勝利時のUIフェードイン時間")]
  138. private float m_LoseUIFade = 0.75f;
  139. private Vector3 m_BattleResultStart;
  140. private Vector3 m_BattleResultEnd;
  141. [SerializeField]
  142. [Header("結果表示後の待機時間")]
  143. private float m_ButtonActiveWait = 0.5f;
  144. [SerializeField]
  145. [Header("勝負結果表示UI")]
  146. private Transform m_BattleResultUI;
  147. private List<Transform> m_SlideUIList = new List<Transform>();
  148. private UIPanel m_BattlePanel;
  149. private bool m_IsWin;
  150. }