|
@@ -1,7 +1,10 @@
|
|
|
using LitJson;
|
|
|
using ShadowStudio.UI;
|
|
|
+using System;
|
|
|
using System.Collections;
|
|
|
using System.Collections.Generic;
|
|
|
+using System.Reflection;
|
|
|
+using System.Reflection.Emit;
|
|
|
using UnityEngine;
|
|
|
using UnityEngine.UI;
|
|
|
using XRTool.Util;
|
|
@@ -27,7 +30,28 @@ public class RemoteRtc : SCRtcManager
|
|
|
WSHandler.Rtc.onRtcState += onRtcState;
|
|
|
DontDestroyOnLoad(this.gameObject);
|
|
|
Instance = this;
|
|
|
- StartCoroutine(CallCamera());
|
|
|
+ switch (DeviceType.type)
|
|
|
+ {
|
|
|
+ case "A01":
|
|
|
+ StartCoroutine(CallCamera());
|
|
|
+ break;
|
|
|
+ case "Nreal":
|
|
|
+#if !UNITY_EDITOR
|
|
|
+ NRKernal.NRRGBCamTexture RGBCamTexture = new NRKernal.NRRGBCamTexture();
|
|
|
+ meshRender.material.mainTexture = RGBCamTexture.GetTexture();
|
|
|
+ RGBCamTexture.Play();
|
|
|
+#endif
|
|
|
+ meshRender.transform.localEulerAngles = new Vector3(180,0,0);
|
|
|
+
|
|
|
+ break;
|
|
|
+ case "DreamGlass":
|
|
|
+ StartCoroutine(CallCamera());
|
|
|
+ break;
|
|
|
+ case "Rhinox":
|
|
|
+ StartCoroutine(CallCamera(2));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
void onRtcState(string state)
|
|
|
{
|
|
@@ -192,14 +216,14 @@ public class RemoteRtc : SCRtcManager
|
|
|
public WebCamTexture webTex;
|
|
|
private string deviceName;
|
|
|
|
|
|
- IEnumerator CallCamera()
|
|
|
+ IEnumerator CallCamera(int index=0)
|
|
|
{
|
|
|
yield return Application.RequestUserAuthorization(UserAuthorization.WebCam);
|
|
|
if (Application.HasUserAuthorization(UserAuthorization.WebCam))
|
|
|
{
|
|
|
WebCamDevice[] devices = WebCamTexture.devices;
|
|
|
Debug.Log("设备摄像头:"+devices.Length);
|
|
|
- deviceName = devices[0].name;
|
|
|
+ deviceName = devices[index].name;
|
|
|
if (webTex != null)
|
|
|
{
|
|
|
webTex.Stop();
|