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; } }
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); }); }
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 }); }); }
public static void QueueOnMainThread(Action action) { MainThreadDispather.QueueOnMainThread(action, 0f); }