mirror of
https://github.com/ppy/osu.git
synced 2024-09-22 14:07:25 +08:00
Add shared class for notice text in settings
This commit is contained in:
parent
cd842ccef8
commit
f43ab323ff
@ -11,7 +11,6 @@ using osu.Framework.Localisation;
|
|||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
@ -92,23 +91,21 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
|||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Text = TabletSettingsStrings.NoTabletDetected,
|
Text = TabletSettingsStrings.NoTabletDetected,
|
||||||
},
|
},
|
||||||
new LinkFlowContainer
|
new SettingsNoticeText
|
||||||
{
|
{
|
||||||
TextAnchor = Anchor.TopCentre,
|
TextAnchor = Anchor.TopCentre,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
}.With(t =>
|
}.With(t =>
|
||||||
{
|
{
|
||||||
if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows || RuntimeInfo.OS == RuntimeInfo.Platform.Linux)
|
if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows || RuntimeInfo.OS == RuntimeInfo.Platform.Linux)
|
||||||
{
|
{
|
||||||
t.NewLine();
|
t.NewLine();
|
||||||
t.AddText("If your tablet is not detected, please read ", s => s.Colour = colours.Yellow);
|
t.AddText("If your tablet is not detected, please read ");
|
||||||
t.AddLink("this FAQ", LinkAction.External, RuntimeInfo.OS == RuntimeInfo.Platform.Windows
|
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/Windows-FAQ"
|
||||||
: @"https://github.com/OpenTabletDriver/OpenTabletDriver/wiki/Linux-FAQ");
|
: @"https://github.com/OpenTabletDriver/OpenTabletDriver/wiki/Linux-FAQ");
|
||||||
t.AddText(" for troubleshooting steps.", s => s.Colour = colours.Yellow);
|
t.AddText(" for troubleshooting steps.");
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -73,13 +73,7 @@ namespace osu.Game.Overlays.Settings
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// construct lazily for cases where the label is not needed (may be provided by the Control).
|
// construct lazily for cases where the label is not needed (may be provided by the Control).
|
||||||
FlowContent.Add(warningText = new OsuTextFlowContainer
|
FlowContent.Add(warningText = new SettingsNoticeText { Margin = new MarginPadding { Bottom = 5 } });
|
||||||
{
|
|
||||||
Colour = colours.Yellow,
|
|
||||||
Margin = new MarginPadding { Bottom = 5 },
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
warningText.Alpha = hasValue ? 0 : 1;
|
warningText.Alpha = hasValue ? 0 : 1;
|
||||||
|
21
osu.Game/Overlays/Settings/SettingsNoticeText.cs
Normal file
21
osu.Game/Overlays/Settings/SettingsNoticeText.cs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
// 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.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.Settings
|
||||||
|
{
|
||||||
|
public class SettingsNoticeText : LinkFlowContainer
|
||||||
|
{
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
Colour = colours.Yellow;
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user