mirror of
https://github.com/ppy/osu.git
synced 2025-01-31 05:32:57 +08:00
Display popup disclaimer about game state and performance on mobile platforms
This commit is contained in:
parent
2d4a3aa4f9
commit
039800550c
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using osu.Framework;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Configuration.Tracking;
|
using osu.Framework.Configuration.Tracking;
|
||||||
@ -163,6 +164,7 @@ namespace osu.Game.Configuration
|
|||||||
SetDefault(OsuSetting.Version, string.Empty);
|
SetDefault(OsuSetting.Version, string.Empty);
|
||||||
|
|
||||||
SetDefault(OsuSetting.ShowFirstRunSetup, true);
|
SetDefault(OsuSetting.ShowFirstRunSetup, true);
|
||||||
|
SetDefault(OsuSetting.ShowMobileDisclaimer, RuntimeInfo.IsMobile);
|
||||||
|
|
||||||
SetDefault(OsuSetting.ScreenshotFormat, ScreenshotFormat.Jpg);
|
SetDefault(OsuSetting.ScreenshotFormat, ScreenshotFormat.Jpg);
|
||||||
SetDefault(OsuSetting.ScreenshotCaptureMenuCursor, false);
|
SetDefault(OsuSetting.ScreenshotCaptureMenuCursor, false);
|
||||||
@ -452,5 +454,6 @@ namespace osu.Game.Configuration
|
|||||||
AlwaysRequireHoldingForPause,
|
AlwaysRequireHoldingForPause,
|
||||||
MultiplayerShowInProgressFilter,
|
MultiplayerShowInProgressFilter,
|
||||||
BeatmapListingFeaturedArtistFilter,
|
BeatmapListingFeaturedArtistFilter,
|
||||||
|
ShowMobileDisclaimer,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ using osu.Framework.Audio.Sample;
|
|||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
@ -87,6 +88,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
private Bindable<double> holdDelay;
|
private Bindable<double> holdDelay;
|
||||||
private Bindable<bool> loginDisplayed;
|
private Bindable<bool> loginDisplayed;
|
||||||
|
private Bindable<bool> showMobileDisclaimer;
|
||||||
|
|
||||||
private HoldToExitGameOverlay holdToExitGameOverlay;
|
private HoldToExitGameOverlay holdToExitGameOverlay;
|
||||||
|
|
||||||
@ -111,6 +113,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
holdDelay = config.GetBindable<double>(OsuSetting.UIHoldActivationDelay);
|
holdDelay = config.GetBindable<double>(OsuSetting.UIHoldActivationDelay);
|
||||||
loginDisplayed = statics.GetBindable<bool>(Static.LoginOverlayDisplayed);
|
loginDisplayed = statics.GetBindable<bool>(Static.LoginOverlayDisplayed);
|
||||||
|
showMobileDisclaimer = config.GetBindable<bool>(OsuSetting.ShowMobileDisclaimer);
|
||||||
|
|
||||||
if (host.CanExit)
|
if (host.CanExit)
|
||||||
{
|
{
|
||||||
@ -275,26 +278,54 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
sideFlashes.Delay(FADE_IN_DURATION).FadeIn(64, Easing.InQuint);
|
sideFlashes.Delay(FADE_IN_DURATION).FadeIn(64, Easing.InQuint);
|
||||||
}
|
}
|
||||||
else if (!api.IsLoggedIn || api.State.Value == APIState.RequiresSecondFactorAuth)
|
else
|
||||||
{
|
{
|
||||||
// copy out old action to avoid accidentally capturing logo.Action in closure, causing a self-reference loop.
|
// copy out old action to avoid accidentally capturing logo.Action in closure, causing a self-reference loop.
|
||||||
var previousAction = logo.Action;
|
var previousAction = logo.Action;
|
||||||
|
|
||||||
// we want to hook into logo.Action to display the login overlay, but also preserve the return value of the old action.
|
// we want to hook into logo.Action to display certain overlays, but also preserve the return value of the old action.
|
||||||
// therefore pass the old action to displayLogin, so that it can return that value.
|
// therefore pass the old action to displayLogin, so that it can return that value.
|
||||||
// this ensures that the OsuLogo sample does not play when it is not desired.
|
// this ensures that the OsuLogo sample does not play when it is not desired.
|
||||||
logo.Action = () => displayLogin(previousAction);
|
logo.Action = () => onLogoClick(previousAction);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool displayLogin(Func<bool> originalAction)
|
private bool onLogoClick(Func<bool> originalAction)
|
||||||
|
{
|
||||||
|
if (!api.IsLoggedIn || api.State.Value == APIState.RequiresSecondFactorAuth)
|
||||||
{
|
{
|
||||||
if (!loginDisplayed.Value)
|
if (!loginDisplayed.Value)
|
||||||
{
|
{
|
||||||
Scheduler.AddDelayed(() => login?.Show(), 500);
|
this.Delay(500).Schedule(() => login?.Show());
|
||||||
loginDisplayed.Value = true;
|
loginDisplayed.Value = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return originalAction.Invoke();
|
if (showMobileDisclaimer.Value)
|
||||||
|
{
|
||||||
|
this.Delay(500).Schedule(() => dialogOverlay.Push(new MobileDisclaimerDialog()));
|
||||||
|
showMobileDisclaimer.Value = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return originalAction.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
internal partial class MobileDisclaimerDialog : PopupDialog
|
||||||
|
{
|
||||||
|
public MobileDisclaimerDialog()
|
||||||
|
{
|
||||||
|
HeaderText = "Mobile disclaimer";
|
||||||
|
BodyText = "We're releasing this for your enjoyment, but PC is still our focus and mobile is hard to support.\n\nPlease bear with us as we continue to improve the experience!";
|
||||||
|
|
||||||
|
Icon = FontAwesome.Solid.Mobile;
|
||||||
|
|
||||||
|
Buttons = new PopupDialogButton[]
|
||||||
|
{
|
||||||
|
new PopupDialogOkButton
|
||||||
|
{
|
||||||
|
Text = "Alright!",
|
||||||
|
},
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user