using System; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; using UnityEngine.EventSystems; public class VRCanvasManagerMini : VRCanvasManager { public void AddCanvas(Canvas canvas) { if (this.m_StackCanvas.Contains(canvas)) { Debug.Log(string.Format("[CanvasmanagerMini]既に「{0}」は追加されている", canvas.gameObject.name)); return; } this.m_StackCanvas.Add(canvas); } public void RemoveCanvas(Canvas canvas) { if (!canvas) { Debug.Log("[CanvasmanagerMini]リストから削除するキャンバスでnullが指定された"); return; } if (!this.m_StackCanvas.Contains(canvas)) { Debug.Log(string.Format("[CanvasmanagerMini]キャンバス「{0}」は管理していない", canvas.gameObject.name)); return; } this.m_StackCanvas.Remove(canvas); } private void Awake() { VRCanvasManager.m_Instance = this; } private void Start() { } private void Update() { CanvasGroup component = base.GetComponent(); if (!GameMain.Instance.OvrMgr.OvrCamera.IsUIShow) { component.interactable = false; component.blocksRaycasts = false; component.alpha = 0f; return; } component.interactable = true; component.blocksRaycasts = true; component.alpha = 1f; bool isRotDown = GameMain.Instance.OvrMgr.OvrCamera.OvrTablet.IsRotDown; bool isSideBack = GameMain.Instance.OvrMgr.OvrCamera.OvrTablet.IsSideBack; Vector3 zero = Vector3.zero; zero.z = ((!isRotDown) ? 0f : 180f); zero.y = ((!isSideBack) ? 0f : 180f); zero.x = ((!isSideBack) ? 90f : -90f); base.transform.localEulerAngles = zero; } private void LateUpdate() { } public new void OpenVRCanvas() { } public override void OpenVRCanvas(VRCanvasManager.VRCanvasType type) { if (type == VRCanvasManager.VRCanvasType.Dialog) { for (int i = 0; i < this.m_StackCanvas.Count; i++) { Canvas canvas = this.m_StackCanvas[i]; if (canvas) { if (canvas.gameObject.activeInHierarchy) { UICanvasFade component = canvas.GetComponent(); if (component) { component.FadeOut(); } else { canvas.gameObject.SetActive(false); } } } } VRDialogMenu vrdialogMenu = VRDialogMenu.CreateDialog(); if (vrdialogMenu) { UICanvasFade component2 = vrdialogMenu.GetComponent(); component2.FadeIn(); } } if (type == VRCanvasManager.VRCanvasType.Selector) { for (int j = 0; j < this.m_StackCanvas.Count; j++) { Canvas canvas2 = this.m_StackCanvas[j]; if (canvas2) { if (canvas2.gameObject.activeInHierarchy) { UICanvasFade component3 = canvas2.GetComponent(); if (component3) { component3.FadeOut(); } else { canvas2.gameObject.SetActive(false); } } } } VRSelectorMenu vrselectorMenu = VRSelectorMenu.CreateSelector(); if (vrselectorMenu) { UICanvasFade component4 = vrselectorMenu.GetComponent(); component4.FadeIn(); } } } public new void CloseVRCanvas() { } public override void ChangeCanvas(GameObject MainCanvas) { } public new void OpenBeforeVRCanvas() { } public new bool IsExistsBeforeVRCanvas() { return false; } public new void ClearCanvasStack() { } public new void UpdateCanvas() { } public new void OpenVRConfig(UnityAction callback) { } public new void OpenVRCulture(UnityAction callback_select, UnityAction callback_cancel) { } public new void OpenVRRentalMaid() { } private void SetMainMenuButtonEnable(VRMainMenu.ButtonType buttonType, bool flag) { } private void SetMainMenuButtonActive(VRMainMenu.ButtonType buttonType, bool flag) { } public new void SetSkipButtonEvent(UnityAction callback) { } public new void ButtonEvent_Skip() { } public override void OpenVRDecideUseTouch(UnityAction callback_is_oculus_touch) { GameObject gameObject = Resources.Load("SceneVRCommunication/Tablet/Karaoke/Prefab/Canvas (Dialog)"); if (gameObject) { GameObject gameObject2 = UnityEngine.Object.Instantiate(gameObject); Transform transform = gameObject2.transform; transform.SetParent(base.transform, false); transform.localPosition = Vector3.zero; transform.localEulerAngles = Vector3.zero; transform.localScale = Vector3.one * 0.001f; Canvas component = gameObject2.GetComponent(); if (component) { component.worldCamera = EventSystem.current.gameObject.GetComponentInChildren(); this.AddCanvas(component); } } GameObject gameObject3 = Resources.Load("SceneVRCommunication/Tablet/Karaoke/Prefab/Canvas (DecideUseTouch)"); if (gameObject3) { GameObject Obj = UnityEngine.Object.Instantiate(gameObject3); Transform transform2 = Obj.transform; transform2.SetParent(base.transform, false); transform2.localPosition = Vector3.zero; transform2.localEulerAngles = Vector3.zero; transform2.localScale = Vector3.one * 0.001f; Canvas canvas = Obj.GetComponent(); if (canvas) { canvas.worldCamera = EventSystem.current.gameObject.GetComponentInChildren(); this.AddCanvas(canvas); } UICanvasFade component2 = Obj.GetComponent(); VRDecideUseTouch component3 = Obj.GetComponent(); callback_is_oculus_touch = (UnityAction)Delegate.Combine(callback_is_oculus_touch, new UnityAction(delegate(bool value) { this.RemoveCanvas(canvas); VRDialogMenu vrdialogMenu = VRDialogMenu.CreateDialog(); vrdialogMenu.CloseDialog(); UnityEngine.Object.Destroy(vrdialogMenu.gameObject); UnityEngine.Object.Destroy(Obj); })); component3.StartDecideController(callback_is_oculus_touch); } } public override void OpenVRTutorialMenu(UnityAction callback) { GameObject gameObject = Resources.Load("SceneVRCommunication/Tablet/Karaoke/Prefab/Canvas (Tutorial)"); if (gameObject) { GameObject gameObject2 = UnityEngine.Object.Instantiate(gameObject); Transform transform = gameObject2.transform; transform.SetParent(base.transform, false); transform.localPosition = Vector3.zero; transform.localEulerAngles = Vector3.zero; transform.localScale = Vector3.one * 0.001f; Canvas canvasTutorial = gameObject2.GetComponent(); if (canvasTutorial) { canvasTutorial.worldCamera = EventSystem.current.gameObject.GetComponentInChildren(); this.AddCanvas(canvasTutorial); } UICanvasFade component = gameObject2.GetComponent(); VRTutorialMenu tutorial = gameObject2.GetComponent(); callback = (UnityAction)Delegate.Combine(callback, new UnityAction(delegate { this.RemoveCanvas(canvasTutorial); UnityEngine.Object.Destroy(tutorial.gameObject); })); component.FadeIn(); tutorial.Init(callback, "karaoke_tutorial.nei"); } } public override Canvas GetVRCanvas(VRCanvasManager.VRCanvasType type) { return this.m_CanvasDummy; } [Space(16f)] [SerializeField] protected Canvas m_CanvasDummy; private List m_StackCanvas = new List(); }