/// <summary> /// 关闭相机 /// </summary> /// <returns>成功失败</returns> public override bool Stop(SCameraStopCallBack callback = null) { m_cameraDeviceBehaviour.Close(); //m_cameraDeviceBehaviour.Device.Stop(); return(true); //bool m_return; //m_cameraDeviceBehaviour.Close(); //m_cameraDeviceBehaviour.Device.Stop(); //m_cameraDeviceBehaviour.Close(); //m_return = m_cameraDeviceBehaviour.Device.Close(); //if (callback != null) // SCameraManager.instance.StartCoroutine(StopCallBack(callback)); //return m_return; }
private IEnumerator ShowStubPlane() { snapshooter.PhotoTexMade += OnPhotoMade; bool isBack = arCam.CameraDeviceType == ArCamDevType.Back; arCam.CameraDeviceType = isBack ? ArCamDevType.Front : ArCamDevType.Back; arCam.Close(); arCam.OpenAndStart(); checkingCamTex = null; Vector2Int size = new Vector2Int(Screen.width / 16, Screen.height / 16); ulong prevHash = 0; uint curDiffrFramesCount = 0; float startTime = Time.time; while ((Time.time - startTime < maxSwitchTime) && (curDiffrFramesCount < diffrentFramesCount)) { snapshooter.Snapshoot(size); while (checkingCamTex == null) { yield return(null); } ulong hash = CalcTexHash(checkingCamTex); if (hash != prevHash) { curDiffrFramesCount++; } else { curDiffrFramesCount = 0; } prevHash = hash; checkingCamTex = null; yield return(new WaitForSeconds(tryingTime)); } snapshooter.PhotoTexMade -= OnPhotoMade; transitionBackground.enabled = false; SetUiActive(true); }