Rename Nub.cs to NormalNub.cs

This commit is contained in:
mk56-spn
2023-01-26 13:21:20 +01:00
parent 7355397e83
commit 374c3b56f6
9 changed files with 47 additions and 47 deletions

View File

@ -45,7 +45,7 @@ namespace osu.Game.Tests.Visual.UserInterface
LowerBound = customStart, LowerBound = customStart,
UpperBound = customEnd, UpperBound = customEnd,
TooltipSuffix = "suffix", TooltipSuffix = "suffix",
NubWidth = Nub.HEIGHT * 2, NubWidth = NormalNub.HEIGHT * 2,
DefaultStringLowerBound = "Start", DefaultStringLowerBound = "Start",
DefaultStringUpperBound = "End", DefaultStringUpperBound = "End",
MinRange = 10 MinRange = 10

View File

@ -19,7 +19,7 @@ using osu.Game.Overlays;
namespace osu.Game.Graphics.UserInterface 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; public const float HEIGHT = 15;
@ -30,7 +30,7 @@ namespace osu.Game.Graphics.UserInterface
private readonly Box fill; private readonly Box fill;
private readonly Container main; private readonly Container main;
public Nub() public NormalNub()
{ {
Size = new Vector2(EXPANDED_SIZE, HEIGHT); Size = new Vector2(EXPANDED_SIZE, HEIGHT);

View File

@ -17,7 +17,7 @@ namespace osu.Game.Graphics.UserInterface
public partial class NormalSliderBar<T> : OsuSliderBar<T> public partial class NormalSliderBar<T> : OsuSliderBar<T>
where T : struct, IEquatable<T>, IComparable<T>, IConvertible where T : struct, IEquatable<T>, IComparable<T>, IConvertible
{ {
protected readonly Nub Nub; protected readonly NormalNub NormalNub;
protected readonly Box LeftBox; protected readonly Box LeftBox;
protected readonly Box RightBox; protected readonly Box RightBox;
private readonly Container nubContainer; private readonly Container nubContainer;
@ -50,8 +50,8 @@ namespace osu.Game.Graphics.UserInterface
public NormalSliderBar() public NormalSliderBar()
{ {
Height = Nub.HEIGHT; Height = NormalNub.HEIGHT;
RangePadding = Nub.EXPANDED_SIZE / 2; RangePadding = NormalNub.EXPANDED_SIZE / 2;
Children = new Drawable[] Children = new Drawable[]
{ {
new Container new Container
@ -93,7 +93,7 @@ namespace osu.Game.Graphics.UserInterface
nubContainer = new Container nubContainer = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Child = Nub = new Nub Child = NormalNub = new NormalNub
{ {
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
RelativePositionAxes = Axes.X, RelativePositionAxes = Axes.X,
@ -142,7 +142,7 @@ namespace osu.Game.Graphics.UserInterface
} }
protected override bool ShouldHandleAsRelativeDrag(MouseDownEvent e) protected override bool ShouldHandleAsRelativeDrag(MouseDownEvent e)
=> Nub.ReceivePositionalInputAt(e.ScreenSpaceMouseDownPosition); => NormalNub.ReceivePositionalInputAt(e.ScreenSpaceMouseDownPosition);
protected override void OnDragEnd(DragEndEvent e) protected override void OnDragEnd(DragEndEvent e)
{ {
@ -152,19 +152,19 @@ namespace osu.Game.Graphics.UserInterface
private void updateGlow() private void updateGlow()
{ {
Nub.Glowing = !Current.Disabled && (IsHovered || IsDragged); NormalNub.Glowing = !Current.Disabled && (IsHovered || IsDragged);
} }
protected override void UpdateAfterChildren() protected override void UpdateAfterChildren()
{ {
base.UpdateAfterChildren(); base.UpdateAfterChildren();
LeftBox.Scale = new Vector2(Math.Clamp(RangePadding + Nub.DrawPosition.X - 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 - Nub.DrawPosition.X - RangePadding - Nub.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) protected override void UpdateValue(float value)
{ {
Nub.MoveToX(value, 250, Easing.OutQuint); NormalNub.MoveToX(value, 250, Easing.OutQuint);
} }
} }
} }

View File

@ -41,7 +41,7 @@ namespace osu.Game.Graphics.UserInterface
} }
} }
protected readonly Nub Nub; protected readonly NormalNub NormalNub;
protected readonly OsuTextFlowContainer LabelTextFlowContainer; protected readonly OsuTextFlowContainer LabelTextFlowContainer;
private Sample sampleChecked; private Sample sampleChecked;
@ -61,28 +61,28 @@ namespace osu.Game.Graphics.UserInterface
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
}, },
Nub = new Nub(), NormalNub = new NormalNub(),
new HoverSounds() new HoverSounds()
}; };
if (nubOnRight) if (nubOnRight)
{ {
Nub.Anchor = Anchor.CentreRight; NormalNub.Anchor = Anchor.CentreRight;
Nub.Origin = Anchor.CentreRight; NormalNub.Origin = Anchor.CentreRight;
Nub.Margin = new MarginPadding { Right = nub_padding }; NormalNub.Margin = new MarginPadding { Right = nub_padding };
LabelTextFlowContainer.Padding = new MarginPadding { Right = Nub.EXPANDED_SIZE + nub_padding * 2 }; LabelTextFlowContainer.Padding = new MarginPadding { Right = NormalNub.EXPANDED_SIZE + nub_padding * 2 };
} }
else else
{ {
Nub.Anchor = Anchor.CentreLeft; NormalNub.Anchor = Anchor.CentreLeft;
Nub.Origin = Anchor.CentreLeft; NormalNub.Origin = Anchor.CentreLeft;
Nub.Margin = new MarginPadding { Left = nub_padding }; NormalNub.Margin = new MarginPadding { Left = nub_padding };
LabelTextFlowContainer.Padding = new MarginPadding { Left = Nub.EXPANDED_SIZE + nub_padding * 2 }; 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> /// <summary>
@ -101,13 +101,13 @@ namespace osu.Game.Graphics.UserInterface
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
{ {
Nub.Glowing = true; NormalNub.Glowing = true;
return base.OnHover(e); return base.OnHover(e);
} }
protected override void OnHoverLost(HoverLostEvent e) protected override void OnHoverLost(HoverLostEvent e)
{ {
Nub.Glowing = false; NormalNub.Glowing = false;
base.OnHoverLost(e); base.OnHoverLost(e);
} }

View File

@ -141,7 +141,7 @@ namespace osu.Game.Graphics.UserInterface
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) =>
base.ReceivePositionalInputAt(screenSpacePos) base.ReceivePositionalInputAt(screenSpacePos)
&& screenSpacePos.X <= Nub.ScreenSpaceDrawQuad.TopRight.X; && screenSpacePos.X <= NormalNub.ScreenSpaceDrawQuad.TopRight.X;
} }
private partial class UpperBoundSlider : BoundSlider private partial class UpperBoundSlider : BoundSlider
@ -155,7 +155,7 @@ namespace osu.Game.Graphics.UserInterface
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) =>
base.ReceivePositionalInputAt(screenSpacePos) base.ReceivePositionalInputAt(screenSpacePos)
&& screenSpacePos.X >= Nub.ScreenSpaceDrawQuad.TopLeft.X; && screenSpacePos.X >= NormalNub.ScreenSpaceDrawQuad.TopLeft.X;
} }
protected partial class BoundSlider : NormalSliderBar<double> protected partial class BoundSlider : NormalSliderBar<double>
@ -163,7 +163,7 @@ namespace osu.Game.Graphics.UserInterface
public string? DefaultString; public string? DefaultString;
public LocalisableString? DefaultTooltip; public LocalisableString? DefaultTooltip;
public string? TooltipSuffix; public string? TooltipSuffix;
public float NubWidth { get; set; } = Nub.HEIGHT; public float NubWidth { get; set; } = NormalNub.HEIGHT;
public override LocalisableString TooltipText => public override LocalisableString TooltipText =>
(Current.IsDefault ? DefaultTooltip : Current.Value.ToString($@"0.## {TooltipSuffix}")) ?? Current.Value.ToString($@"0.## {TooltipSuffix}"); (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() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
Nub.Width = NubWidth; NormalNub.Width = NubWidth;
RangePadding = Nub.Width / 2; RangePadding = NormalNub.Width / 2;
OsuSpriteText currentDisplay; OsuSpriteText currentDisplay;
Nub.Add(currentDisplay = new OsuSpriteText NormalNub.Add(currentDisplay = new OsuSpriteText
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
@ -203,9 +203,9 @@ namespace osu.Game.Graphics.UserInterface
if (colourProvider == null) return; if (colourProvider == null) return;
AccentColour = colourProvider.Background2; AccentColour = colourProvider.Background2;
Nub.AccentColour = colourProvider.Background2; NormalNub.AccentColour = colourProvider.Background2;
Nub.GlowingAccentColour = colourProvider.Background1; NormalNub.GlowingAccentColour = colourProvider.Background1;
Nub.GlowColour = colourProvider.Background2; NormalNub.GlowColour = colourProvider.Background2;
} }
} }
} }

View File

@ -30,9 +30,9 @@ namespace osu.Game.Graphics.UserInterfaceV2
if (overlayColourProvider != null) if (overlayColourProvider != null)
return; return;
Nub.AccentColour = colours.GreySeaFoamLighter; NormalNub.AccentColour = colours.GreySeaFoamLighter;
Nub.GlowingAccentColour = Color4.White; NormalNub.GlowingAccentColour = Color4.White;
Nub.GlowColour = Color4.White; NormalNub.GlowColour = Color4.White;
} }
} }
} }

View File

@ -267,9 +267,9 @@ namespace osu.Game.Overlays.Mods
private void updateState() private void updateState()
{ {
Nub.AccentColour = AccentColour; NormalNub.AccentColour = AccentColour;
Nub.GlowingAccentColour = AccentHoverColour; NormalNub.GlowingAccentColour = AccentHoverColour;
Nub.GlowColour = AccentHoverColour.Opacity(0.2f); NormalNub.GlowColour = AccentHoverColour.Opacity(0.2f);
} }
protected override void OnUserChange(bool value) protected override void OnUserChange(bool value)

View File

@ -18,9 +18,9 @@ namespace osu.Game.Screens.Play.PlayerSettings
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
Nub.AccentColour = colours.Yellow; NormalNub.AccentColour = colours.Yellow;
Nub.GlowingAccentColour = colours.YellowLighter; NormalNub.GlowingAccentColour = colours.YellowLighter;
Nub.GlowColour = colours.YellowDark; NormalNub.GlowColour = colours.YellowDark;
} }
} }
} }

View File

@ -30,9 +30,9 @@ namespace osu.Game.Screens.Play.PlayerSettings
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
AccentColour = colours.Yellow; AccentColour = colours.Yellow;
Nub.AccentColour = colours.Yellow; NormalNub.AccentColour = colours.Yellow;
Nub.GlowingAccentColour = colours.YellowLighter; NormalNub.GlowingAccentColour = colours.YellowLighter;
Nub.GlowColour = colours.YellowDark; NormalNub.GlowColour = colours.YellowDark;
} }
} }
} }