2025-04-02 10:15:12 +08:00

43 lines
846 B
C#

using CG.Framework;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using ZXK.LouDiXvMuNiu;
public class UIRoot : MonoSingleton<UIRoot>
{
public GameObject pcCanvas;
public GameObject vrRoot;
Transform vrCamera;
protected override void AwakeSelf()
{
base.AwakeSelf();
#if VR
vrRoot.gameObject.SetActive(true);
vrCamera = vrRoot.transform.Find("ZFrame");
#else
pcCanvas.gameObject.SetActive(true);
#endif
}
public GameObject GetEventSystem()
{
#if VR
return vrRoot.transform.Find("ZEventSystem").gameObject;
#else
return pcCanvas.transform.Find("EventSystem").gameObject;
#endif
}
public void SetCamera(Vector3 pos, Vector3 rot)
{
vrCamera.position = pos;
vrCamera.localEulerAngles = rot;
}
}