added an option to keep the screen on when the app is open
This commit is contained in:
parent
fff6724b00
commit
e7df449d82
5 changed files with 28 additions and 0 deletions
|
@ -2,6 +2,7 @@ using System.Collections;
|
|||
using System.Collections.Generic;
|
||||
using Android.App;
|
||||
using Android.Gms.Ads;
|
||||
using Android.Views;
|
||||
using Android.Widget;
|
||||
using GameAnalyticsSDK;
|
||||
using GameAnalyticsSDK.Utilities;
|
||||
|
@ -38,5 +39,13 @@ namespace Android {
|
|||
GameAnalytics.NewResourceEvent(sink ? GAResourceFlowType.Sink : GAResourceFlowType.Source, currency, amount, itemType, itemId);
|
||||
}
|
||||
|
||||
public override void SetKeepScreenOn(bool keep) {
|
||||
if (keep) {
|
||||
this.activity.Window.AddFlags(WindowManagerFlags.KeepScreenOn);
|
||||
} else {
|
||||
this.activity.Window.ClearFlags(WindowManagerFlags.KeepScreenOn);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -16,6 +16,7 @@
|
|||
"AGameByEllpeck": "A game by Ellpeck",
|
||||
"WhileYouWereAway": "While you were away, you sold <i ticket> at half the regular speed. You were away for <c Yellow>{0} minutes</c> and sold <c Yellow>{1} <i ticket></c> during that time. Nice!",
|
||||
"WhileYouWereAwayMessage": "Display Offline Summary",
|
||||
"KeepScreenOn": "Keep Screen On",
|
||||
"----- Tutorial -----": "",
|
||||
"Tutorial1": "Hi! Welcome to Touchy Tickets. To start the game, simply tap the ticket booth to sell a <i ticket>. Start by racking up 50<i ticket>!",
|
||||
"Tutorial2": "Great! Now, you can buy your first attraction. Access the menu on the right by swiping and purchase a carousel.",
|
||||
|
|
|
@ -22,6 +22,15 @@ namespace TouchyTickets {
|
|||
private float soundVolume = 1;
|
||||
[DataMember]
|
||||
public bool WhileYouWereAwayMessage = true;
|
||||
[DataMember]
|
||||
public bool KeepScreenOn {
|
||||
get => this.keepScreenOn;
|
||||
set {
|
||||
this.keepScreenOn = value;
|
||||
GameImpl.Instance.Platform.SetKeepScreenOn(value);
|
||||
}
|
||||
}
|
||||
private bool keepScreenOn;
|
||||
|
||||
public static void Save() {
|
||||
var file = GetOptionsFile(true);
|
||||
|
|
|
@ -9,5 +9,7 @@ namespace TouchyTickets {
|
|||
|
||||
public abstract void AddResourceEvent(bool sink, string currency, float amount, string itemType, string itemId);
|
||||
|
||||
public abstract void SetKeepScreenOn(bool keep);
|
||||
|
||||
}
|
||||
}
|
|
@ -391,6 +391,13 @@ namespace TouchyTickets {
|
|||
Options.Save();
|
||||
}
|
||||
});
|
||||
optionList.AddChild(new Checkbox(Anchor.AutoLeft, new Vector2(1, 20), Localization.Get("KeepScreenOn"), Options.Instance.KeepScreenOn) {
|
||||
PositionOffset = new Vector2(0, 1),
|
||||
OnCheckStateChange = (b, value) => {
|
||||
Options.Instance.KeepScreenOn = value;
|
||||
Options.Save();
|
||||
}
|
||||
});
|
||||
this.uiSystem.Add("Options", optionsUi);
|
||||
|
||||
this.swipeRelations = new Element[] {optionsUi, upgradeUi, main, buyUi, modifierUi};
|
||||
|
|
Loading…
Reference in a new issue