// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osu.Game.Screens; using osu.Game.Screens.Play; namespace osu.Game.Utils { public static class MobileUtils { /// /// Determines the correct state which a mobile device should be put into for the given information. /// /// Information about whether the user is currently playing. /// The current screen which the user is at. /// Whether the user is playing on a mobile tablet device instead of a phone. public static Orientation GetOrientation(ILocalUserPlayInfo userPlayInfo, IOsuScreen currentScreen, bool isTablet) { bool lockCurrentOrientation = userPlayInfo.PlayingState.Value == LocalUserPlayingState.Playing; bool lockToPortraitOnPhone = currentScreen.RequiresPortraitOrientation; if (lockToPortraitOnPhone && !isTablet) return Orientation.Portrait; if (lockCurrentOrientation) return Orientation.Locked; return Orientation.Default; } public enum Orientation { /// /// Lock the game orientation. /// Locked, /// /// Lock the game to portrait orientation (does not include upside-down portrait). /// Portrait, /// /// Use the application's default settings. /// Default, } } }