43 lines
846 B
C#
Raw Normal View History

2025-04-02 10:15:12 +08:00
using CG.Framework;
2025-04-01 16:16:45 +08:00
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
2025-04-02 10:15:12 +08:00
using ZXK.LouDiXvMuNiu;
2025-04-01 16:16:45 +08:00
2025-04-02 10:15:12 +08:00
public class UIRoot : MonoSingleton<UIRoot>
2025-04-01 16:16:45 +08:00
{
public GameObject pcCanvas;
2025-04-02 10:15:12 +08:00
public GameObject vrRoot;
2025-04-01 16:16:45 +08:00
Transform vrCamera;
2025-04-02 10:15:12 +08:00
protected override void AwakeSelf()
2025-04-01 16:16:45 +08:00
{
2025-04-02 10:15:12 +08:00
base.AwakeSelf();
2025-04-01 16:16:45 +08:00
#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;
}
}