BenchResult.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. using System;
  2. using System.Collections;
  3. using System.Linq;
  4. using UnityEngine;
  5. public class BenchResult : Result_Display
  6. {
  7. private void Awake()
  8. {
  9. base.Initialize();
  10. this.m_ButtonUI.SetActive(true);
  11. GameMain.Instance.BgMgr.ChangeBg("LiveStage");
  12. this.m_LoopModeFlag = BenchSetting.Setting.IsLoopMode;
  13. bool flag = false;
  14. this.m_OSLabel.text = SystemInfo.operatingSystem;
  15. this.m_CPULabel.text = string.Concat(new object[]
  16. {
  17. SystemInfo.processorType,
  18. " : ",
  19. SystemInfo.processorCount,
  20. "Core"
  21. });
  22. this.m_MemoryLabel.text = SystemInfo.systemMemorySize + " MB System Memory ";
  23. this.m_GraphicsLabel.text = string.Concat(new object[]
  24. {
  25. SystemInfo.graphicsDeviceName,
  26. " : ",
  27. SystemInfo.graphicsMemorySize,
  28. "MB : ",
  29. SystemInfo.graphicsDeviceType
  30. });
  31. string text = "benchmark_setting.nei";
  32. if (!GameUty.FileSystem.IsExistentFile(text))
  33. {
  34. NDebug.Assert("表がありません。" + text, false);
  35. }
  36. using (AFileBase afileBase = GameUty.FileSystem.FileOpen(text))
  37. {
  38. using (CsvParser csvParser = new CsvParser())
  39. {
  40. bool condition = csvParser.Open(afileBase);
  41. NDebug.Assert(condition, text + "\nopen failed.");
  42. for (int i = 1; i < csvParser.max_cell_y; i++)
  43. {
  44. this.m_BenchNotation[i - 1].BenchScore = csvParser.GetCellAsInteger(1, i);
  45. }
  46. }
  47. }
  48. foreach (BenchResult.BenchParam benchParam in this.m_BenchNotation)
  49. {
  50. benchParam.ScoreImage.SetActive(true);
  51. if (benchParam.BenchScore > BenchMarkScore.BenchScore || flag)
  52. {
  53. benchParam.ScoreImage.SetActive(false);
  54. }
  55. else
  56. {
  57. flag = true;
  58. }
  59. }
  60. this.m_FPSLabel.gameObject.SetActive(Application.targetFrameRate != 60);
  61. this.m_FPSLabel.text = "TargetFPS:";
  62. UILabel fpslabel = this.m_FPSLabel;
  63. fpslabel.text += ((Application.targetFrameRate > 0) ? Application.targetFrameRate.ToString() : "No limit");
  64. if (!flag)
  65. {
  66. this.m_BenchNotation.Last<BenchResult.BenchParam>().ScoreImage.SetActive(true);
  67. }
  68. this.m_LoopSupplement.SetActive(this.m_LoopModeFlag);
  69. if (this.m_LoopModeFlag)
  70. {
  71. base.StartCoroutine(this.LoopWait());
  72. }
  73. }
  74. private IEnumerator LoopWait()
  75. {
  76. while (this.m_LoopModeFlag)
  77. {
  78. if (!BaseMgr<ConfigMgr>.Instance.IsOpenConfigPanel())
  79. {
  80. this.m_WaitTimer += Time.deltaTime;
  81. }
  82. this.m_NextLoopLabel.text = string.Format("次のループまであと:{0}秒", Mathf.Max(this.m_NextLoopWait - Mathf.Floor(this.m_WaitTimer), 0f));
  83. if (this.m_WaitTimer >= this.m_NextLoopWait)
  84. {
  85. this.m_EndLabel = this.m_LoopLabel;
  86. base.StartCoroutine(base.FadeOut());
  87. yield break;
  88. }
  89. yield return null;
  90. }
  91. yield break;
  92. yield break;
  93. }
  94. private void FadeEnd()
  95. {
  96. BenchSetting.SettingApplay();
  97. DanceSelect.BenchMarkInit();
  98. ShootCutInTex.SetEnemyCutInTex(false);
  99. ShootCutInTex.SetPlayerCutInTex();
  100. base.ResultEnd();
  101. }
  102. public override void ClickButton()
  103. {
  104. if (this.m_LoopModeFlag)
  105. {
  106. if (this.m_WaitTimer >= this.m_NextLoopWait)
  107. {
  108. return;
  109. }
  110. this.m_LoopModeFlag = false;
  111. BenchSetting.SettingRecet();
  112. }
  113. base.ClickButton();
  114. }
  115. protected override void ResultEnd()
  116. {
  117. if (this.m_LoopModeFlag)
  118. {
  119. GameMain.Instance.MainCamera.FadeOut(0.5f, false, new CameraMain.dgOnCompleteFade(this.FadeEnd), false, default(Color));
  120. }
  121. else
  122. {
  123. base.ResultEnd();
  124. }
  125. }
  126. protected override void Update()
  127. {
  128. base.Update();
  129. }
  130. protected override void UIInit(Transform child)
  131. {
  132. }
  133. [SerializeField]
  134. [Header("システム情報")]
  135. private UILabel m_OSLabel;
  136. [SerializeField]
  137. private UILabel m_CPULabel;
  138. [SerializeField]
  139. private UILabel m_MemoryLabel;
  140. [SerializeField]
  141. private UILabel m_GraphicsLabel;
  142. [SerializeField]
  143. [Header("各評価の表記")]
  144. private BenchResult.BenchParam[] m_BenchNotation;
  145. [SerializeField]
  146. [Header("次のループに行くまでの待機時間")]
  147. private float m_NextLoopWait = 10f;
  148. [SerializeField]
  149. private GameObject m_LoopSupplement;
  150. [SerializeField]
  151. private UILabel m_NextLoopLabel;
  152. private float m_WaitTimer;
  153. [SerializeField]
  154. [Header("ループモード時に飛ぶラベル")]
  155. private string m_LoopLabel = "*ダンススタート";
  156. [SerializeField]
  157. private UILabel m_FPSLabel;
  158. private bool m_LoopModeFlag;
  159. private enum BenchEvalue
  160. {
  161. VeryComfort,
  162. Comfort,
  163. Normal,
  164. Strict,
  165. VeryStrict
  166. }
  167. [Serializable]
  168. private class BenchParam
  169. {
  170. public BenchResult.BenchEvalue Evalue;
  171. public GameObject ScoreImage;
  172. [HideInInspector]
  173. public int BenchScore;
  174. }
  175. }