private void DeviceOrientationMonitor_DeviceOrientationChanged(DeviceOrientationMonitor sender, DeviceOrientationChangedEventArgs args) { if (IsMonitoring) { ScreenOrientations previousOrientation = args.PreviousScreenOrientation; ScreenOrientations currentOrientation = args.CurrentScreenOrientation; if (previousOrientation != currentOrientation && ScreenOrientationChanged != null) { ScreenOrientationChanged.Invoke(sender, new ScreenOrientationChangedEventArgs(previousOrientation, currentOrientation)); } } }
public static void Reset() { width = (float)UnityEngine.Screen.width; height = (float)UnityEngine.Screen.height; depth = UnityEngine.Camera.mainCamera.farClipPlane; min = (width < height) ? width : height; dpi = (UnityEngine.Screen.dpi > 0) ? UnityEngine.Screen.dpi : 1f; widthPhysical = width / dpi; heightPhysical = height / dpi; minPhysical = (widthPhysical < heightPhysical) ? widthPhysical : heightPhysical; orientation = GetOrientation(); SetReferencePoints(); Logger.Debug(TAG, "Reset..."); }
private static void SetOrientation(ScreenOrientations newOrientation) { if (newOrientation != orientation) { switch (newOrientation) { case ScreenOrientations.PORTRAIT: UnityEngine.Screen.orientation = UnityEngine.ScreenOrientation.Portrait; break; case ScreenOrientations.LANDSCAPE: default: UnityEngine.Screen.orientation = UnityEngine.ScreenOrientation.LandscapeLeft; break; } } }
public ScreenOrientationChangedEventArgs( ScreenOrientations previousOrientation, ScreenOrientations currentOrientation ) { PreviousOrientation = previousOrientation; CurrentOrientation = currentOrientation; }
public ScreenOrientationChangedEventArgs(ScreenOrientations previousOrientation, ScreenOrientations currentOrientation) { PreviousOrientation = previousOrientation; CurrentOrientation = currentOrientation; }