diff --git a/osu.Android/GameView.cs b/osu.Android/GameView.cs index 649ee0134b..dfae65a2e9 100644 --- a/osu.Android/GameView.cs +++ b/osu.Android/GameView.cs @@ -3,7 +3,6 @@ using Android.Content; using Android.Util; -using osu.Framework; using osu.Framework.Android; using osu.Game; @@ -21,6 +20,6 @@ namespace osu.Android { CreateGame(); } - public override Framework.Game CreateGame() => new OsuGame(); + public override Framework.Game CreateGame() => new OsuGameAndroid(); } } diff --git a/osu.Android/MainActivity.cs b/osu.Android/MainActivity.cs index 3a8a5026bc..ff1fd9eba1 100644 --- a/osu.Android/MainActivity.cs +++ b/osu.Android/MainActivity.cs @@ -5,6 +5,7 @@ using Android.App; using Android.OS; using Android.Runtime; using Android.Widget; +using Android.Views; using Android.Content.PM; namespace osu.Android @@ -17,6 +18,7 @@ namespace osu.Android base.OnCreate(savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); + Window.AddFlags(WindowManagerFlags.KeepScreenOn); } public override void OnBackPressed() { diff --git a/osu.Android/OsuGameAndroid.cs b/osu.Android/OsuGameAndroid.cs new file mode 100644 index 0000000000..e2f016887d --- /dev/null +++ b/osu.Android/OsuGameAndroid.cs @@ -0,0 +1,44 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Android; +using osu.Framework.Platform; +using osu.Game; +using System; +using System.IO; + +namespace osu.Android +{ + internal class OsuGameAndroid : OsuGame + { + public OsuGameAndroid() : base() + { + + } + public override Storage GetStorageForStableInstall() + { + return new OpsuStorage(); + } + + // For better migration from opsu! to osu!lazer (WIP) + private class OpsuStorage : AndroidStorage + { + bool checkExists(string p) => Directory.Exists(Path.Combine(p, "Songs")); + + protected override string LocateBasePath() + { + BasePath = base.LocateBasePath(); + string opsuInstallPath = Path.Combine(BasePath, "opsu"); + Console.WriteLine(opsuInstallPath); + if (checkExists(opsuInstallPath)) + return opsuInstallPath; + return null; + } + + public OpsuStorage() : base(string.Empty, null) + { + BasePath = LocateBasePath(); + } + } + } +} diff --git a/osu.Android/osu.Android.csproj b/osu.Android/osu.Android.csproj index 494ff6044b..42e472bc83 100644 --- a/osu.Android/osu.Android.csproj +++ b/osu.Android/osu.Android.csproj @@ -63,6 +63,7 @@ + @@ -120,10 +121,10 @@ 1.1.0 - 1.0.0-beta0006 + 1.0.0-dev000094 - 1.0.0-beta0005 + 1.0.0-dev002278