SceneLogo.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. using System;
  2. using Fove;
  3. using UnityEngine;
  4. public class SceneLogo : MonoBehaviour
  5. {
  6. private void Start()
  7. {
  8. GameMain.Instance.MainCamera.FadeOut(0f, false, null, true, default(Color));
  9. if (GameMain.Instance.VRMode)
  10. {
  11. GameMain.Instance.BgMgr.ChangeBg("EmpireClub_Rotary_Night");
  12. GameMain.Instance.MainCamera.SetPos(new Vector3(0f, 1.855f, 20f));
  13. GameMain.Instance.MainCamera.SetRotation(new Vector3(0f, -180f, 0f));
  14. GameMain.Instance.OvrMgr.OvrCamera.ReCallcOffset();
  15. GameMain.Instance.OvrMgr.OvrCamera.UIPosReset(0f);
  16. }
  17. GameMain.Instance.MainCamera.FadeOutNoUI(0f, true);
  18. GameMain.Instance.MainCamera.FadeIn(1f, false, new CameraMain.dgOnCompleteFade(this.OnCompleteFadeIn), true, true, default(Color));
  19. this.m_eMode = SceneLogo.Mode.FadeIn;
  20. GameMain.Instance.SysShortcut.gameObject.SetActive(false);
  21. if (GameMain.Instance.VRMode)
  22. {
  23. this.m_guiStyle = new GUIStyle();
  24. this.m_guiStyle.fontSize = 15;
  25. this.m_styleState = new GUIStyleState();
  26. this.m_styleState.textColor = Color.gray;
  27. this.m_guiStyle.normal = this.m_styleState;
  28. }
  29. }
  30. private void Update()
  31. {
  32. if (this.m_eMode == SceneLogo.Mode.ClickWait && !GameMain.Instance.CharacterMgr.IsBusy() && this.GetAnyMouseAndKey())
  33. {
  34. GameMain.Instance.SoundMgr.PlaySystem(SoundMgr.SeType.IClick);
  35. GameMain.Instance.MainCamera.FadeOut(1f, false, new CameraMain.dgOnCompleteFade(this.OnCompleteFadeOut), true, default(Color));
  36. GameMain.Instance.MainCamera.FadeInNoUI(0f, true);
  37. this.m_eMode = SceneLogo.Mode.FadeOut;
  38. }
  39. }
  40. private void OnCompleteFadeIn()
  41. {
  42. this.m_eMode = SceneLogo.Mode.ClickWait;
  43. }
  44. private void OnCompleteFadeOut()
  45. {
  46. if (GameMain.Instance.VRMode && GameMain.Instance.VRFamily == GameMain.VRFamilyType.NON)
  47. {
  48. Application.Quit();
  49. return;
  50. }
  51. GameMain.Instance.LoadScene("SceneWarning");
  52. }
  53. private void OnGUI()
  54. {
  55. if (GameMain.Instance.VRMode)
  56. {
  57. string text = "VR デバイスが見つけられません。";
  58. if (GameMain.Instance.VRFamily == GameMain.VRFamilyType.Oculus)
  59. {
  60. text = string.Concat(new object[]
  61. {
  62. "Oculus Ver.",
  63. OVRPlugin.version,
  64. " Wrapper Ver.",
  65. OVRPlugin.wrapperVersion
  66. });
  67. }
  68. else if (GameMain.Instance.VRFamily == GameMain.VRFamilyType.HTC)
  69. {
  70. SteamVR instance = SteamVR.instance;
  71. if (instance != null)
  72. {
  73. text = "SteamVR Ver.1.1.0 Model Number." + instance.hmd_ModelNumber + " TrackingSystemName." + instance.hmd_TrackingSystemName;
  74. }
  75. }
  76. else if (GameMain.Instance.VRFamily == GameMain.VRFamilyType.FOVE)
  77. {
  78. try
  79. {
  80. FoveHeadset headset = FoveHeadset.GetHeadset();
  81. if (headset.IsHardwareConnected() && headset.IsHardwareReady())
  82. {
  83. SFVR_Versions softwareVersions = headset.GetSoftwareVersions();
  84. string text2 = string.Concat(new object[]
  85. {
  86. softwareVersions.runtimeMajor,
  87. ".",
  88. softwareVersions.runtimeMinor,
  89. ".",
  90. softwareVersions.runtimeBuild
  91. });
  92. string text3 = string.Concat(new object[]
  93. {
  94. softwareVersions.clientMajor,
  95. ".",
  96. softwareVersions.clientMinor,
  97. ".",
  98. softwareVersions.clientBuild
  99. });
  100. text = string.Concat(new object[]
  101. {
  102. "FOVE ClientVersion.",
  103. text3,
  104. " RuntimeVersion.",
  105. text2,
  106. " FirmwareVersion.",
  107. softwareVersions.firmware
  108. });
  109. }
  110. }
  111. catch (Exception ex)
  112. {
  113. Debug.LogError("FoveInterface 例外発生 in Logo:" + ex.Message);
  114. }
  115. }
  116. if (GameMain.Instance.VRFamily == GameMain.VRFamilyType.NON)
  117. {
  118. GUI.Label(new Rect(10f, 10f, 200f, 40f), text + " クリックするとゲームを終了します。");
  119. }
  120. else
  121. {
  122. GUI.Label(new Rect(10f, 10f, 200f, 40f), text, this.m_guiStyle);
  123. }
  124. }
  125. }
  126. private bool GetAnyMouseAndKey()
  127. {
  128. return NInput.GetMouseButtonUp(0) || NInput.GetMouseButtonUp(1) || NInput.GetMouseButtonUp(2) || Input.GetKeyUp(KeyCode.Return) || GameMain.Instance.IsForceSkip();
  129. }
  130. private SceneLogo.Mode m_eMode;
  131. private GUIStyle m_guiStyle;
  132. private GUIStyleState m_styleState;
  133. private enum Mode
  134. {
  135. FadeIn,
  136. ClickWait,
  137. FadeOut
  138. }
  139. }