public void Resume() { if (!m_IsInit || IsPlaying) { return; } #if !UNITY_EDITOR NativeMultiDisplay.Resume(); #endif IsPlaying = true; }
public void Pause() { if (!m_IsInit || !IsPlaying) { return; } #if !UNITY_EDITOR NativeMultiDisplay.Pause(); #endif IsPlaying = false; }
public void Destory() { #if UNITY_ANDROID && !UNITY_EDITOR if (NativeMultiDisplay != null) { NativeMultiDisplay.Stop(); NativeMultiDisplay.Destroy(); NativeMultiDisplay = null; } #endif m_ControllerScreen?.Release(); m_ControllerScreen = null; }
private void Init() { if (m_IsInit) { return; } NRDebugger.Log("[MultiScreenController] Init."); NRDevice.Instance.Init(); m_ScreenResolution = NRPhoneScreen.Resolution; transform.position = m_StartPos; m_UICamera.aspect = m_ScreenResolution.x / m_ScreenResolution.y; m_UICamera.orthographicSize = 6; m_ControllerScreen = new RenderTexture((int)m_ScreenResolution.x, (int)m_ScreenResolution.y, 24); m_UICamera.targetTexture = m_ControllerScreen; NRSessionManager.Instance.VirtualDisplayer = this; #if UNITY_ANDROID && !UNITY_EDITOR m_RenderTexturePtr = m_ControllerScreen.GetNativeTexturePtr(); NativeMultiDisplay = new NativeMultiDisplay(); NativeMultiDisplay.Create(); // Creat multiview controller.. GL.IssuePluginEvent(RenderThreadHandlePtr, 0); #elif UNITY_EDITOR InitEmulator(); #endif if (m_VirtualController) { m_VirtualController.Init(); } NRDebugger.Log("[MultiScreenController] Init successed."); m_IsInit = true; if (OnMultiDisplayInited != null) { OnMultiDisplayInited(); } StartCoroutine(VirtualDisplayRender()); m_IsPlay = true; }
private void Init() { if (m_IsInit) { return; } try { NRDevice.Instance.Init(); } catch (Exception e) { NRDebugger.LogError("[NRVirtualDisplayer] NRDevice init error:" + e.ToString()); throw; } transform.position = m_StartPos; this.SetVirtualDisplayResolution(); NRSessionManager.Instance.VirtualDisplayer = this; NRDebugger.Log("[NRVirtualDisplayer] Init"); #if !UNITY_EDITOR //m_RenderTexturePtr = m_ControllerScreen.GetNativeTexturePtr(); NativeMultiDisplay = new NativeMultiDisplay(); NativeMultiDisplay.Create(); //NativeMultiDisplay.InitColorSpace(); NativeMultiDisplay.ListenMainScrResolutionChanged(OnDisplayResolutionChanged); NativeMultiDisplay.Start(); // Creat multiview controller.. //GL.IssuePluginEvent(RenderThreadHandlePtr, 0); //LoadPhoneScreen(); #elif UNITY_EDITOR InitEmulator(); #endif m_VirtualController?.Init(); m_IsInit = true; OnMultiDisplayInited?.Invoke(); IsPlaying = true; }
private void Init() { if (m_IsInit) { return; } try { NRDevice.Instance.Init(); } catch (Exception) { throw; } m_ScreenResolution = NRPhoneScreen.Resolution; transform.position = m_StartPos; m_UICamera.aspect = m_ScreenResolution.x / m_ScreenResolution.y; m_UICamera.orthographicSize = 6; m_ControllerScreen = new RenderTexture((int)m_ScreenResolution.x, (int)m_ScreenResolution.y, 24); m_UICamera.targetTexture = m_ControllerScreen; NRSessionManager.Instance.VirtualDisplayer = this; #if UNITY_ANDROID && !UNITY_EDITOR m_RenderTexturePtr = m_ControllerScreen.GetNativeTexturePtr(); NativeMultiDisplay = new NativeMultiDisplay(); NativeMultiDisplay.Create(); NativeMultiDisplay.InitColorSpace(); NativeMultiDisplay.Start(); // Creat multiview controller.. GL.IssuePluginEvent(RenderThreadHandlePtr, 0); #elif UNITY_EDITOR InitEmulator(); #endif m_VirtualController?.Init(); m_IsInit = true; OnMultiDisplayInited?.Invoke(); m_IsPlay = true; }