mirror of
https://github.com/ppy/osu.git
synced 2025-02-20 18:43:04 +08:00
Merge pull request #31403 from frenzibyte/mobile-disclaimer
This commit is contained in:
commit
b4698851a3
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Configuration.Tracking;
|
||||
@ -163,6 +164,7 @@ namespace osu.Game.Configuration
|
||||
SetDefault(OsuSetting.Version, string.Empty);
|
||||
|
||||
SetDefault(OsuSetting.ShowFirstRunSetup, true);
|
||||
SetDefault(OsuSetting.ShowMobileDisclaimer, RuntimeInfo.IsMobile);
|
||||
|
||||
SetDefault(OsuSetting.ScreenshotFormat, ScreenshotFormat.Jpg);
|
||||
SetDefault(OsuSetting.ScreenshotCaptureMenuCursor, false);
|
||||
@ -452,5 +454,6 @@ namespace osu.Game.Configuration
|
||||
AlwaysRequireHoldingForPause,
|
||||
MultiplayerShowInProgressFilter,
|
||||
BeatmapListingFeaturedArtistFilter,
|
||||
ShowMobileDisclaimer,
|
||||
}
|
||||
}
|
||||
|
@ -59,6 +59,25 @@ namespace osu.Game.Localisation
|
||||
/// </summary>
|
||||
public static LocalisableString DailyChallenge => new TranslatableString(getKey(@"daily_challenge"), @"daily challenge");
|
||||
|
||||
/// <summary>
|
||||
/// "A few important words from your dev team!"
|
||||
/// </summary>
|
||||
public static LocalisableString MobileDisclaimerHeader => new TranslatableString(getKey(@"mobile_disclaimer_header"), @"A few important words from your dev team!");
|
||||
|
||||
/// <summary>
|
||||
/// "While we have released osu! on mobile platforms to maximise the number of people that can enjoy the game, our focus is still on the PC version.
|
||||
///
|
||||
/// Your experience will not be perfect, and may even feel subpar compared to games which are made mobile-first.
|
||||
///
|
||||
/// Please bear with us as we continue to improve the game for you!"
|
||||
/// </summary>
|
||||
public static LocalisableString MobileDisclaimerBody => new TranslatableString(getKey(@"mobile_disclaimer_body"),
|
||||
@"While we have released osu! on mobile platforms to maximise the number of people that can enjoy the game, our focus is still on the PC version.
|
||||
|
||||
Your experience will not be perfect, and may even feel subpar compared to games which are made mobile-first.
|
||||
|
||||
Please bear with us as we continue to improve the game for you!");
|
||||
|
||||
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||
}
|
||||
}
|
||||
|
@ -75,7 +75,9 @@ namespace osu.Game.Overlays.Dialog
|
||||
return;
|
||||
|
||||
bodyText = value;
|
||||
|
||||
body.Text = value;
|
||||
body.TextAnchor = bodyText.ToString().Contains('\n') ? Anchor.TopLeft : Anchor.TopCentre;
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,13 +212,12 @@ namespace osu.Game.Overlays.Dialog
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
TextAnchor = Anchor.TopCentre,
|
||||
Padding = new MarginPadding { Horizontal = 15 },
|
||||
Padding = new MarginPadding { Horizontal = 15, Bottom = 10 },
|
||||
},
|
||||
body = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 18))
|
||||
{
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
TextAnchor = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Padding = new MarginPadding { Horizontal = 15 },
|
||||
@ -301,6 +302,7 @@ namespace osu.Game.Overlays.Dialog
|
||||
{
|
||||
content.ScaleTo(0.7f);
|
||||
ring.ResizeTo(ringMinifiedSize);
|
||||
icon.ScaleTo(0f);
|
||||
}
|
||||
|
||||
content
|
||||
@ -308,6 +310,7 @@ namespace osu.Game.Overlays.Dialog
|
||||
.FadeIn(ENTER_DURATION, Easing.OutQuint);
|
||||
|
||||
ring.ResizeTo(ringSize, ENTER_DURATION * 1.5f, Easing.OutQuint);
|
||||
icon.Delay(100).ScaleTo(1, ENTER_DURATION * 1.5f, Easing.OutQuint);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
|
@ -13,11 +13,13 @@ using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
@ -39,6 +41,7 @@ using osu.Game.Screens.Select;
|
||||
using osu.Game.Seasonal;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osu.Game.Localisation;
|
||||
|
||||
namespace osu.Game.Screens.Menu
|
||||
{
|
||||
@ -87,6 +90,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
private Bindable<double> holdDelay;
|
||||
private Bindable<bool> loginDisplayed;
|
||||
private Bindable<bool> showMobileDisclaimer;
|
||||
|
||||
private HoldToExitGameOverlay holdToExitGameOverlay;
|
||||
|
||||
@ -111,6 +115,7 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
holdDelay = config.GetBindable<double>(OsuSetting.UIHoldActivationDelay);
|
||||
loginDisplayed = statics.GetBindable<bool>(Static.LoginOverlayDisplayed);
|
||||
showMobileDisclaimer = config.GetBindable<bool>(OsuSetting.ShowMobileDisclaimer);
|
||||
|
||||
if (host.CanExit)
|
||||
{
|
||||
@ -255,6 +260,9 @@ namespace osu.Game.Screens.Menu
|
||||
[CanBeNull]
|
||||
private Drawable proxiedLogo;
|
||||
|
||||
[CanBeNull]
|
||||
private ScheduledDelegate mobileDisclaimerSchedule;
|
||||
|
||||
protected override void LogoArriving(OsuLogo logo, bool resuming)
|
||||
{
|
||||
base.LogoArriving(logo, resuming);
|
||||
@ -275,27 +283,42 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
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.
|
||||
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.
|
||||
// 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)
|
||||
{
|
||||
Scheduler.AddDelayed(() => login?.Show(), 500);
|
||||
loginDisplayed.Value = true;
|
||||
}
|
||||
|
||||
return originalAction.Invoke();
|
||||
}
|
||||
|
||||
if (showMobileDisclaimer.Value)
|
||||
{
|
||||
mobileDisclaimerSchedule?.Cancel();
|
||||
mobileDisclaimerSchedule = Scheduler.AddDelayed(() =>
|
||||
{
|
||||
dialogOverlay.Push(new MobileDisclaimerDialog(() =>
|
||||
{
|
||||
showMobileDisclaimer.Value = false;
|
||||
}));
|
||||
}, 500);
|
||||
}
|
||||
|
||||
return originalAction.Invoke();
|
||||
}
|
||||
|
||||
protected override void LogoSuspending(OsuLogo logo)
|
||||
@ -443,5 +466,25 @@ namespace osu.Game.Screens.Menu
|
||||
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
|
||||
{
|
||||
}
|
||||
|
||||
private partial class MobileDisclaimerDialog : PopupDialog
|
||||
{
|
||||
public MobileDisclaimerDialog(Action confirmed)
|
||||
{
|
||||
HeaderText = ButtonSystemStrings.MobileDisclaimerHeader;
|
||||
BodyText = ButtonSystemStrings.MobileDisclaimerBody;
|
||||
|
||||
Icon = FontAwesome.Solid.SmileBeam;
|
||||
|
||||
Buttons = new PopupDialogButton[]
|
||||
{
|
||||
new PopupDialogOkButton
|
||||
{
|
||||
Text = "Understood",
|
||||
Action = confirmed,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user