1
0
mirror of https://github.com/ppy/osu.git synced 2026-06-10 05:33:40 +08:00

Compare commits

...

7 Commits

10 changed files with 66 additions and 29 deletions
@@ -27,10 +27,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
protected override Color4 ColourAt(float position)
{
// https://github.com/peppy/osu-stable-reference/blob/3ea48705eb67172c430371dcfc8a16a002ed0d3d/osu!/Graphics/Renderers/MmSliderRendererGL.cs#L99
// float aaWidth = Math.Min(Math.Max(0.5f / PathRadius, 3.0f / 256.0f), 1.0f / 16.0f);
// applying the aa_width constant from stable makes sliders blurry, especially on CS>5. set to zero for now.
// this might be related to SmoothPath applying AA internally, but disabling that does not seem to have much of an effect.
const float aa_width = 0f;
float aaWidth = Math.Min(Math.Max(0.5f / PathRadius, 3.0f / 256.0f), 1.0f / 16.0f);
Color4 shadow = new Color4(0, 0, 0, 0.25f);
Color4 outerColour = AccentColour.Darken(0.1f);
@@ -40,19 +37,19 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
const float shadow_portion = 1 - (OsuLegacySkinTransformer.LEGACY_CIRCLE_RADIUS / OsuHitObject.OBJECT_RADIUS);
const float border_portion = 0.1875f;
if (position <= shadow_portion - aa_width)
return LegacyUtils.InterpolateNonLinear(position, Color4.Black.Opacity(0f), shadow, 0, shadow_portion - aa_width);
if (position <= shadow_portion - aaWidth)
return LegacyUtils.InterpolateNonLinear(position, Color4.Black.Opacity(0f), shadow, 0, shadow_portion - aaWidth);
if (position <= shadow_portion + aa_width)
return LegacyUtils.InterpolateNonLinear(position, shadow, BorderColour, shadow_portion - aa_width, shadow_portion + aa_width);
if (position <= shadow_portion + aaWidth)
return LegacyUtils.InterpolateNonLinear(position, shadow, BorderColour, shadow_portion - aaWidth, shadow_portion + aaWidth);
if (position <= border_portion - aa_width)
if (position <= border_portion - aaWidth)
return BorderColour;
if (position <= border_portion + aa_width)
return LegacyUtils.InterpolateNonLinear(position, BorderColour, outerColour, border_portion - aa_width, border_portion + aa_width);
if (position <= border_portion + aaWidth)
return LegacyUtils.InterpolateNonLinear(position, BorderColour, outerColour, border_portion - aaWidth, border_portion + aaWidth);
return LegacyUtils.InterpolateNonLinear(position, outerColour, innerColour, border_portion + aa_width, 1);
return LegacyUtils.InterpolateNonLinear(position, outerColour, innerColour, border_portion + aaWidth, 1);
}
/// <summary>
@@ -67,6 +67,13 @@ namespace osu.Game.Tests.Visual.UserInterface
TabbableContentContainer = this,
},
new FormTextBox
{
Caption = "Length limited text",
PlaceholderText = "I can only hold 10 characters!",
LengthLimit = 10,
TabbableContentContainer = this,
},
new FormTextBox
{
Caption = "Artist",
HintText = "Poot artist here!",
+1 -1
View File
@@ -99,7 +99,7 @@ namespace osu.Game.Beatmaps
userAudioOffset.BindValueChanged(offset => userGlobalOffsetClock.Offset = offset.NewValue, true);
experimentalAudio = audioManager.UseExperimentalWasapi.GetBoundCopy();
experimentalAudio.BindValueChanged(_ => updatePlatformOffset());
experimentalAudio.BindValueChanged(_ => updatePlatformOffset(), true);
// TODO: this doesn't update when using ChangeSource() to change beatmap.
beatmapOffsetSubscription = realm.SubscribeToPropertyChanged(
@@ -69,13 +69,15 @@ namespace osu.Game.Graphics.UserInterfaceV2
if (TooltipText != default)
{
// Use a space to pad the icon drawable, so that it does not have
// an awkward left margin if it gets pushed to a new line.
textFlow.AddText(" ", t => t.Width = 5);
textFlow.AddArbitraryDrawable(new SpriteIcon
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Size = new Vector2(10),
Icon = FontAwesome.Solid.QuestionCircle,
Margin = new MarginPadding { Left = 5 },
Y = 1f,
});
}
@@ -77,6 +77,11 @@ namespace osu.Game.Graphics.UserInterfaceV2
/// </summary>
public LocalisableString PlaceholderText { get; init; }
/// <summary>
/// Maximum allowed length of text.
/// </summary>
public int? LengthLimit { get; init; }
private FormControlBackground background = null!;
private Box flashLayer = null!;
private InnerTextBox textBox = null!;
@@ -120,6 +125,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
t.RelativeSizeAxes = Axes.X;
t.Width = 1;
t.PlaceholderText = PlaceholderText;
t.LengthLimit = LengthLimit;
t.Current = Current;
t.CommitOnFocusLost = true;
t.OnCommit += (textBox, newText) =>
+6 -11
View File
@@ -23,18 +23,19 @@ namespace osu.Game.Overlays.BeatmapSet
private readonly Box successRateBackground;
private readonly Box background;
private readonly MetadataSection<string[]?> userTags;
public readonly Bindable<APIBeatmapSet> BeatmapSet = new Bindable<APIBeatmapSet>();
public readonly Bindable<APIBeatmap> Beatmap = new Bindable<APIBeatmap>();
public Info()
{
SuccessRate successRate;
MetadataSectionNominators nominators;
MetadataSection source, mapperTags;
MetadataSectionSource source;
MetadataSectionGenre genre;
MetadataSectionLanguage language;
MetadataSectionUserTags userTags;
MetadataSectionMapperTags mapperTags;
SuccessRate successRate;
RelativeSizeAxes = Axes.X;
Height = base_height;
@@ -115,23 +116,17 @@ namespace osu.Game.Overlays.BeatmapSet
{
nominators.Metadata = (b.NewValue?.CurrentNominations ?? Array.Empty<BeatmapSetOnlineNomination>(), b.NewValue?.RelatedUsers ?? Array.Empty<APIUser>());
source.Metadata = b.NewValue?.Source ?? string.Empty;
mapperTags.Metadata = b.NewValue?.Tags ?? string.Empty;
updateUserTags();
genre.Metadata = b.NewValue?.Genre ?? new BeatmapSetOnlineGenre { Id = (int)SearchGenre.Unspecified };
language.Metadata = b.NewValue?.Language ?? new BeatmapSetOnlineLanguage { Id = (int)SearchLanguage.Unspecified };
mapperTags.Metadata = b.NewValue?.Tags ?? string.Empty;
});
Beatmap.BindValueChanged(b =>
{
userTags.Metadata = b.NewValue?.GetTopUserTags().Select(t => t.Tag.Name).ToArray() ?? Array.Empty<string>();
successRate.Beatmap = b.NewValue;
updateUserTags();
});
}
private void updateUserTags()
{
userTags.Metadata = Beatmap.Value?.GetTopUserTags().Select(t => t.Tag.Name).ToArray();
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
@@ -2,17 +2,32 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using osu.Framework.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Online.Chat;
namespace osu.Game.Overlays.BeatmapSet
{
public partial class MetadataSectionUserTags : MetadataSection<string[]?>
public partial class MetadataSectionUserTags : MetadataSection<string[]>
{
private readonly Action<string>? searchAction;
public override string[] Metadata
{
set
{
if (value.Length == 0)
{
this.FadeOut(TRANSITION_DURATION);
return;
}
base.Metadata = value;
}
}
public MetadataSectionUserTags(Action<string>? searchAction = null)
: base(MetadataType.UserTags, null)
: base(MetadataType.UserTags)
{
this.searchAction = searchAction;
}
@@ -4,6 +4,7 @@
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps;
@@ -40,7 +41,13 @@ namespace osu.Game.Screens.Select
AccentColour = colour.Purple1;
Hotkey = GlobalAction.ToggleBeatmapOptions;
Action = this.ShowPopover;
Action = () =>
{
if (this.FindClosestParent<PopoverContainer>()?.CurrentTarget == this)
this.HidePopover();
else
this.ShowPopover();
};
}
protected override void LoadComplete()
@@ -26,6 +26,7 @@ namespace osu.Game.Screens.Select
{
public Bindable<BeatmapInfo?> Beatmap { get; } = new Bindable<BeatmapInfo?>();
public Bindable<StarDifficulty> StarDifficulty { get; } = new Bindable<StarDifficulty>();
public BindableBool Selected { get; } = new BindableBool();
protected override Colour4 DimColour => Colour4.White;
@@ -140,6 +141,8 @@ namespace osu.Game.Screens.Select
StarDifficulty.BindValueChanged(_ => updateBeatmap());
showConvertedBeatmaps.BindValueChanged(_ => updateBeatmap());
scopedBeatmapSet.BindValueChanged(_ => updateBeatmap(), true);
Selected.BindValueChanged(_ => updateEnabled());
scopedBeatmapSet.BindDisabledChanged(_ => updateEnabled(), true);
Enabled.BindValueChanged(_ => updateAppearance(), true);
FinishTransforms(true);
}
@@ -254,6 +257,11 @@ namespace osu.Game.Screens.Select
base.OnHoverLost(e);
}
private void updateEnabled()
{
Enabled.Value = Selected.Value && !scopedBeatmapSet.Disabled;
}
private void updateAppearance()
{
bool isInteractable = Enabled.Value && IsHovered;
@@ -194,6 +194,7 @@ namespace osu.Game.Screens.Select
{
Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft,
Selected = { BindTarget = Selected },
}
},
}
@@ -214,7 +215,6 @@ namespace osu.Game.Screens.Select
Selected.BindValueChanged(s =>
{
Expanded.Value = s.NewValue;
spreadDisplay.Enabled.Value = s.NewValue;
}, true);
}