mirror of
https://github.com/ppy/osu.git
synced 2025-01-07 15:32:58 +08:00
Merge branch 'master' into tournament-design-win
This commit is contained in:
commit
0ecf6a4ecd
@ -3,9 +3,6 @@
|
|||||||
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
|
||||||
using osu.Framework.Utils;
|
|
||||||
using osu.Game.Graphics.Sprites;
|
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Screens.Play.HUD;
|
using osu.Game.Screens.Play.HUD;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -45,32 +42,12 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
};
|
};
|
||||||
Add(accuracyCounter);
|
Add(accuracyCounter);
|
||||||
|
|
||||||
StarCounter stars = new StarCounter
|
|
||||||
{
|
|
||||||
Origin = Anchor.BottomLeft,
|
|
||||||
Anchor = Anchor.BottomLeft,
|
|
||||||
Position = new Vector2(20, -160),
|
|
||||||
CountStars = 5,
|
|
||||||
};
|
|
||||||
Add(stars);
|
|
||||||
|
|
||||||
SpriteText starsLabel = new OsuSpriteText
|
|
||||||
{
|
|
||||||
Origin = Anchor.BottomLeft,
|
|
||||||
Anchor = Anchor.BottomLeft,
|
|
||||||
Position = new Vector2(20, -190),
|
|
||||||
Text = stars.CountStars.ToString("0.00"),
|
|
||||||
};
|
|
||||||
Add(starsLabel);
|
|
||||||
|
|
||||||
AddStep(@"Reset all", delegate
|
AddStep(@"Reset all", delegate
|
||||||
{
|
{
|
||||||
score.Current.Value = 0;
|
score.Current.Value = 0;
|
||||||
comboCounter.Current.Value = 0;
|
comboCounter.Current.Value = 0;
|
||||||
numerator = denominator = 0;
|
numerator = denominator = 0;
|
||||||
accuracyCounter.SetFraction(0, 0);
|
accuracyCounter.SetFraction(0, 0);
|
||||||
stars.CountStars = 0;
|
|
||||||
starsLabel.Text = stars.CountStars.ToString("0.00");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep(@"Hit! :D", delegate
|
AddStep(@"Hit! :D", delegate
|
||||||
@ -88,20 +65,6 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
denominator++;
|
denominator++;
|
||||||
accuracyCounter.SetFraction(numerator, denominator);
|
accuracyCounter.SetFraction(numerator, denominator);
|
||||||
});
|
});
|
||||||
|
|
||||||
AddStep(@"Alter stars", delegate
|
|
||||||
{
|
|
||||||
stars.CountStars = RNG.NextSingle() * (stars.StarCount + 1);
|
|
||||||
starsLabel.Text = stars.CountStars.ToString("0.00");
|
|
||||||
});
|
|
||||||
|
|
||||||
AddStep(@"Stop counters", delegate
|
|
||||||
{
|
|
||||||
score.StopRolling();
|
|
||||||
comboCounter.StopRolling();
|
|
||||||
accuracyCounter.StopRolling();
|
|
||||||
stars.StopAnimation();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
57
osu.Game.Tests/Visual/Gameplay/TestSceneStarCounter.cs
Normal file
57
osu.Game.Tests/Visual/Gameplay/TestSceneStarCounter.cs
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
// 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 NUnit.Framework;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Utils;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Gameplay
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestSceneStarCounter : OsuTestScene
|
||||||
|
{
|
||||||
|
public TestSceneStarCounter()
|
||||||
|
{
|
||||||
|
StarCounter stars = new StarCounter
|
||||||
|
{
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Current = 5,
|
||||||
|
};
|
||||||
|
|
||||||
|
Add(stars);
|
||||||
|
|
||||||
|
SpriteText starsLabel = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Scale = new Vector2(2),
|
||||||
|
Y = 50,
|
||||||
|
Text = stars.Current.ToString("0.00"),
|
||||||
|
};
|
||||||
|
|
||||||
|
Add(starsLabel);
|
||||||
|
|
||||||
|
AddRepeatStep(@"random value", delegate
|
||||||
|
{
|
||||||
|
stars.Current = RNG.NextSingle() * (stars.StarCount + 1);
|
||||||
|
starsLabel.Text = stars.Current.ToString("0.00");
|
||||||
|
}, 10);
|
||||||
|
|
||||||
|
AddStep(@"Stop animation", delegate
|
||||||
|
{
|
||||||
|
stars.StopAnimation();
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep(@"Reset", delegate
|
||||||
|
{
|
||||||
|
stars.Current = 0;
|
||||||
|
starsLabel.Text = stars.Current.ToString("0.00");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -46,12 +46,7 @@ namespace osu.Game.Tournament.Components
|
|||||||
{
|
{
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
ChildrenEnumerable = team?.Players.Select(p => new TournamentSpriteText
|
ChildrenEnumerable = team?.Players.Select(createPlayerText).Skip(5) ?? Enumerable.Empty<Drawable>()
|
||||||
{
|
|
||||||
Text = p.Username,
|
|
||||||
Font = OsuFont.Torus.With(size: 24, weight: FontWeight.SemiBold),
|
|
||||||
Colour = Color4.White,
|
|
||||||
}).Skip(5) ?? Enumerable.Empty<Drawable>()
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -66,6 +66,10 @@ namespace osu.Game.Tournament.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Expand() => this.FadeIn(300);
|
||||||
|
|
||||||
|
public void Contract() => this.FadeOut(200);
|
||||||
|
|
||||||
protected override ChatLine CreateMessage(Message message) => new MatchMessage(message);
|
protected override ChatLine CreateMessage(Message message) => new MatchMessage(message);
|
||||||
|
|
||||||
protected class MatchMessage : StandAloneMessage
|
protected class MatchMessage : StandAloneMessage
|
||||||
|
@ -38,7 +38,8 @@ namespace osu.Game.Tournament.Components
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
FillMode = FillMode.Fit,
|
FillMode = FillMode.Fit,
|
||||||
Clock = new FramedClock(manualClock = new ManualClock())
|
Clock = new FramedClock(manualClock = new ManualClock()),
|
||||||
|
Loop = loop,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if (drawFallbackGradient)
|
else if (drawFallbackGradient)
|
||||||
@ -51,10 +52,13 @@ namespace osu.Game.Tournament.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool loop;
|
||||||
|
|
||||||
public bool Loop
|
public bool Loop
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
loop = value;
|
||||||
if (video != null)
|
if (video != null)
|
||||||
video.Loop = value;
|
video.Loop = value;
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,6 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
|||||||
currentTeamScore.BindTo(score);
|
currentTeamScore.BindTo(score);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void scoreChanged(ValueChangedEvent<int?> score) => counter.CountStars = score.NewValue ?? 0;
|
private void scoreChanged(ValueChangedEvent<int?> score) => counter.Current = score.NewValue ?? 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,11 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
public class OsuPasswordTextBox : OsuTextBox, ISuppressKeyEventLogging
|
public class OsuPasswordTextBox : OsuTextBox, ISuppressKeyEventLogging
|
||||||
{
|
{
|
||||||
protected override Drawable GetDrawableCharacter(char c) => new PasswordMaskChar(CalculatedTextSize);
|
protected override Drawable GetDrawableCharacter(char c) => new FallingDownContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Child = new PasswordMaskChar(CalculatedTextSize),
|
||||||
|
};
|
||||||
|
|
||||||
protected override bool AllowClipboardExport => false;
|
protected override bool AllowClipboardExport => false;
|
||||||
|
|
||||||
|
@ -63,7 +63,11 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
base.OnFocusLost(e);
|
base.OnFocusLost(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: CalculatedTextSize) };
|
protected override Drawable GetDrawableCharacter(char c) => new FallingDownContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Child = new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: CalculatedTextSize) },
|
||||||
|
};
|
||||||
|
|
||||||
protected override Caret CreateCaret() => new OsuCaret
|
protected override Caret CreateCaret() => new OsuCaret
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
{
|
{
|
||||||
public class StarCounter : Container
|
public class StarCounter : Container
|
||||||
{
|
{
|
||||||
private readonly Container<Star> stars;
|
private readonly FillFlowContainer<Star> stars;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Maximum amount of stars displayed.
|
/// Maximum amount of stars displayed.
|
||||||
@ -23,34 +23,29 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
public int StarCount { get; }
|
public int StarCount { get; }
|
||||||
|
|
||||||
private double animationDelay => 80;
|
/// <summary>
|
||||||
|
/// The added delay for each subsequent star to be animated.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual double AnimationDelay => 80;
|
||||||
|
|
||||||
private double scalingDuration => 1000;
|
|
||||||
private Easing scalingEasing => Easing.OutElasticHalf;
|
|
||||||
private float minStarScale => 0.4f;
|
|
||||||
|
|
||||||
private double fadingDuration => 100;
|
|
||||||
private float minStarAlpha => 0.5f;
|
|
||||||
|
|
||||||
private const float star_size = 20;
|
|
||||||
private const float star_spacing = 4;
|
private const float star_spacing = 4;
|
||||||
|
|
||||||
private float countStars;
|
private float current;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Amount of stars represented.
|
/// Amount of stars represented.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public float CountStars
|
public float Current
|
||||||
{
|
{
|
||||||
get => countStars;
|
get => current;
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (countStars == value) return;
|
if (current == value) return;
|
||||||
|
|
||||||
if (IsLoaded)
|
if (IsLoaded)
|
||||||
transformCount(value);
|
animate(value);
|
||||||
countStars = value;
|
current = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,11 +66,13 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Spacing = new Vector2(star_spacing),
|
Spacing = new Vector2(star_spacing),
|
||||||
ChildrenEnumerable = Enumerable.Range(0, StarCount).Select(i => new Star { Alpha = minStarAlpha })
|
ChildrenEnumerable = Enumerable.Range(0, StarCount).Select(i => CreateStar())
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual Star CreateStar() => new DefaultStar();
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
@ -86,63 +83,60 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
public void ResetCount()
|
public void ResetCount()
|
||||||
{
|
{
|
||||||
countStars = 0;
|
current = 0;
|
||||||
StopAnimation();
|
StopAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReplayAnimation()
|
public void ReplayAnimation()
|
||||||
{
|
{
|
||||||
var t = countStars;
|
var t = current;
|
||||||
ResetCount();
|
ResetCount();
|
||||||
CountStars = t;
|
Current = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StopAnimation()
|
public void StopAnimation()
|
||||||
{
|
{
|
||||||
int i = 0;
|
animate(current);
|
||||||
|
|
||||||
foreach (var star in stars.Children)
|
foreach (var star in stars.Children)
|
||||||
|
star.FinishTransforms(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private float getStarScale(int i, float value) => i + 1 <= value ? 1.0f : Interpolation.ValueAt(value, 0, 1.0f, i, i + 1);
|
||||||
|
|
||||||
|
private void animate(float newValue)
|
||||||
|
{
|
||||||
|
for (var i = 0; i < stars.Children.Count; i++)
|
||||||
{
|
{
|
||||||
|
var star = stars.Children[i];
|
||||||
|
|
||||||
star.ClearTransforms(true);
|
star.ClearTransforms(true);
|
||||||
star.FadeTo(i < countStars ? 1.0f : minStarAlpha);
|
|
||||||
star.Icon.ScaleTo(getStarScale(i, countStars));
|
double delay = (current <= newValue ? Math.Max(i - current, 0) : Math.Max(current - 1 - i, 0)) * AnimationDelay;
|
||||||
i++;
|
|
||||||
|
using (star.BeginDelayedSequence(delay, true))
|
||||||
|
star.DisplayAt(getStarScale(i, newValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getStarScale(int i, float value)
|
public class DefaultStar : Star
|
||||||
{
|
{
|
||||||
if (value <= i)
|
private const double scaling_duration = 1000;
|
||||||
return minStarScale;
|
|
||||||
|
|
||||||
return i + 1 <= value ? 1.0f : Interpolation.ValueAt(value, minStarScale, 1.0f, i, i + 1);
|
private const double fading_duration = 100;
|
||||||
}
|
|
||||||
|
|
||||||
private void transformCount(float newValue)
|
private const Easing scaling_easing = Easing.OutElasticHalf;
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
foreach (var star in stars.Children)
|
private const float min_star_scale = 0.4f;
|
||||||
{
|
|
||||||
star.ClearTransforms(true);
|
|
||||||
|
|
||||||
var delay = (countStars <= newValue ? Math.Max(i - countStars, 0) : Math.Max(countStars - 1 - i, 0)) * animationDelay;
|
private const float star_size = 20;
|
||||||
star.Delay(delay).FadeTo(i < newValue ? 1.0f : minStarAlpha, fadingDuration);
|
|
||||||
star.Icon.Delay(delay).ScaleTo(getStarScale(i, newValue), scalingDuration, scalingEasing);
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class Star : Container
|
|
||||||
{
|
|
||||||
public readonly SpriteIcon Icon;
|
public readonly SpriteIcon Icon;
|
||||||
|
|
||||||
public Star()
|
public DefaultStar()
|
||||||
{
|
{
|
||||||
Size = new Vector2(star_size);
|
Size = new Vector2(star_size);
|
||||||
|
|
||||||
Child = Icon = new SpriteIcon
|
InternalChild = Icon = new SpriteIcon
|
||||||
{
|
{
|
||||||
Size = new Vector2(star_size),
|
Size = new Vector2(star_size),
|
||||||
Icon = FontAwesome.Solid.Star,
|
Icon = FontAwesome.Solid.Star,
|
||||||
@ -150,6 +144,19 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void DisplayAt(float scale)
|
||||||
|
{
|
||||||
|
scale = Math.Clamp(scale, min_star_scale, 1);
|
||||||
|
|
||||||
|
this.FadeTo(scale, fading_duration);
|
||||||
|
Icon.ScaleTo(scale, scaling_duration, scaling_easing);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class Star : CompositeDrawable
|
||||||
|
{
|
||||||
|
public abstract void DisplayAt(float scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,18 +92,6 @@ namespace osu.Game.Online.Chat
|
|||||||
textbox.Text = string.Empty;
|
textbox.Text = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Expand()
|
|
||||||
{
|
|
||||||
this.FadeIn(300);
|
|
||||||
this.MoveToY(0, 500, Easing.OutQuint);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Contract()
|
|
||||||
{
|
|
||||||
this.FadeOut(200);
|
|
||||||
this.MoveToY(100, 500, Easing.In);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual ChatLine CreateMessage(Message message) => new StandAloneMessage(message);
|
protected virtual ChatLine CreateMessage(Message message) => new StandAloneMessage(message);
|
||||||
|
|
||||||
private void channelChanged(ValueChangedEvent<Channel> e)
|
private void channelChanged(ValueChangedEvent<Channel> e)
|
||||||
|
@ -158,7 +158,11 @@ namespace osu.Game.Overlays.Comments
|
|||||||
Font = OsuFont.GetFont(weight: FontWeight.Regular),
|
Font = OsuFont.GetFont(weight: FontWeight.Regular),
|
||||||
};
|
};
|
||||||
|
|
||||||
protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: CalculatedTextSize) };
|
protected override Drawable GetDrawableCharacter(char c) => new FallingDownContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Child = new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: CalculatedTextSize) },
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private class CommitButton : LoadingButton
|
private class CommitButton : LoadingButton
|
||||||
|
@ -37,7 +37,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OverlayColourProvider colourProvider)
|
||||||
{
|
{
|
||||||
AddRangeInternal(new Drawable[]
|
AddRangeInternal(new Drawable[]
|
||||||
{
|
{
|
||||||
@ -61,7 +61,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
CornerRadius = corner_radius,
|
CornerRadius = corner_radius,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new ProfileItemContainer
|
new MostPlayedBeatmapContainer
|
||||||
{
|
{
|
||||||
Child = new Container
|
Child = new Container
|
||||||
{
|
{
|
||||||
@ -78,11 +78,14 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new MostPlayedBeatmapMetadataContainer(beatmap),
|
new MostPlayedBeatmapMetadataContainer(beatmap),
|
||||||
new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular))
|
new LinkFlowContainer(t =>
|
||||||
|
{
|
||||||
|
t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular);
|
||||||
|
t.Colour = colourProvider.Foreground1;
|
||||||
|
})
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Colour = colours.GreySeafoamLighter
|
|
||||||
}.With(d =>
|
}.With(d =>
|
||||||
{
|
{
|
||||||
d.AddText("mapped by ");
|
d.AddText("mapped by ");
|
||||||
@ -105,6 +108,16 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class MostPlayedBeatmapContainer : ProfileItemContainer
|
||||||
|
{
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OverlayColourProvider colourProvider)
|
||||||
|
{
|
||||||
|
IdleColour = colourProvider.Background4;
|
||||||
|
HoverColour = colourProvider.Background3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class MostPlayedBeatmapMetadataContainer : BeatmapMetadataContainer
|
private class MostPlayedBeatmapMetadataContainer : BeatmapMetadataContainer
|
||||||
{
|
{
|
||||||
public MostPlayedBeatmapMetadataContainer(BeatmapInfo beatmap)
|
public MostPlayedBeatmapMetadataContainer(BeatmapInfo beatmap)
|
||||||
|
@ -16,12 +16,33 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
private Color4 idleColour;
|
|
||||||
private Color4 hoverColour;
|
|
||||||
|
|
||||||
private readonly Box background;
|
private readonly Box background;
|
||||||
private readonly Container content;
|
private readonly Container content;
|
||||||
|
|
||||||
|
private Color4 idleColour;
|
||||||
|
|
||||||
|
protected Color4 IdleColour
|
||||||
|
{
|
||||||
|
get => idleColour;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
idleColour = value;
|
||||||
|
fadeBackgroundColour();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Color4 hoverColour;
|
||||||
|
|
||||||
|
protected Color4 HoverColour
|
||||||
|
{
|
||||||
|
get => hoverColour;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
hoverColour = value;
|
||||||
|
fadeBackgroundColour();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ProfileItemContainer()
|
public ProfileItemContainer()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
@ -44,20 +65,25 @@ namespace osu.Game.Overlays.Profile.Sections
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OverlayColourProvider colourProvider)
|
private void load(OverlayColourProvider colourProvider)
|
||||||
{
|
{
|
||||||
background.Colour = idleColour = colourProvider.Background3;
|
IdleColour = colourProvider.Background3;
|
||||||
hoverColour = colourProvider.Background2;
|
HoverColour = colourProvider.Background2;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
background.FadeColour(hoverColour, hover_duration, Easing.OutQuint);
|
fadeBackgroundColour(hover_duration);
|
||||||
return base.OnHover(e);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnHoverLost(HoverLostEvent e)
|
protected override void OnHoverLost(HoverLostEvent e)
|
||||||
{
|
{
|
||||||
base.OnHoverLost(e);
|
base.OnHoverLost(e);
|
||||||
background.FadeColour(idleColour, hover_duration, Easing.OutQuint);
|
fadeBackgroundColour(hover_duration);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fadeBackgroundColour(double fadeDuration = 0)
|
||||||
|
{
|
||||||
|
background.FadeColour(IsHovered ? HoverColour : IdleColour, fadeDuration, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
@ -240,7 +241,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
|
|||||||
, arrow_move_duration, Easing.Out);
|
, arrow_move_duration, Easing.Out);
|
||||||
}
|
}
|
||||||
|
|
||||||
private float getRelativeJudgementPosition(double value) => (float)((value / maxHitWindow) + 1) / 2;
|
private float getRelativeJudgementPosition(double value) => Math.Clamp((float)((value / maxHitWindow) + 1) / 2, 0, 1);
|
||||||
|
|
||||||
private class JudgementLine : CompositeDrawable
|
private class JudgementLine : CompositeDrawable
|
||||||
{
|
{
|
||||||
|
@ -123,7 +123,7 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
},
|
},
|
||||||
starCounter = new StarCounter
|
starCounter = new StarCounter
|
||||||
{
|
{
|
||||||
CountStars = (float)beatmap.StarDifficulty,
|
Current = (float)beatmap.StarDifficulty,
|
||||||
Scale = new Vector2(0.8f),
|
Scale = new Vector2(0.8f),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user