1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.Android;
- using Rokid.MRC;
- namespace Rokid.MRC
- {
- public enum ARCalibrationMode
- {
- FaceTrack,
- SelfCalibration,
- }
- public class MRCDriver : UnitySingleton<MRCDriver>
- {
- public bool UseGlobalRenderCamera;
- [HideInInspector]
- public bool ShowAnchorUI = false;
- [HideInInspector]
- public bool ShowCompositeUI = true;
- public bool ShowClientAnchor = true;
- [HideInInspector]
- public Transform SelfCalibrationPhone;
- public override void Awake()
- {
- base.Awake();
- Init();
- }
- void Init()
- {
- LocalizationMgr.Instance.SetLanguage(Application.systemLanguage);
- SDKManager.Instance.Init();
- UIManager.Instance.Init();
- if(!UIManager.Instance.HideUISystem)
- {
- UIManager.Instance.OpenPanel(UIType.Connection);
- }
- //用于编辑器下,直接打开MRCRoot场景,导致无摄像机的情况
- if(Camera.main == null)
- {
- GameObject obj = new GameObject("MainCamera");
- obj.tag = "MainCamera";
- Camera camera = obj.AddComponent<Camera>();
- }
- }
- private void Update()
- {
- //获取位置权限
- if(!Permission.HasUserAuthorizedPermission(Permission.FineLocation))
- {
- Permission.RequestUserPermission(Permission.FineLocation);
- }
- if(!Permission.HasUserAuthorizedPermission(Permission.Microphone))
- {
- Permission.RequestUserPermission(Permission.Microphone);
- }
- }
- //当跳出设置Wifi后,重新刷新本机IP地址
- public void OnApplicationPause(bool pause)
- {
- if(!pause)
- {
- MessageCenter.SendMessage(GlobalDefine.RefreshConnectPanel, null);
- }
- else
- {
- TransmissionClient.Release();
- }
- }
- }
- }
|