VRCanvasManagerMini.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Events;
  5. using UnityEngine.EventSystems;
  6. public class VRCanvasManagerMini : VRCanvasManager
  7. {
  8. public void AddCanvas(Canvas canvas)
  9. {
  10. if (this.m_StackCanvas.Contains(canvas))
  11. {
  12. Debug.Log(string.Format("[CanvasmanagerMini]既に「{0}」は追加されている", canvas.gameObject.name));
  13. return;
  14. }
  15. this.m_StackCanvas.Add(canvas);
  16. }
  17. public void RemoveCanvas(Canvas canvas)
  18. {
  19. if (!canvas)
  20. {
  21. Debug.Log("[CanvasmanagerMini]リストから削除するキャンバスでnullが指定された");
  22. return;
  23. }
  24. if (!this.m_StackCanvas.Contains(canvas))
  25. {
  26. Debug.Log(string.Format("[CanvasmanagerMini]キャンバス「{0}」は管理していない", canvas.gameObject.name));
  27. return;
  28. }
  29. this.m_StackCanvas.Remove(canvas);
  30. }
  31. private void Awake()
  32. {
  33. VRCanvasManager.m_Instance = this;
  34. }
  35. private void Start()
  36. {
  37. }
  38. private void Update()
  39. {
  40. CanvasGroup component = base.GetComponent<CanvasGroup>();
  41. if (!GameMain.Instance.OvrMgr.OvrCamera.IsUIShow)
  42. {
  43. component.interactable = false;
  44. component.blocksRaycasts = false;
  45. component.alpha = 0f;
  46. return;
  47. }
  48. component.interactable = true;
  49. component.blocksRaycasts = true;
  50. component.alpha = 1f;
  51. bool isRotDown = GameMain.Instance.OvrMgr.OvrCamera.OvrTablet.IsRotDown;
  52. bool isSideBack = GameMain.Instance.OvrMgr.OvrCamera.OvrTablet.IsSideBack;
  53. Vector3 zero = Vector3.zero;
  54. zero.z = ((!isRotDown) ? 0f : 180f);
  55. zero.y = ((!isSideBack) ? 0f : 180f);
  56. zero.x = ((!isSideBack) ? 90f : -90f);
  57. base.transform.localEulerAngles = zero;
  58. }
  59. private void LateUpdate()
  60. {
  61. }
  62. public new void OpenVRCanvas()
  63. {
  64. }
  65. public override void OpenVRCanvas(VRCanvasManager.VRCanvasType type)
  66. {
  67. if (type == VRCanvasManager.VRCanvasType.Dialog)
  68. {
  69. for (int i = 0; i < this.m_StackCanvas.Count; i++)
  70. {
  71. Canvas canvas = this.m_StackCanvas[i];
  72. if (canvas)
  73. {
  74. if (canvas.gameObject.activeInHierarchy)
  75. {
  76. UICanvasFade component = canvas.GetComponent<UICanvasFade>();
  77. if (component)
  78. {
  79. component.FadeOut();
  80. }
  81. else
  82. {
  83. canvas.gameObject.SetActive(false);
  84. }
  85. }
  86. }
  87. }
  88. VRDialogMenu vrdialogMenu = VRDialogMenu.CreateDialog();
  89. if (vrdialogMenu)
  90. {
  91. UICanvasFade component2 = vrdialogMenu.GetComponent<UICanvasFade>();
  92. component2.FadeIn();
  93. }
  94. }
  95. if (type == VRCanvasManager.VRCanvasType.Selector)
  96. {
  97. for (int j = 0; j < this.m_StackCanvas.Count; j++)
  98. {
  99. Canvas canvas2 = this.m_StackCanvas[j];
  100. if (canvas2)
  101. {
  102. if (canvas2.gameObject.activeInHierarchy)
  103. {
  104. UICanvasFade component3 = canvas2.GetComponent<UICanvasFade>();
  105. if (component3)
  106. {
  107. component3.FadeOut();
  108. }
  109. else
  110. {
  111. canvas2.gameObject.SetActive(false);
  112. }
  113. }
  114. }
  115. }
  116. VRSelectorMenu vrselectorMenu = VRSelectorMenu.CreateSelector();
  117. if (vrselectorMenu)
  118. {
  119. UICanvasFade component4 = vrselectorMenu.GetComponent<UICanvasFade>();
  120. component4.FadeIn();
  121. }
  122. }
  123. }
  124. public new void CloseVRCanvas()
  125. {
  126. }
  127. public override void ChangeCanvas(GameObject MainCanvas)
  128. {
  129. }
  130. public new void OpenBeforeVRCanvas()
  131. {
  132. }
  133. public new bool IsExistsBeforeVRCanvas()
  134. {
  135. return false;
  136. }
  137. public new void ClearCanvasStack()
  138. {
  139. }
  140. public new void UpdateCanvas()
  141. {
  142. }
  143. public new void OpenVRConfig(UnityAction callback)
  144. {
  145. }
  146. public new void OpenVRCulture(UnityAction callback_select, UnityAction callback_cancel)
  147. {
  148. }
  149. public new void OpenVRRentalMaid()
  150. {
  151. }
  152. private void SetMainMenuButtonEnable(VRMainMenu.ButtonType buttonType, bool flag)
  153. {
  154. }
  155. private void SetMainMenuButtonActive(VRMainMenu.ButtonType buttonType, bool flag)
  156. {
  157. }
  158. public new void SetSkipButtonEvent(UnityAction callback)
  159. {
  160. }
  161. public new void ButtonEvent_Skip()
  162. {
  163. }
  164. public override void OpenVRDecideUseTouch(UnityAction<bool> callback_is_oculus_touch)
  165. {
  166. GameObject gameObject = Resources.Load<GameObject>("SceneVRCommunication/Tablet/Karaoke/Prefab/Canvas (Dialog)");
  167. if (gameObject)
  168. {
  169. GameObject gameObject2 = UnityEngine.Object.Instantiate<GameObject>(gameObject);
  170. Transform transform = gameObject2.transform;
  171. transform.SetParent(base.transform, false);
  172. transform.localPosition = Vector3.zero;
  173. transform.localEulerAngles = Vector3.zero;
  174. transform.localScale = Vector3.one * 0.001f;
  175. Canvas component = gameObject2.GetComponent<Canvas>();
  176. if (component)
  177. {
  178. component.worldCamera = EventSystem.current.gameObject.GetComponentInChildren<Camera>();
  179. this.AddCanvas(component);
  180. }
  181. }
  182. GameObject gameObject3 = Resources.Load<GameObject>("SceneVRCommunication/Tablet/Karaoke/Prefab/Canvas (DecideUseTouch)");
  183. if (gameObject3)
  184. {
  185. GameObject Obj = UnityEngine.Object.Instantiate<GameObject>(gameObject3);
  186. Transform transform2 = Obj.transform;
  187. transform2.SetParent(base.transform, false);
  188. transform2.localPosition = Vector3.zero;
  189. transform2.localEulerAngles = Vector3.zero;
  190. transform2.localScale = Vector3.one * 0.001f;
  191. Canvas canvas = Obj.GetComponent<Canvas>();
  192. if (canvas)
  193. {
  194. canvas.worldCamera = EventSystem.current.gameObject.GetComponentInChildren<Camera>();
  195. this.AddCanvas(canvas);
  196. }
  197. UICanvasFade component2 = Obj.GetComponent<UICanvasFade>();
  198. VRDecideUseTouch component3 = Obj.GetComponent<VRDecideUseTouch>();
  199. callback_is_oculus_touch = (UnityAction<bool>)Delegate.Combine(callback_is_oculus_touch, new UnityAction<bool>(delegate(bool value)
  200. {
  201. this.RemoveCanvas(canvas);
  202. VRDialogMenu vrdialogMenu = VRDialogMenu.CreateDialog();
  203. vrdialogMenu.CloseDialog();
  204. UnityEngine.Object.Destroy(vrdialogMenu.gameObject);
  205. UnityEngine.Object.Destroy(Obj);
  206. }));
  207. component3.StartDecideController(callback_is_oculus_touch);
  208. }
  209. }
  210. public override void OpenVRTutorialMenu(UnityAction callback)
  211. {
  212. GameObject gameObject = Resources.Load<GameObject>("SceneVRCommunication/Tablet/Karaoke/Prefab/Canvas (Tutorial)");
  213. if (gameObject)
  214. {
  215. GameObject gameObject2 = UnityEngine.Object.Instantiate<GameObject>(gameObject);
  216. Transform transform = gameObject2.transform;
  217. transform.SetParent(base.transform, false);
  218. transform.localPosition = Vector3.zero;
  219. transform.localEulerAngles = Vector3.zero;
  220. transform.localScale = Vector3.one * 0.001f;
  221. Canvas canvasTutorial = gameObject2.GetComponent<Canvas>();
  222. if (canvasTutorial)
  223. {
  224. canvasTutorial.worldCamera = EventSystem.current.gameObject.GetComponentInChildren<Camera>();
  225. this.AddCanvas(canvasTutorial);
  226. }
  227. UICanvasFade component = gameObject2.GetComponent<UICanvasFade>();
  228. VRTutorialMenu tutorial = gameObject2.GetComponent<VRTutorialMenu>();
  229. callback = (UnityAction)Delegate.Combine(callback, new UnityAction(delegate()
  230. {
  231. this.RemoveCanvas(canvasTutorial);
  232. UnityEngine.Object.Destroy(tutorial.gameObject);
  233. }));
  234. component.FadeIn();
  235. tutorial.Init(callback, "karaoke_tutorial.nei");
  236. }
  237. }
  238. public override Canvas GetVRCanvas(VRCanvasManager.VRCanvasType type)
  239. {
  240. return this.m_CanvasDummy;
  241. }
  242. [Space(16f)]
  243. [SerializeField]
  244. protected Canvas m_CanvasDummy;
  245. private List<Canvas> m_StackCanvas = new List<Canvas>();
  246. }