Skip to content

Commit

Permalink
Attempt to fix android class
Browse files Browse the repository at this point in the history
  • Loading branch information
peppy committed Oct 1, 2024
1 parent 8f0fedb commit 7977ce8
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions osu.Android/GameplayScreenRotationLocker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,29 @@
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game;
using osu.Game.Screens.Play;

namespace osu.Android
{
public partial class GameplayScreenRotationLocker : Component
{
private Bindable<bool> localUserPlaying = null!;
private IBindable<LocalUserPlayingStates> localUserPlaying = null!;

[Resolved]
private OsuGameActivity gameActivity { get; set; } = null!;

[BackgroundDependencyLoader]
private void load(OsuGame game)
private void load(ILocalUserPlayInfo localUserPlayInfo)
{
localUserPlaying = game.LocalUserPlaying.GetBoundCopy();
localUserPlaying = localUserPlayInfo.PlayingState.GetBoundCopy();
localUserPlaying.BindValueChanged(updateLock, true);
}

private void updateLock(ValueChangedEvent<bool> userPlaying)
private void updateLock(ValueChangedEvent<LocalUserPlayingStates> userPlaying)
{
gameActivity.RunOnUiThread(() =>
{
gameActivity.RequestedOrientation = userPlaying.NewValue ? ScreenOrientation.Locked : gameActivity.DefaultOrientation;
gameActivity.RequestedOrientation = userPlaying.NewValue != LocalUserPlayingStates.NotPlaying ? ScreenOrientation.Locked : gameActivity.DefaultOrientation;
});
}
}
Expand Down

0 comments on commit 7977ce8

Please sign in to comment.