Ejemplo n.º 1
0
 /// <summary>
 /// Updates the currentOrientation to the specified value and sends an UnityEvent to signal the change.
 /// </summary>
 public void ChangeOrientation(Orientation newOrientation)
 {
     currentOrientation = newOrientation;
     onOrientationChange.Invoke(currentOrientation);
     if (debug)
     {
         D.Log("[OrientationManager] currentOrientation: " + currentOrientation.ToString());
     }
 }
        /// <summary>
        /// Updates the currentOrientation to the specified value and sends an UnityEvent to signal the change.
        /// </summary>
        public void ChangeOrientation(Orientation newOrientation, bool forceUpdate = false)
        {
            currentOrientation = newOrientation;
            onOrientationChange.Invoke(currentOrientation);

            deviceOrientationCheckCount++;
            if (deviceOrientationCheckCount > 2 || forceUpdate)
            {
                NotifyUIManager(newOrientation);
            }

            if (debug)
            {
                Debug.Log("[OrientationManager] currentOrientation: " + currentOrientation.ToString());
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Notifies the orientation change.
        /// </summary>
        /// <param name="orientation">Orientation.</param>
        public void NotifyOrientationChange(Orientation orientation)
        {
            Orientation = orientation;

            OrientationChange?.Invoke(this, orientation);
        }
Ejemplo n.º 4
0
 public override void OnConfigurationChanged(Android.Content.Res.Configuration newConfig)
 {
     OnOrientationChange?.Invoke(newConfig.Orientation == Android.Content.Res.Orientation.Portrait ?
                                 "Portrait" : "Landscape");
     base.OnConfigurationChanged(newConfig);
 }