1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 15:03:13 +08:00

Merge pull request #14268 from frenzibyte/open-tablet-driver-faq

Notify users to read OpenTabletDriver's FAQ when tablet not detected
This commit is contained in:
Dan Balasescu 2021-08-16 15:15:30 +09:00 committed by GitHub
commit 6dfab4d431
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 57 additions and 14 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
@ -9,9 +10,11 @@ using osu.Framework.Input.Handlers.Tablet;
using osu.Framework.Localisation;
using osu.Framework.Platform;
using osu.Framework.Threading;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osuTK;
using osu.Game.Localisation;
using osu.Game.Online.Chat;
namespace osu.Game.Overlays.Settings.Sections.Input
{
@ -52,7 +55,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
private FillFlowContainer mainSettings;
private OsuSpriteText noTabletMessage;
private FillFlowContainer noTabletMessage;
protected override LocalisableString Header => TabletSettingsStrings.Tablet;
@ -62,7 +65,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
}
[BackgroundDependencyLoader]
private void load()
private void load(OsuColour colours)
{
Children = new Drawable[]
{
@ -73,12 +76,39 @@ namespace osu.Game.Overlays.Settings.Sections.Input
Origin = Anchor.TopCentre,
Current = tabletHandler.Enabled
},
noTabletMessage = new OsuSpriteText
noTabletMessage = new FillFlowContainer
{
Text = TabletSettingsStrings.NoTabletDetected,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Padding = new MarginPadding { Horizontal = SettingsPanel.CONTENT_MARGINS }
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Padding = new MarginPadding { Horizontal = SettingsPanel.CONTENT_MARGINS },
Spacing = new Vector2(5f),
Children = new Drawable[]
{
new OsuSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = TabletSettingsStrings.NoTabletDetected,
},
new SettingsNoticeText(colours)
{
TextAnchor = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
}.With(t =>
{
if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows || RuntimeInfo.OS == RuntimeInfo.Platform.Linux)
{
t.NewLine();
t.AddText("If your tablet is not detected, please read ");
t.AddLink("this FAQ", LinkAction.External, RuntimeInfo.OS == RuntimeInfo.Platform.Windows
? @"https://github.com/OpenTabletDriver/OpenTabletDriver/wiki/Windows-FAQ"
: @"https://github.com/OpenTabletDriver/OpenTabletDriver/wiki/Linux-FAQ");
t.AddText(" for troubleshooting steps.");
}
}),
}
},
mainSettings = new FillFlowContainer
{

View File

@ -73,13 +73,7 @@ namespace osu.Game.Overlays.Settings
return;
// construct lazily for cases where the label is not needed (may be provided by the Control).
FlowContent.Add(warningText = new OsuTextFlowContainer
{
Colour = colours.Yellow,
Margin = new MarginPadding { Bottom = 5 },
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
});
FlowContent.Add(warningText = new SettingsNoticeText(colours) { Margin = new MarginPadding { Bottom = 5 } });
}
warningText.Alpha = hasValue ? 0 : 1;

View File

@ -0,0 +1,19 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
namespace osu.Game.Overlays.Settings
{
public class SettingsNoticeText : LinkFlowContainer
{
public SettingsNoticeText(OsuColour colours)
: base(s => s.Colour = colours.Yellow)
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
}
}
}