mirror of
https://github.com/ppy/osu.git
synced 2025-01-19 12:22:57 +08:00
Rename Nub.cs to NormalNub.cs
This commit is contained in:
parent
7355397e83
commit
374c3b56f6
@ -45,7 +45,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
LowerBound = customStart,
|
||||
UpperBound = customEnd,
|
||||
TooltipSuffix = "suffix",
|
||||
NubWidth = Nub.HEIGHT * 2,
|
||||
NubWidth = NormalNub.HEIGHT * 2,
|
||||
DefaultStringLowerBound = "Start",
|
||||
DefaultStringUpperBound = "End",
|
||||
MinRange = 10
|
||||
|
@ -19,7 +19,7 @@ using osu.Game.Overlays;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public partial class Nub : Container, IHasCurrentValue<bool>, IHasAccentColour
|
||||
public partial class NormalNub : Container, IHasCurrentValue<bool>, IHasAccentColour
|
||||
{
|
||||
public const float HEIGHT = 15;
|
||||
|
||||
@ -30,7 +30,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
private readonly Box fill;
|
||||
private readonly Container main;
|
||||
|
||||
public Nub()
|
||||
public NormalNub()
|
||||
{
|
||||
Size = new Vector2(EXPANDED_SIZE, HEIGHT);
|
||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
public partial class NormalSliderBar<T> : OsuSliderBar<T>
|
||||
where T : struct, IEquatable<T>, IComparable<T>, IConvertible
|
||||
{
|
||||
protected readonly Nub Nub;
|
||||
protected readonly NormalNub NormalNub;
|
||||
protected readonly Box LeftBox;
|
||||
protected readonly Box RightBox;
|
||||
private readonly Container nubContainer;
|
||||
@ -50,8 +50,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
public NormalSliderBar()
|
||||
{
|
||||
Height = Nub.HEIGHT;
|
||||
RangePadding = Nub.EXPANDED_SIZE / 2;
|
||||
Height = NormalNub.HEIGHT;
|
||||
RangePadding = NormalNub.EXPANDED_SIZE / 2;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
@ -93,7 +93,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
nubContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = Nub = new Nub
|
||||
Child = NormalNub = new NormalNub
|
||||
{
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativePositionAxes = Axes.X,
|
||||
@ -142,7 +142,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
|
||||
protected override bool ShouldHandleAsRelativeDrag(MouseDownEvent e)
|
||||
=> Nub.ReceivePositionalInputAt(e.ScreenSpaceMouseDownPosition);
|
||||
=> NormalNub.ReceivePositionalInputAt(e.ScreenSpaceMouseDownPosition);
|
||||
|
||||
protected override void OnDragEnd(DragEndEvent e)
|
||||
{
|
||||
@ -152,19 +152,19 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
private void updateGlow()
|
||||
{
|
||||
Nub.Glowing = !Current.Disabled && (IsHovered || IsDragged);
|
||||
NormalNub.Glowing = !Current.Disabled && (IsHovered || IsDragged);
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
LeftBox.Scale = new Vector2(Math.Clamp(RangePadding + Nub.DrawPosition.X - Nub.DrawWidth / 2, 0, Math.Max(0, DrawWidth)), 1);
|
||||
RightBox.Scale = new Vector2(Math.Clamp(DrawWidth - Nub.DrawPosition.X - RangePadding - Nub.DrawWidth / 2, 0, Math.Max(0, DrawWidth)), 1);
|
||||
LeftBox.Scale = new Vector2(Math.Clamp(RangePadding + NormalNub.DrawPosition.X - NormalNub.DrawWidth / 2, 0, Math.Max(0, DrawWidth)), 1);
|
||||
RightBox.Scale = new Vector2(Math.Clamp(DrawWidth - NormalNub.DrawPosition.X - RangePadding - NormalNub.DrawWidth / 2, 0, Math.Max(0, DrawWidth)), 1);
|
||||
}
|
||||
|
||||
protected override void UpdateValue(float value)
|
||||
{
|
||||
Nub.MoveToX(value, 250, Easing.OutQuint);
|
||||
NormalNub.MoveToX(value, 250, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
}
|
||||
|
||||
protected readonly Nub Nub;
|
||||
protected readonly NormalNub NormalNub;
|
||||
|
||||
protected readonly OsuTextFlowContainer LabelTextFlowContainer;
|
||||
private Sample sampleChecked;
|
||||
@ -61,28 +61,28 @@ namespace osu.Game.Graphics.UserInterface
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
},
|
||||
Nub = new Nub(),
|
||||
NormalNub = new NormalNub(),
|
||||
new HoverSounds()
|
||||
};
|
||||
|
||||
if (nubOnRight)
|
||||
{
|
||||
Nub.Anchor = Anchor.CentreRight;
|
||||
Nub.Origin = Anchor.CentreRight;
|
||||
Nub.Margin = new MarginPadding { Right = nub_padding };
|
||||
LabelTextFlowContainer.Padding = new MarginPadding { Right = Nub.EXPANDED_SIZE + nub_padding * 2 };
|
||||
NormalNub.Anchor = Anchor.CentreRight;
|
||||
NormalNub.Origin = Anchor.CentreRight;
|
||||
NormalNub.Margin = new MarginPadding { Right = nub_padding };
|
||||
LabelTextFlowContainer.Padding = new MarginPadding { Right = NormalNub.EXPANDED_SIZE + nub_padding * 2 };
|
||||
}
|
||||
else
|
||||
{
|
||||
Nub.Anchor = Anchor.CentreLeft;
|
||||
Nub.Origin = Anchor.CentreLeft;
|
||||
Nub.Margin = new MarginPadding { Left = nub_padding };
|
||||
LabelTextFlowContainer.Padding = new MarginPadding { Left = Nub.EXPANDED_SIZE + nub_padding * 2 };
|
||||
NormalNub.Anchor = Anchor.CentreLeft;
|
||||
NormalNub.Origin = Anchor.CentreLeft;
|
||||
NormalNub.Margin = new MarginPadding { Left = nub_padding };
|
||||
LabelTextFlowContainer.Padding = new MarginPadding { Left = NormalNub.EXPANDED_SIZE + nub_padding * 2 };
|
||||
}
|
||||
|
||||
Nub.Current.BindTo(Current);
|
||||
NormalNub.Current.BindTo(Current);
|
||||
|
||||
Current.DisabledChanged += disabled => LabelTextFlowContainer.Alpha = Nub.Alpha = disabled ? 0.3f : 1;
|
||||
Current.DisabledChanged += disabled => LabelTextFlowContainer.Alpha = NormalNub.Alpha = disabled ? 0.3f : 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -101,13 +101,13 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
Nub.Glowing = true;
|
||||
NormalNub.Glowing = true;
|
||||
return base.OnHover(e);
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(HoverLostEvent e)
|
||||
{
|
||||
Nub.Glowing = false;
|
||||
NormalNub.Glowing = false;
|
||||
base.OnHoverLost(e);
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) =>
|
||||
base.ReceivePositionalInputAt(screenSpacePos)
|
||||
&& screenSpacePos.X <= Nub.ScreenSpaceDrawQuad.TopRight.X;
|
||||
&& screenSpacePos.X <= NormalNub.ScreenSpaceDrawQuad.TopRight.X;
|
||||
}
|
||||
|
||||
private partial class UpperBoundSlider : BoundSlider
|
||||
@ -155,7 +155,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) =>
|
||||
base.ReceivePositionalInputAt(screenSpacePos)
|
||||
&& screenSpacePos.X >= Nub.ScreenSpaceDrawQuad.TopLeft.X;
|
||||
&& screenSpacePos.X >= NormalNub.ScreenSpaceDrawQuad.TopLeft.X;
|
||||
}
|
||||
|
||||
protected partial class BoundSlider : NormalSliderBar<double>
|
||||
@ -163,7 +163,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
public string? DefaultString;
|
||||
public LocalisableString? DefaultTooltip;
|
||||
public string? TooltipSuffix;
|
||||
public float NubWidth { get; set; } = Nub.HEIGHT;
|
||||
public float NubWidth { get; set; } = NormalNub.HEIGHT;
|
||||
|
||||
public override LocalisableString TooltipText =>
|
||||
(Current.IsDefault ? DefaultTooltip : Current.Value.ToString($@"0.## {TooltipSuffix}")) ?? Current.Value.ToString($@"0.## {TooltipSuffix}");
|
||||
@ -177,12 +177,12 @@ namespace osu.Game.Graphics.UserInterface
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
Nub.Width = NubWidth;
|
||||
RangePadding = Nub.Width / 2;
|
||||
NormalNub.Width = NubWidth;
|
||||
RangePadding = NormalNub.Width / 2;
|
||||
|
||||
OsuSpriteText currentDisplay;
|
||||
|
||||
Nub.Add(currentDisplay = new OsuSpriteText
|
||||
NormalNub.Add(currentDisplay = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
@ -203,9 +203,9 @@ namespace osu.Game.Graphics.UserInterface
|
||||
if (colourProvider == null) return;
|
||||
|
||||
AccentColour = colourProvider.Background2;
|
||||
Nub.AccentColour = colourProvider.Background2;
|
||||
Nub.GlowingAccentColour = colourProvider.Background1;
|
||||
Nub.GlowColour = colourProvider.Background2;
|
||||
NormalNub.AccentColour = colourProvider.Background2;
|
||||
NormalNub.GlowingAccentColour = colourProvider.Background1;
|
||||
NormalNub.GlowColour = colourProvider.Background2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,9 +30,9 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
||||
if (overlayColourProvider != null)
|
||||
return;
|
||||
|
||||
Nub.AccentColour = colours.GreySeaFoamLighter;
|
||||
Nub.GlowingAccentColour = Color4.White;
|
||||
Nub.GlowColour = Color4.White;
|
||||
NormalNub.AccentColour = colours.GreySeaFoamLighter;
|
||||
NormalNub.GlowingAccentColour = Color4.White;
|
||||
NormalNub.GlowColour = Color4.White;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -267,9 +267,9 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
private void updateState()
|
||||
{
|
||||
Nub.AccentColour = AccentColour;
|
||||
Nub.GlowingAccentColour = AccentHoverColour;
|
||||
Nub.GlowColour = AccentHoverColour.Opacity(0.2f);
|
||||
NormalNub.AccentColour = AccentColour;
|
||||
NormalNub.GlowingAccentColour = AccentHoverColour;
|
||||
NormalNub.GlowColour = AccentHoverColour.Opacity(0.2f);
|
||||
}
|
||||
|
||||
protected override void OnUserChange(bool value)
|
||||
|
@ -18,9 +18,9 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Nub.AccentColour = colours.Yellow;
|
||||
Nub.GlowingAccentColour = colours.YellowLighter;
|
||||
Nub.GlowColour = colours.YellowDark;
|
||||
NormalNub.AccentColour = colours.Yellow;
|
||||
NormalNub.GlowingAccentColour = colours.YellowLighter;
|
||||
NormalNub.GlowColour = colours.YellowDark;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,9 +30,9 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
AccentColour = colours.Yellow;
|
||||
Nub.AccentColour = colours.Yellow;
|
||||
Nub.GlowingAccentColour = colours.YellowLighter;
|
||||
Nub.GlowColour = colours.YellowDark;
|
||||
NormalNub.AccentColour = colours.Yellow;
|
||||
NormalNub.GlowingAccentColour = colours.YellowLighter;
|
||||
NormalNub.GlowColour = colours.YellowDark;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user