1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-18 10:53:21 +08:00

Allow landscape orientation on tablet devices in osu!mania

This commit is contained in:
Salman Alshamrani 2025-01-12 02:34:36 -05:00
parent f121b03a78
commit f718696102
3 changed files with 15 additions and 12 deletions

View File

@ -48,27 +48,28 @@ namespace osu.Game.Mobile
private void updateOrientations()
{
bool lockCurrentOrientation = localUserPlaying.Value == LocalUserPlayingState.Playing;
bool lockToPortrait = requiresPortraitOrientation.Value;
bool lockToPortraitOnPhone = requiresPortraitOrientation.Value;
if (lockCurrentOrientation)
{
if (lockToPortrait && !IsCurrentOrientationPortrait)
if (!IsTablet && lockToPortraitOnPhone && !IsCurrentOrientationPortrait)
SetAllowedOrientations(GameOrientation.Portrait);
else if (!lockToPortrait && IsCurrentOrientationPortrait && !IsTablet)
else if (!IsTablet && !lockToPortraitOnPhone && IsCurrentOrientationPortrait)
SetAllowedOrientations(GameOrientation.Landscape);
else
{
// if the orientation is already portrait/landscape according to the game's specifications,
// then use Locked instead of Portrait/Landscape to handle the case where the device is
// in landscape-left or reverse-portrait.
SetAllowedOrientations(GameOrientation.Locked);
}
return;
}
if (lockToPortrait)
if (!IsTablet && lockToPortraitOnPhone)
{
if (IsTablet)
SetAllowedOrientations(GameOrientation.FullPortrait);
else
SetAllowedOrientations(GameOrientation.Portrait);
SetAllowedOrientations(GameOrientation.Portrait);
return;
}

View File

@ -174,7 +174,8 @@ namespace osu.Game
public readonly IBindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>();
/// <summary>
/// On mobile devices, this specifies whether the device should be set and locked to portrait orientation.
/// On mobile phones, this specifies whether the device should be set and locked to portrait orientation.
/// Tablet devices are unaffected by this property.
/// </summary>
/// <remarks>
/// Implementations can be viewed in mobile projects.

View File

@ -62,10 +62,11 @@ namespace osu.Game.Screens
bool HideMenuCursorOnNonMouseInput { get; }
/// <summary>
/// On mobile devices, this specifies whether this <see cref="OsuScreen"/> requires the device to be in portrait orientation.
/// On mobile phones, this specifies whether this <see cref="OsuScreen"/> requires the device to be in portrait orientation.
/// Tablet devices are unaffected by this property.
/// </summary>
/// <remarks>
/// By default, all screens in the game display in landscape orientation.
/// By default, all screens in the game display in landscape orientation on phones.
/// Setting this to <c>true</c> will display this screen in portrait orientation instead,
/// and switch back to landscape when transitioning back to a regular non-portrait screen.
/// </remarks>