mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Merge branch 'master' into use-pattern-matching
This commit is contained in:
@ -26,10 +26,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// </summary>
|
||||
public float Length
|
||||
{
|
||||
get
|
||||
{
|
||||
return length;
|
||||
}
|
||||
get => length;
|
||||
set
|
||||
{
|
||||
length = MathHelper.Clamp(value, 0, 1);
|
||||
@ -39,35 +36,21 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
public Color4 BackgroundColour
|
||||
{
|
||||
get
|
||||
{
|
||||
return background.Colour;
|
||||
}
|
||||
set
|
||||
{
|
||||
background.Colour = value;
|
||||
}
|
||||
get => background.Colour;
|
||||
set => background.Colour = value;
|
||||
}
|
||||
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get
|
||||
{
|
||||
return bar.Colour;
|
||||
}
|
||||
set
|
||||
{
|
||||
bar.Colour = value;
|
||||
}
|
||||
get => bar.Colour;
|
||||
set => bar.Colour = value;
|
||||
}
|
||||
|
||||
private BarDirection direction = BarDirection.LeftToRight;
|
||||
|
||||
public BarDirection Direction
|
||||
{
|
||||
get
|
||||
{
|
||||
return direction;
|
||||
}
|
||||
get => direction;
|
||||
set
|
||||
{
|
||||
direction = value;
|
||||
|
@ -17,12 +17,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
public float? MaxValue { get; set; }
|
||||
|
||||
private BarDirection direction = BarDirection.BottomToTop;
|
||||
|
||||
public new BarDirection Direction
|
||||
{
|
||||
get
|
||||
{
|
||||
return direction;
|
||||
}
|
||||
get => direction;
|
||||
set
|
||||
{
|
||||
direction = value;
|
||||
@ -69,6 +67,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//I'm using ToList() here because Where() returns an Enumerable which can change it's elements afterwards
|
||||
RemoveRange(Children.Where((bar, index) => index >= value.Count()).ToList());
|
||||
}
|
||||
|
@ -57,10 +57,11 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
public Visibility State
|
||||
{
|
||||
get { return state; }
|
||||
get => state;
|
||||
set
|
||||
{
|
||||
if (value == state) return;
|
||||
|
||||
state = value;
|
||||
|
||||
const float transition_duration = 500;
|
||||
@ -80,7 +81,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
}
|
||||
|
||||
public BreadcrumbTabItem(T value) : base(value)
|
||||
public BreadcrumbTabItem(T value)
|
||||
: base(value)
|
||||
{
|
||||
Text.Font = Text.Font.With(size: 18);
|
||||
Text.Margin = new MarginPadding { Vertical = 8 };
|
||||
|
@ -154,12 +154,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
|
||||
private Color4 buttonColour;
|
||||
|
||||
public Color4 ButtonColour
|
||||
{
|
||||
get
|
||||
{
|
||||
return buttonColour;
|
||||
}
|
||||
get => buttonColour;
|
||||
set
|
||||
{
|
||||
buttonColour = value;
|
||||
@ -169,12 +167,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
|
||||
private Color4 backgroundColour = OsuColour.Gray(34);
|
||||
|
||||
public Color4 BackgroundColour
|
||||
{
|
||||
get
|
||||
{
|
||||
return backgroundColour;
|
||||
}
|
||||
get => backgroundColour;
|
||||
set
|
||||
{
|
||||
backgroundColour = value;
|
||||
@ -183,12 +179,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
|
||||
private string text;
|
||||
|
||||
public string Text
|
||||
{
|
||||
get
|
||||
{
|
||||
return text;
|
||||
}
|
||||
get => text;
|
||||
set
|
||||
{
|
||||
text = value;
|
||||
|
@ -51,7 +51,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
if(Link != null)
|
||||
if (Link != null)
|
||||
host.OpenUrlExternally(Link);
|
||||
return true;
|
||||
}
|
||||
|
@ -17,7 +17,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
private SampleChannel sampleClick;
|
||||
|
||||
public HoverClickSounds(HoverSampleSet sampleSet = HoverSampleSet.Normal) : base(sampleSet)
|
||||
public HoverClickSounds(HoverSampleSet sampleSet = HoverSampleSet.Normal)
|
||||
: base(sampleSet)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -45,8 +45,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
[Description("")]
|
||||
Loud,
|
||||
|
||||
[Description("-soft")]
|
||||
Normal,
|
||||
|
||||
[Description("-softer")]
|
||||
Soft
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// </summary>
|
||||
public Color4 IconColour
|
||||
{
|
||||
get { return iconColour ?? Color4.White; }
|
||||
get => iconColour ?? Color4.White;
|
||||
set
|
||||
{
|
||||
iconColour = value;
|
||||
@ -34,8 +34,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// </summary>
|
||||
public Color4 IconHoverColour
|
||||
{
|
||||
get { return iconHoverColour ?? IconColour; }
|
||||
set { iconHoverColour = value; }
|
||||
get => iconHoverColour ?? IconColour;
|
||||
set => iconHoverColour = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -43,8 +43,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// </summary>
|
||||
public FontAwesome Icon
|
||||
{
|
||||
get { return icon.Icon; }
|
||||
set { icon.Icon = value; }
|
||||
get => icon.Icon;
|
||||
set => icon.Icon = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -52,8 +52,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// </summary>
|
||||
public Vector2 IconScale
|
||||
{
|
||||
get { return icon.Scale; }
|
||||
set { icon.Scale = value; }
|
||||
get => icon.Scale;
|
||||
set => icon.Scale = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -44,7 +44,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// </summary>
|
||||
public IEnumerable<float> Values
|
||||
{
|
||||
get { return values; }
|
||||
get => values;
|
||||
set
|
||||
{
|
||||
values = value.ToArray();
|
||||
@ -112,6 +112,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
protected float GetYPosition(float value)
|
||||
{
|
||||
if (ActualMaxValue == ActualMinValue) return 0;
|
||||
|
||||
return (ActualMaxValue - value) / (ActualMaxValue - ActualMinValue);
|
||||
}
|
||||
}
|
||||
|
@ -72,9 +72,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
|
||||
private bool glowing;
|
||||
|
||||
public bool Glowing
|
||||
{
|
||||
get { return glowing; }
|
||||
get => glowing;
|
||||
set
|
||||
{
|
||||
glowing = value;
|
||||
@ -94,10 +95,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
public bool Expanded
|
||||
{
|
||||
set
|
||||
{
|
||||
this.ResizeTo(new Vector2(value ? EXPANDED_SIZE : COLLAPSED_SIZE, 12), 500, Easing.OutQuint);
|
||||
}
|
||||
set => this.ResizeTo(new Vector2(value ? EXPANDED_SIZE : COLLAPSED_SIZE, 12), 500, Easing.OutQuint);
|
||||
}
|
||||
|
||||
private readonly Bindable<bool> current = new Bindable<bool>();
|
||||
@ -116,9 +114,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
|
||||
private Color4 accentColour;
|
||||
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get { return accentColour; }
|
||||
get => accentColour;
|
||||
set
|
||||
{
|
||||
accentColour = value;
|
||||
@ -128,9 +127,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
|
||||
private Color4 glowingAccentColour;
|
||||
|
||||
public Color4 GlowingAccentColour
|
||||
{
|
||||
get { return glowingAccentColour; }
|
||||
get => glowingAccentColour;
|
||||
set
|
||||
{
|
||||
glowingAccentColour = value;
|
||||
@ -140,9 +140,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
|
||||
private Color4 glowColour;
|
||||
|
||||
public Color4 GlowColour
|
||||
{
|
||||
get { return glowColour; }
|
||||
get => glowColour;
|
||||
set
|
||||
{
|
||||
glowColour = value;
|
||||
|
@ -33,7 +33,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
public string LabelText
|
||||
{
|
||||
get { return labelSpriteText?.Text; }
|
||||
get => labelSpriteText?.Text;
|
||||
set
|
||||
{
|
||||
if (labelSpriteText != null)
|
||||
@ -43,7 +43,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
public MarginPadding LabelPadding
|
||||
{
|
||||
get { return labelSpriteText?.Padding ?? new MarginPadding(); }
|
||||
get => labelSpriteText?.Padding ?? new MarginPadding();
|
||||
set
|
||||
{
|
||||
if (labelSpriteText != null)
|
||||
|
@ -17,9 +17,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
public class OsuDropdown<T> : Dropdown<T>, IHasAccentColour
|
||||
{
|
||||
private Color4 accentColour;
|
||||
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get { return accentColour; }
|
||||
get => accentColour;
|
||||
set
|
||||
{
|
||||
accentColour = value;
|
||||
@ -47,6 +48,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
protected override DropdownMenu CreateMenu() => new OsuDropdownMenu();
|
||||
|
||||
#region OsuDropdownMenu
|
||||
|
||||
protected class OsuDropdownMenu : DropdownMenu, IHasAccentColour
|
||||
{
|
||||
public override bool HandleNonPositionalInput => State == MenuState.Open;
|
||||
@ -81,9 +83,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
|
||||
private Color4 accentColour;
|
||||
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get { return accentColour; }
|
||||
get => accentColour;
|
||||
set
|
||||
{
|
||||
accentColour = value;
|
||||
@ -95,15 +98,17 @@ namespace osu.Game.Graphics.UserInterface
|
||||
protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableOsuDropdownMenuItem(item) { AccentColour = accentColour };
|
||||
|
||||
#region DrawableOsuDropdownMenuItem
|
||||
|
||||
public class DrawableOsuDropdownMenuItem : DrawableDropdownMenuItem, IHasAccentColour
|
||||
{
|
||||
// IsHovered is used
|
||||
public override bool HandlePositionalInput => true;
|
||||
|
||||
private Color4? accentColour;
|
||||
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get { return accentColour ?? nonAccentSelectedColour; }
|
||||
get => accentColour ?? nonAccentSelectedColour;
|
||||
set
|
||||
{
|
||||
accentColour = value;
|
||||
@ -156,8 +161,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public string Text
|
||||
{
|
||||
get { return Label.Text; }
|
||||
set { Label.Text = value; }
|
||||
get => Label.Text;
|
||||
set => Label.Text = value;
|
||||
}
|
||||
|
||||
public readonly OsuSpriteText Label;
|
||||
@ -191,25 +196,29 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public class OsuDropdownHeader : DropdownHeader, IHasAccentColour
|
||||
{
|
||||
protected readonly SpriteText Text;
|
||||
|
||||
protected override string Label
|
||||
{
|
||||
get { return Text.Text; }
|
||||
set { Text.Text = value; }
|
||||
get => Text.Text;
|
||||
set => Text.Text = value;
|
||||
}
|
||||
|
||||
protected readonly SpriteIcon Icon;
|
||||
|
||||
private Color4 accentColour;
|
||||
|
||||
public virtual Color4 AccentColour
|
||||
{
|
||||
get { return accentColour; }
|
||||
get => accentColour;
|
||||
set
|
||||
{
|
||||
accentColour = value;
|
||||
|
@ -125,7 +125,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public string Text
|
||||
{
|
||||
get { return NormalText.Text; }
|
||||
get => NormalText.Text;
|
||||
set
|
||||
{
|
||||
NormalText.Text = value;
|
||||
|
@ -35,9 +35,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
public virtual string TooltipText { get; private set; }
|
||||
|
||||
private Color4 accentColour;
|
||||
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get { return accentColour; }
|
||||
get => accentColour;
|
||||
set
|
||||
{
|
||||
accentColour = value;
|
||||
@ -79,10 +80,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
new HoverClickSounds()
|
||||
};
|
||||
|
||||
Current.DisabledChanged += disabled =>
|
||||
{
|
||||
Alpha = disabled ? 0.3f : 1;
|
||||
};
|
||||
Current.DisabledChanged += disabled => { Alpha = disabled ? 0.3f : 1; };
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -58,9 +58,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
}
|
||||
|
||||
private Color4 accentColour;
|
||||
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get { return accentColour; }
|
||||
get => accentColour;
|
||||
set
|
||||
{
|
||||
accentColour = value;
|
||||
@ -100,9 +101,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
protected readonly Box Bar;
|
||||
|
||||
private Color4 accentColour;
|
||||
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get { return accentColour; }
|
||||
get => accentColour;
|
||||
set
|
||||
{
|
||||
accentColour = value;
|
||||
@ -145,7 +147,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
AccentColour = colours.Blue;
|
||||
}
|
||||
|
||||
public OsuTabItem(T value) : base(value)
|
||||
public OsuTabItem(T value)
|
||||
: base(value)
|
||||
{
|
||||
AutoSizeAxes = Axes.X;
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
@ -223,11 +226,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public override Color4 AccentColour
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.AccentColour;
|
||||
}
|
||||
|
||||
get => base.AccentColour;
|
||||
set
|
||||
{
|
||||
base.AccentColour = value;
|
||||
|
@ -24,9 +24,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
private readonly SpriteIcon icon;
|
||||
|
||||
private Color4? accentColour;
|
||||
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get { return accentColour.GetValueOrDefault(); }
|
||||
get => accentColour.GetValueOrDefault();
|
||||
set
|
||||
{
|
||||
accentColour = value;
|
||||
@ -41,8 +42,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
public string Text
|
||||
{
|
||||
get { return text.Text; }
|
||||
set { text.Text = value; }
|
||||
get => text.Text;
|
||||
set => text.Text = value;
|
||||
}
|
||||
|
||||
private const float transition_length = 500;
|
||||
|
@ -32,7 +32,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
protected readonly SpriteText Text;
|
||||
|
||||
public PageTabItem(T value) : base(value)
|
||||
public PageTabItem(T value)
|
||||
: base(value)
|
||||
{
|
||||
AutoSizeAxes = Axes.X;
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
public Color4 FillColour
|
||||
{
|
||||
set { fill.FadeColour(value, 150, Easing.OutQuint); }
|
||||
set => fill.FadeColour(value, 150, Easing.OutQuint);
|
||||
}
|
||||
|
||||
public Color4 BackgroundColour
|
||||
@ -32,12 +32,12 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
public double EndTime
|
||||
{
|
||||
set { CurrentNumber.MaxValue = value; }
|
||||
set => CurrentNumber.MaxValue = value;
|
||||
}
|
||||
|
||||
public double CurrentTime
|
||||
{
|
||||
set { CurrentNumber.Value = value; }
|
||||
set => CurrentNumber.Value = value;
|
||||
}
|
||||
|
||||
public ProgressBar()
|
||||
|
@ -45,15 +45,13 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// </summary>
|
||||
public virtual T DisplayedCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return displayedCount;
|
||||
}
|
||||
get => displayedCount;
|
||||
|
||||
set
|
||||
{
|
||||
if (EqualityComparer<T>.Default.Equals(displayedCount, value))
|
||||
return;
|
||||
|
||||
displayedCount = value;
|
||||
DisplayedCountSpriteText.Text = FormatCount(value);
|
||||
}
|
||||
@ -70,8 +68,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
public Color4 AccentColour
|
||||
{
|
||||
get { return DisplayedCountSpriteText.Colour; }
|
||||
set { DisplayedCountSpriteText.Colour = value; }
|
||||
get => DisplayedCountSpriteText.Colour;
|
||||
set => DisplayedCountSpriteText.Colour = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -41,10 +41,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// </summary>
|
||||
public float CountStars
|
||||
{
|
||||
get
|
||||
{
|
||||
return countStars;
|
||||
}
|
||||
get => countStars;
|
||||
|
||||
set
|
||||
{
|
||||
@ -137,6 +134,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
private class Star : Container
|
||||
{
|
||||
public readonly SpriteIcon Icon;
|
||||
|
||||
public Star()
|
||||
{
|
||||
Size = new Vector2(star_size);
|
||||
|
@ -31,10 +31,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
public bool MatchingFilter
|
||||
{
|
||||
set
|
||||
{
|
||||
this.FadeTo(value ? 1 : 0);
|
||||
}
|
||||
set => this.FadeTo(value ? 1 : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -48,11 +48,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
public override Anchor Origin
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Origin;
|
||||
}
|
||||
|
||||
get => base.Origin;
|
||||
set
|
||||
{
|
||||
base.Origin = value;
|
||||
@ -155,18 +151,12 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
public FontAwesome Icon
|
||||
{
|
||||
set
|
||||
{
|
||||
bouncingIcon.Icon = value;
|
||||
}
|
||||
set => bouncingIcon.Icon = value;
|
||||
}
|
||||
|
||||
public string Text
|
||||
{
|
||||
set
|
||||
{
|
||||
text.Text = value;
|
||||
}
|
||||
set => text.Text = value;
|
||||
}
|
||||
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => IconLayer.ReceivePositionalInputAt(screenSpacePos) || TextLayer.ReceivePositionalInputAt(screenSpacePos);
|
||||
@ -217,7 +207,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
private readonly SpriteIcon icon;
|
||||
|
||||
public FontAwesome Icon { set { icon.Icon = value; } }
|
||||
public FontAwesome Icon
|
||||
{
|
||||
set => icon.Icon = value;
|
||||
}
|
||||
|
||||
public BouncingIcon()
|
||||
{
|
||||
|
Reference in New Issue
Block a user