mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 15:33:05 +08:00
Update existing code to use helper method
This commit is contained in:
parent
7cfb786b1a
commit
4dc11c4c48
@ -4,18 +4,17 @@
|
|||||||
using System;
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.LocalisationExtensions;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Utils;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Utils;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Mods
|
namespace osu.Game.Overlays.Mods
|
||||||
@ -109,13 +108,13 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
Current.BindValueChanged(e =>
|
Current.BindValueChanged(e =>
|
||||||
{
|
{
|
||||||
if (Precision.DefinitelyBigger(e.NewValue, Current.Default))
|
if (e.NewValue > Current.Default)
|
||||||
{
|
{
|
||||||
MainBackground
|
MainBackground
|
||||||
.FadeColour(colours.ForModType(ModType.DifficultyIncrease), transition_duration, Easing.OutQuint);
|
.FadeColour(colours.ForModType(ModType.DifficultyIncrease), transition_duration, Easing.OutQuint);
|
||||||
counter.FadeColour(ColourProvider.Background5, transition_duration, Easing.OutQuint);
|
counter.FadeColour(ColourProvider.Background5, transition_duration, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
else if (Precision.DefinitelyBigger(Current.Default, e.NewValue))
|
else if (e.NewValue < Current.Default)
|
||||||
{
|
{
|
||||||
MainBackground
|
MainBackground
|
||||||
.FadeColour(colours.ForModType(ModType.DifficultyReduction), transition_duration, Easing.OutQuint);
|
.FadeColour(colours.ForModType(ModType.DifficultyReduction), transition_duration, Easing.OutQuint);
|
||||||
@ -132,11 +131,6 @@ namespace osu.Game.Overlays.Mods
|
|||||||
.FadeTo(0.15f, 60, Easing.OutQuint)
|
.FadeTo(0.15f, 60, Easing.OutQuint)
|
||||||
.Then().FadeOut(500, Easing.OutQuint);
|
.Then().FadeOut(500, Easing.OutQuint);
|
||||||
|
|
||||||
if (Precision.DefinitelyBigger(1.0, Current.Value) && Current.Value >= 0.995)
|
|
||||||
Current.Value = 0.99;
|
|
||||||
if (Precision.DefinitelyBigger(Current.Value, 1.0) && Current.Value < 1.005)
|
|
||||||
Current.Value = 1.01;
|
|
||||||
|
|
||||||
const float move_amount = 4;
|
const float move_amount = 4;
|
||||||
if (e.NewValue > e.OldValue)
|
if (e.NewValue > e.OldValue)
|
||||||
counter.MoveToY(Math.Max(-move_amount * 2, counter.Y - move_amount)).Then().MoveToY(0, transition_duration * 2, Easing.OutQuint);
|
counter.MoveToY(Math.Max(-move_amount * 2, counter.Y - move_amount)).Then().MoveToY(0, transition_duration * 2, Easing.OutQuint);
|
||||||
@ -153,7 +147,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
{
|
{
|
||||||
protected override double RollingDuration => 500;
|
protected override double RollingDuration => 500;
|
||||||
|
|
||||||
protected override LocalisableString FormatCount(double count) => count.ToLocalisableString(@"0.00x");
|
protected override LocalisableString FormatCount(double count) => ModUtils.FormatScoreMultiplier(count);
|
||||||
|
|
||||||
protected override OsuSpriteText CreateSpriteText() => new OsuSpriteText
|
protected override OsuSpriteText CreateSpriteText() => new OsuSpriteText
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,7 @@ using osu.Game.Graphics.Sprites;
|
|||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Framework.Utils;
|
using osu.Game.Utils;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Select
|
namespace osu.Game.Screens.Select
|
||||||
{
|
{
|
||||||
@ -88,17 +88,11 @@ namespace osu.Game.Screens.Select
|
|||||||
private void updateMultiplierText() => Schedule(() =>
|
private void updateMultiplierText() => Schedule(() =>
|
||||||
{
|
{
|
||||||
double multiplier = Current.Value?.Aggregate(1.0, (current, mod) => current * mod.ScoreMultiplier) ?? 1;
|
double multiplier = Current.Value?.Aggregate(1.0, (current, mod) => current * mod.ScoreMultiplier) ?? 1;
|
||||||
|
MultiplierText.Text = multiplier == 1 ? string.Empty : ModUtils.FormatScoreMultiplier(multiplier);
|
||||||
|
|
||||||
if (Precision.DefinitelyBigger(1.0, multiplier) && multiplier >= 0.995)
|
if (multiplier > 1)
|
||||||
MultiplierText.Text = $"{0.99:N2}x";
|
|
||||||
else if (Precision.DefinitelyBigger(multiplier, 1.0) && multiplier < 1.005)
|
|
||||||
MultiplierText.Text = $"{1.01:N2}x";
|
|
||||||
else
|
|
||||||
MultiplierText.Text = multiplier.Equals(1.0) ? string.Empty : $"{multiplier:N2}x";
|
|
||||||
|
|
||||||
if (Precision.DefinitelyBigger(multiplier, 1.0))
|
|
||||||
MultiplierText.FadeColour(highMultiplierColour, 200);
|
MultiplierText.FadeColour(highMultiplierColour, 200);
|
||||||
else if (Precision.DefinitelyBigger(1.0, multiplier))
|
else if (multiplier < 1)
|
||||||
MultiplierText.FadeColour(lowMultiplierColour, 200);
|
MultiplierText.FadeColour(lowMultiplierColour, 200);
|
||||||
else
|
else
|
||||||
MultiplierText.FadeColour(Color4.White, 200);
|
MultiplierText.FadeColour(Color4.White, 200);
|
||||||
|
Loading…
Reference in New Issue
Block a user