예제 #1
0
        private static void OnGlassesDisconnectEvent(UInt64 glasses_control_handle, IntPtr user_data, GlassesDisconnectReason reason)
        {
            Debug.Log("[NRDevice] OnGlassesDisconnectEvent:" + reason.ToString());
            switch (reason)
            {
            case GlassesDisconnectReason.GLASSES_DEVICE_DISCONNECT:
                CallAndroidkillProcess();
                break;

            case GlassesDisconnectReason.NOTIFY_TO_QUIT_APP:
                if (NRFrame.SessionStatus == SessionState.Running)
                {
                    // if current status is running , need release sdk in main thread.
                    MainThreadDispather.QueueOnMainThread(() =>
                    {
                        ForceKill(true);
                    });
                }
                else
                {
                    ForceKill(false);
                }
                break;

            default:
                CallAndroidkillProcess();
                break;
            }
        }
예제 #2
0
 private static void OnGlassesWear(UInt64 glasses_control_handle, int wearing_status, UInt64 user_data)
 {
     Debug.Log("[NRDevice] " + (wearing_status == 1 ? "Glasses put on" : "Glasses put off"));
     MainThreadDispather.QueueOnMainThread(() =>
     {
         OnGlassesStateChanged?.Invoke(wearing_status == 1 ? GlassesEventType.PutOn : GlassesEventType.PutOff);
     });
 }
예제 #3
0
        public static void OnDisplayResolutionChanged(int w, int h)
        {
            Debug.LogFormat("[NRVirtualDisplayer] Display resolution changed width:{0} height:{1}", w, h);
            MainThreadDispather.QueueOnMainThread(delegate()
            {
                NRVirtualDisplayer.Instance.UpdateResolution(new Vector2(w, h));

                OnDisplayScreenChangedEvent?.Invoke(new Resolution()
                {
                    width  = w,
                    height = h
                });
            });
        }
예제 #4
0
 public static void QueueOnMainThread(Action action)
 {
     MainThreadDispather.QueueOnMainThread(action, 0f);
 }