mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Fetch OsuGameActivity through DI instead.
This commit is contained in:
@ -13,6 +13,9 @@ namespace osu.Android
|
|||||||
{
|
{
|
||||||
private Bindable<bool> localUserPlaying;
|
private Bindable<bool> localUserPlaying;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuGameActivity gameActivity { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuGame game)
|
private void load(OsuGame game)
|
||||||
{
|
{
|
||||||
@ -22,9 +25,9 @@ namespace osu.Android
|
|||||||
|
|
||||||
private void updateLock(ValueChangedEvent<bool> userPlaying)
|
private void updateLock(ValueChangedEvent<bool> userPlaying)
|
||||||
{
|
{
|
||||||
OsuGameActivity.Activity.RunOnUiThread(() =>
|
gameActivity.RunOnUiThread(() =>
|
||||||
{
|
{
|
||||||
OsuGameActivity.Activity.RequestedOrientation = userPlaying.NewValue ? ScreenOrientation.Locked : ScreenOrientation.FullUser;
|
gameActivity.RequestedOrientation = userPlaying.NewValue ? ScreenOrientation.Locked : ScreenOrientation.FullUser;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,14 +12,10 @@ namespace osu.Android
|
|||||||
[Activity(Theme = "@android:style/Theme.NoTitleBar", MainLauncher = true, ScreenOrientation = ScreenOrientation.FullUser, SupportsPictureInPicture = false, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, HardwareAccelerated = false)]
|
[Activity(Theme = "@android:style/Theme.NoTitleBar", MainLauncher = true, ScreenOrientation = ScreenOrientation.FullUser, SupportsPictureInPicture = false, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize, HardwareAccelerated = false)]
|
||||||
public class OsuGameActivity : AndroidGameActivity
|
public class OsuGameActivity : AndroidGameActivity
|
||||||
{
|
{
|
||||||
internal static Activity Activity { get; private set; }
|
protected override Framework.Game CreateGame() => new OsuGameAndroid(this);
|
||||||
|
|
||||||
protected override Framework.Game CreateGame() => new OsuGameAndroid();
|
|
||||||
|
|
||||||
protected override void OnCreate(Bundle savedInstanceState)
|
protected override void OnCreate(Bundle savedInstanceState)
|
||||||
{
|
{
|
||||||
Activity = this;
|
|
||||||
|
|
||||||
// The default current directory on android is '/'.
|
// The default current directory on android is '/'.
|
||||||
// On some devices '/' maps to the app data directory. On others it maps to the root of the internal storage.
|
// On some devices '/' maps to the app data directory. On others it maps to the root of the internal storage.
|
||||||
// In order to have a consistent current directory on all devices the full path of the app data directory is set as the current directory.
|
// In order to have a consistent current directory on all devices the full path of the app data directory is set as the current directory.
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using Android.App;
|
using Android.App;
|
||||||
using Android.OS;
|
using Android.OS;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Game;
|
using osu.Game;
|
||||||
using osu.Game.Updater;
|
using osu.Game.Updater;
|
||||||
|
|
||||||
@ -11,6 +12,15 @@ namespace osu.Android
|
|||||||
{
|
{
|
||||||
public class OsuGameAndroid : OsuGame
|
public class OsuGameAndroid : OsuGame
|
||||||
{
|
{
|
||||||
|
[Cached]
|
||||||
|
private readonly OsuGameActivity gameActivity;
|
||||||
|
|
||||||
|
public OsuGameAndroid(OsuGameActivity activity)
|
||||||
|
: base(null)
|
||||||
|
{
|
||||||
|
gameActivity = activity;
|
||||||
|
}
|
||||||
|
|
||||||
public override Version AssemblyVersion
|
public override Version AssemblyVersion
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
Reference in New Issue
Block a user