修改VR适配bug

This commit is contained in:
shenjianxing 2025-04-02 10:15:12 +08:00
parent 642c291a75
commit d1776762c7
3 changed files with 13 additions and 13 deletions

View File

@ -93,11 +93,11 @@ namespace ZXK.LouDiXvMuNiu
_curTimeLineCtrl = GetComponent<TimelineDirectorCtrl>();
#if VR
var zStylus = UIRoot.instance.vrRoot.transform.Find("ZStylus").GetComponent<ZStylus>();
var zStylus = UIRoot.Instance.vrRoot.transform.Find("ZStylus").GetComponent<ZStylus>();
zStylus.OnObjectEntered.AddListener(VROnEnter);
zStylus.OnObjectExited.AddListener(VROnExit);
zStylus.OnClick.AddListener(VROnClick);
var zMouse = UIRoot.instance.vrRoot.transform.Find("ZMouse").GetComponent<ZMouse>();
var zMouse = UIRoot.Instance.vrRoot.transform.Find("ZMouse").GetComponent<ZMouse>();
zMouse.OnObjectEntered.AddListener(VROnEnter);
zMouse.OnObjectExited.AddListener(VROnExit);
zMouse.OnClick.AddListener(VROnClick);
@ -1245,7 +1245,7 @@ namespace ZXK.LouDiXvMuNiu
public void ChangeCameraPos(Vector3 pos, Vector3 rot)
{
#if VR
UIRoot.instance.SetCamera(pos, rot);
UIRoot.Instance.SetCamera(pos, rot);
#else
///设置人偶物体旋转,位置
kinematic.SetPositionAndRotation(pos, Quaternion.Euler(0, rot.y, 0));///设置相机旋转,位置

View File

@ -43,7 +43,7 @@ namespace CG.UTility
_loadedCall?.Invoke();
_isLoadScene = false;
StopCoroutine("LoadScene");
UIRoot.instance.GetEventSystem().SetActive(true);
UIRoot.Instance.GetEventSystem().SetActive(true);
Framework.UI_Manage.Instance.ClosePanel("LoadingSceenPanel");
}
_async.allowSceneActivation = true;
@ -62,7 +62,7 @@ namespace CG.UTility
_isLoadScene = true;
StartCoroutine("LoadScene", sceneName);
Framework.UI_Manage.Instance.ShowPanel("LoadingSceenPanel", System.Type.GetType("CG.Framework.LoadingSceenPanel"), Framework.UIGroup.Tip);
UIRoot.instance.GetEventSystem().SetActive(false);
UIRoot.Instance.GetEventSystem().SetActive(false);
}
private IEnumerator LoadScene(string sceneName)

View File

@ -1,25 +1,25 @@
using CG.Framework;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using ZXK.LouDiXvMuNiu;
public class UIRoot : MonoBehaviour
public class UIRoot : MonoSingleton<UIRoot>
{
public GameObject pcCanvas;
public GameObject vrRoot;
public static UIRoot instance;
Transform vrCamera;
private void Awake()
protected override void AwakeSelf()
{
instance = this;
DontDestroyOnLoad(this);
base.AwakeSelf();
#if VR
DontDestroyOnLoad(vrRoot);
vrRoot.gameObject.SetActive(true);
vrCamera = vrRoot.transform.Find("ZFrame");
#else
pcCanvas.gameObject.SetActive(true);
#endif
}
public GameObject GetEventSystem()