SceneLogo.cs 4.3 KB

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