added a toggle for displaying under the notch
This commit is contained in:
parent
def208809c
commit
c9e0ff8ec2
6 changed files with 33 additions and 11 deletions
|
@ -46,10 +46,6 @@ public class Activity1 : AndroidGameActivity {
|
||||||
this.game.GraphicsDeviceManager.ApplyChanges();
|
this.game.GraphicsDeviceManager.ApplyChanges();
|
||||||
};
|
};
|
||||||
|
|
||||||
// don't render under notches
|
|
||||||
if (Build.VERSION.SdkInt >= BuildVersionCodes.P)
|
|
||||||
this.Window.Attributes.LayoutInDisplayCutoutMode = LayoutInDisplayCutoutMode.Never;
|
|
||||||
|
|
||||||
this.view = this.game.Services.GetService(typeof(View)) as View;
|
this.view = this.game.Services.GetService(typeof(View)) as View;
|
||||||
this.SetContentView(this.view);
|
this.SetContentView(this.view);
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
using Android.App;
|
using Android.App;
|
||||||
using Android.Content;
|
using Android.Content;
|
||||||
|
using Android.OS;
|
||||||
using Android.Views;
|
using Android.Views;
|
||||||
using TouchyTickets;
|
using TouchyTickets;
|
||||||
using Uri = Android.Net.Uri;
|
using Uri = Android.Net.Uri;
|
||||||
|
|
||||||
namespace Android;
|
namespace Android;
|
||||||
|
|
||||||
public class AndroidPlatform : Platform {
|
public class AndroidPlatform : Platform {
|
||||||
|
|
||||||
|
@ -22,6 +23,12 @@ public class AndroidPlatform : Platform {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void SetRenderUnderNotch(bool value) {
|
||||||
|
// don't render under notches by default
|
||||||
|
if (Build.VERSION.SdkInt >= BuildVersionCodes.P)
|
||||||
|
this.activity.Window.Attributes.LayoutInDisplayCutoutMode = value ? LayoutInDisplayCutoutMode.ShortEdges : LayoutInDisplayCutoutMode.Never;
|
||||||
|
}
|
||||||
|
|
||||||
public override void OpenRateLink() {
|
public override void OpenRateLink() {
|
||||||
this.activity.StartActivity(new Intent(Intent.ActionView, Uri.Parse("https://play.google.com/store/apps/details?id=de.ellpeck.touchytickets")));
|
this.activity.StartActivity(new Intent(Intent.ActionView, Uri.Parse("https://play.google.com/store/apps/details?id=de.ellpeck.touchytickets")));
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ using MLEM.Startup;
|
||||||
using TouchyTickets.Upgrades;
|
using TouchyTickets.Upgrades;
|
||||||
using Vector2 = Microsoft.Xna.Framework.Vector2;
|
using Vector2 = Microsoft.Xna.Framework.Vector2;
|
||||||
|
|
||||||
namespace TouchyTickets;
|
namespace TouchyTickets;
|
||||||
|
|
||||||
public class GameImpl : MlemGame {
|
public class GameImpl : MlemGame {
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ public class GameImpl : MlemGame {
|
||||||
|
|
||||||
public GameImpl(Platform platform) {
|
public GameImpl(Platform platform) {
|
||||||
this.Platform = platform;
|
this.Platform = platform;
|
||||||
|
this.Platform.SetRenderUnderNotch(false);
|
||||||
GameImpl.Instance = this;
|
GameImpl.Instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +107,7 @@ public class GameImpl : MlemGame {
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
return 3;
|
return 3;
|
||||||
#else
|
#else
|
||||||
return (int) BigInteger.Min(3, this.Tickets / this.GetStarPrice());
|
return (int) BigInteger.Min(3, this.Tickets / this.GetStarPrice());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,14 @@ public class Options {
|
||||||
[DataMember]
|
[DataMember]
|
||||||
public bool WhileYouWereAwayMessage = true;
|
public bool WhileYouWereAwayMessage = true;
|
||||||
[DataMember]
|
[DataMember]
|
||||||
|
public bool RenderUnderNotch {
|
||||||
|
get => this.renderUnderNotch;
|
||||||
|
set {
|
||||||
|
this.renderUnderNotch = value;
|
||||||
|
GameImpl.Instance.Platform.SetRenderUnderNotch(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[DataMember]
|
||||||
public bool KeepScreenOn {
|
public bool KeepScreenOn {
|
||||||
get => this.keepScreenOn;
|
get => this.keepScreenOn;
|
||||||
set {
|
set {
|
||||||
|
@ -31,12 +39,14 @@ public class Options {
|
||||||
GameImpl.Instance.Platform.SetKeepScreenOn(value);
|
GameImpl.Instance.Platform.SetKeepScreenOn(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private bool keepScreenOn;
|
|
||||||
[DataMember]
|
[DataMember]
|
||||||
public bool AutoBuyEnabled = true;
|
public bool AutoBuyEnabled = true;
|
||||||
[DataMember]
|
[DataMember]
|
||||||
public int MinTicketsForAutoBuy = 50000;
|
public int MinTicketsForAutoBuy = 50000;
|
||||||
|
|
||||||
|
private bool renderUnderNotch;
|
||||||
|
private bool keepScreenOn;
|
||||||
|
|
||||||
public static void Save() {
|
public static void Save() {
|
||||||
var file = Options.GetOptionsFile(true);
|
var file = Options.GetOptionsFile(true);
|
||||||
using var stream = new JsonTextWriter(file.CreateText());
|
using var stream = new JsonTextWriter(file.CreateText());
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
namespace TouchyTickets;
|
namespace TouchyTickets;
|
||||||
|
|
||||||
public abstract class Platform {
|
public abstract class Platform {
|
||||||
|
|
||||||
public abstract void SetKeepScreenOn(bool keep);
|
public abstract void SetKeepScreenOn(bool keep);
|
||||||
|
|
||||||
|
public abstract void SetRenderUnderNotch(bool value);
|
||||||
|
|
||||||
public abstract void OpenRateLink();
|
public abstract void OpenRateLink();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -415,6 +415,13 @@ public class Ui {
|
||||||
Options.Save();
|
Options.Save();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
optionList.AddChild(new Checkbox(Anchor.AutoLeft, new Vector2(1, 24), Localization.Get("RenderUnderNotch"), Options.Instance.RenderUnderNotch) {
|
||||||
|
PositionOffset = new Vector2(0, 2),
|
||||||
|
OnCheckStateChange = (_, value) => {
|
||||||
|
Options.Instance.RenderUnderNotch = value;
|
||||||
|
Options.Save();
|
||||||
|
}
|
||||||
|
});
|
||||||
optionList.AddChild(new Checkbox(Anchor.AutoLeft, new Vector2(1, 24), Localization.Get("KeepScreenOn"), Options.Instance.KeepScreenOn) {
|
optionList.AddChild(new Checkbox(Anchor.AutoLeft, new Vector2(1, 24), Localization.Get("KeepScreenOn"), Options.Instance.KeepScreenOn) {
|
||||||
PositionOffset = new Vector2(0, 2),
|
PositionOffset = new Vector2(0, 2),
|
||||||
OnCheckStateChange = (_, value) => {
|
OnCheckStateChange = (_, value) => {
|
||||||
|
|
Loading…
Reference in a new issue