mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 00:53:56 +09:00
Merge branch 'master' into placement-display-in-timeline
This commit is contained in:
@ -38,8 +38,8 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
public void TestButtonShowsOnCustomisableMod()
|
public void TestButtonShowsOnCustomisableMod()
|
||||||
{
|
{
|
||||||
createModSelect();
|
createModSelect();
|
||||||
|
openModSelect();
|
||||||
|
|
||||||
AddStep("open", () => modSelect.Show());
|
|
||||||
AddAssert("button disabled", () => !modSelect.CustomiseButton.Enabled.Value);
|
AddAssert("button disabled", () => !modSelect.CustomiseButton.Enabled.Value);
|
||||||
AddUntilStep("wait for button load", () => modSelect.ButtonsLoaded);
|
AddUntilStep("wait for button load", () => modSelect.ButtonsLoaded);
|
||||||
AddStep("select mod", () => modSelect.SelectMod(testCustomisableMod));
|
AddStep("select mod", () => modSelect.SelectMod(testCustomisableMod));
|
||||||
@ -58,19 +58,21 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
AddAssert("mods still active", () => SelectedMods.Value.Count == 1);
|
AddAssert("mods still active", () => SelectedMods.Value.Count == 1);
|
||||||
|
|
||||||
AddStep("open", () => modSelect.Show());
|
openModSelect();
|
||||||
AddAssert("button enabled", () => modSelect.CustomiseButton.Enabled.Value);
|
AddAssert("button enabled", () => modSelect.CustomiseButton.Enabled.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestCustomisationOpensOnModSelect()
|
public void TestCustomisationMenuVisibility()
|
||||||
{
|
{
|
||||||
createModSelect();
|
createModSelect();
|
||||||
|
openModSelect();
|
||||||
|
|
||||||
AddStep("open", () => modSelect.Show());
|
|
||||||
AddAssert("Customisation closed", () => modSelect.ModSettingsContainer.Alpha == 0);
|
AddAssert("Customisation closed", () => modSelect.ModSettingsContainer.Alpha == 0);
|
||||||
AddStep("select mod", () => modSelect.SelectMod(testCustomisableAutoOpenMod));
|
AddStep("select mod", () => modSelect.SelectMod(testCustomisableAutoOpenMod));
|
||||||
AddAssert("Customisation opened", () => modSelect.ModSettingsContainer.Alpha == 1);
|
AddAssert("Customisation opened", () => modSelect.ModSettingsContainer.Alpha == 1);
|
||||||
|
AddStep("deselect mod", () => modSelect.SelectMod(testCustomisableAutoOpenMod));
|
||||||
|
AddAssert("Customisation closed", () => modSelect.ModSettingsContainer.Alpha == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createModSelect()
|
private void createModSelect()
|
||||||
@ -86,6 +88,12 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void openModSelect()
|
||||||
|
{
|
||||||
|
AddStep("open", () => modSelect.Show());
|
||||||
|
AddUntilStep("wait for ready", () => modSelect.State.Value == Visibility.Visible && modSelect.ButtonsLoaded);
|
||||||
|
}
|
||||||
|
|
||||||
private class TestModSelectOverlay : ModSelectOverlay
|
private class TestModSelectOverlay : ModSelectOverlay
|
||||||
{
|
{
|
||||||
public new Container ModSettingsContainer => base.ModSettingsContainer;
|
public new Container ModSettingsContainer => base.ModSettingsContainer;
|
||||||
|
@ -64,7 +64,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
hitObject.ApplyDefaults(this.beatmap.ControlPointInfo, this.beatmap.BeatmapInfo.BaseDifficulty);
|
hitObject.ApplyDefaults(this.beatmap.ControlPointInfo, this.beatmap.BeatmapInfo.BaseDifficulty);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool ShouldSkipLine(string line) => base.ShouldSkipLine(line) || line.StartsWith(" ", StringComparison.Ordinal) || line.StartsWith("_", StringComparison.Ordinal);
|
protected override bool ShouldSkipLine(string line) => base.ShouldSkipLine(line) || line.StartsWith(' ') || line.StartsWith('_');
|
||||||
|
|
||||||
protected override void ParseLine(Beatmap beatmap, Section section, string line)
|
protected override void ParseLine(Beatmap beatmap, Section section, string line)
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,7 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
if (ShouldSkipLine(line))
|
if (ShouldSkipLine(line))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (line.StartsWith(@"[", StringComparison.Ordinal) && line.EndsWith(@"]", StringComparison.Ordinal))
|
if (line.StartsWith('[') && line.EndsWith(']'))
|
||||||
{
|
{
|
||||||
if (!Enum.TryParse(line[1..^1], out section))
|
if (!Enum.TryParse(line[1..^1], out section))
|
||||||
{
|
{
|
||||||
|
@ -64,15 +64,16 @@ namespace osu.Game.Beatmaps.Formats
|
|||||||
private void handleEvents(string line)
|
private void handleEvents(string line)
|
||||||
{
|
{
|
||||||
var depth = 0;
|
var depth = 0;
|
||||||
var lineSpan = line.AsSpan();
|
|
||||||
|
|
||||||
while (lineSpan.StartsWith(" ", StringComparison.Ordinal) || lineSpan.StartsWith("_", StringComparison.Ordinal))
|
foreach (char c in line)
|
||||||
{
|
{
|
||||||
lineSpan = lineSpan.Slice(1);
|
if (c == ' ' || c == '_')
|
||||||
++depth;
|
depth++;
|
||||||
|
else
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
line = lineSpan.ToString();
|
line = line.Substring(depth);
|
||||||
|
|
||||||
decodeVariables(ref line);
|
decodeVariables(ref line);
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ namespace osu.Game.Beatmaps
|
|||||||
BeatmapSetInfo = beatmapInfo.BeatmapSet;
|
BeatmapSetInfo = beatmapInfo.BeatmapSet;
|
||||||
Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
|
Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
|
||||||
|
|
||||||
track = new RecyclableLazy<Track>(() => GetTrack() ?? GetVirtualTrack());
|
track = new RecyclableLazy<Track>(() => GetTrack() ?? GetVirtualTrack(1000));
|
||||||
background = new RecyclableLazy<Texture>(GetBackground, BackgroundStillValid);
|
background = new RecyclableLazy<Texture>(GetBackground, BackgroundStillValid);
|
||||||
waveform = new RecyclableLazy<Waveform>(GetWaveform);
|
waveform = new RecyclableLazy<Waveform>(GetWaveform);
|
||||||
storyboard = new RecyclableLazy<Storyboard>(GetStoryboard);
|
storyboard = new RecyclableLazy<Storyboard>(GetStoryboard);
|
||||||
@ -48,7 +48,7 @@ namespace osu.Game.Beatmaps
|
|||||||
total_count.Value++;
|
total_count.Value++;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual Track GetVirtualTrack()
|
protected virtual Track GetVirtualTrack(double emptyLength = 0)
|
||||||
{
|
{
|
||||||
const double excess_length = 1000;
|
const double excess_length = 1000;
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ namespace osu.Game.Beatmaps
|
|||||||
switch (lastObject)
|
switch (lastObject)
|
||||||
{
|
{
|
||||||
case null:
|
case null:
|
||||||
length = excess_length;
|
length = emptyLength;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IHasEndTime endTime:
|
case IHasEndTime endTime:
|
||||||
|
@ -78,7 +78,7 @@ namespace osu.Game.Configuration
|
|||||||
Set(OsuSetting.MenuParallax, true);
|
Set(OsuSetting.MenuParallax, true);
|
||||||
|
|
||||||
// Gameplay
|
// Gameplay
|
||||||
Set(OsuSetting.DimLevel, 0.3, 0, 1, 0.01);
|
Set(OsuSetting.DimLevel, 0.8, 0, 1, 0.01);
|
||||||
Set(OsuSetting.BlurLevel, 0, 0, 1, 0.01);
|
Set(OsuSetting.BlurLevel, 0, 0, 1, 0.01);
|
||||||
Set(OsuSetting.LightenDuringBreaks, true);
|
Set(OsuSetting.LightenDuringBreaks, true);
|
||||||
|
|
||||||
|
@ -59,9 +59,9 @@ namespace osu.Game.Graphics.Containers
|
|||||||
Track track = null;
|
Track track = null;
|
||||||
IBeatmap beatmap = null;
|
IBeatmap beatmap = null;
|
||||||
|
|
||||||
double currentTrackTime;
|
double currentTrackTime = 0;
|
||||||
TimingControlPoint timingPoint;
|
TimingControlPoint timingPoint = null;
|
||||||
EffectControlPoint effectPoint;
|
EffectControlPoint effectPoint = null;
|
||||||
|
|
||||||
if (Beatmap.Value.TrackLoaded && Beatmap.Value.BeatmapLoaded)
|
if (Beatmap.Value.TrackLoaded && Beatmap.Value.BeatmapLoaded)
|
||||||
{
|
{
|
||||||
@ -69,24 +69,18 @@ namespace osu.Game.Graphics.Containers
|
|||||||
beatmap = Beatmap.Value.Beatmap;
|
beatmap = Beatmap.Value.Beatmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (track != null && beatmap != null && track.IsRunning)
|
if (track != null && beatmap != null && track.IsRunning && track.Length > 0)
|
||||||
{
|
{
|
||||||
currentTrackTime = track.Length > 0 ? track.CurrentTime + EarlyActivationMilliseconds : Clock.CurrentTime;
|
currentTrackTime = track.CurrentTime + EarlyActivationMilliseconds;
|
||||||
|
|
||||||
timingPoint = beatmap.ControlPointInfo.TimingPointAt(currentTrackTime);
|
timingPoint = beatmap.ControlPointInfo.TimingPointAt(currentTrackTime);
|
||||||
effectPoint = beatmap.ControlPointInfo.EffectPointAt(currentTrackTime);
|
effectPoint = beatmap.ControlPointInfo.EffectPointAt(currentTrackTime);
|
||||||
|
|
||||||
if (timingPoint.BeatLength == 0)
|
|
||||||
{
|
|
||||||
IsBeatSyncedWithTrack = false;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
IsBeatSyncedWithTrack = true;
|
IsBeatSyncedWithTrack = timingPoint?.BeatLength > 0;
|
||||||
}
|
|
||||||
else
|
if (timingPoint == null || !IsBeatSyncedWithTrack)
|
||||||
{
|
{
|
||||||
IsBeatSyncedWithTrack = false;
|
|
||||||
currentTrackTime = Clock.CurrentTime;
|
currentTrackTime = Clock.CurrentTime;
|
||||||
timingPoint = defaultTiming;
|
timingPoint = defaultTiming;
|
||||||
effectPoint = defaultEffect;
|
effectPoint = defaultEffect;
|
||||||
|
@ -2,13 +2,18 @@
|
|||||||
// 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 osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
@ -59,5 +64,91 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: CalculatedTextSize) };
|
protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: CalculatedTextSize) };
|
||||||
|
|
||||||
|
protected override Caret CreateCaret() => new OsuCaret
|
||||||
|
{
|
||||||
|
CaretWidth = CaretWidth,
|
||||||
|
SelectionColour = SelectionColour,
|
||||||
|
};
|
||||||
|
|
||||||
|
private class OsuCaret : Caret
|
||||||
|
{
|
||||||
|
private const float caret_move_time = 60;
|
||||||
|
|
||||||
|
private readonly CaretBeatSyncedContainer beatSync;
|
||||||
|
|
||||||
|
public OsuCaret()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Y;
|
||||||
|
Size = new Vector2(1, 0.9f);
|
||||||
|
|
||||||
|
Colour = Color4.Transparent;
|
||||||
|
Anchor = Anchor.CentreLeft;
|
||||||
|
Origin = Anchor.CentreLeft;
|
||||||
|
|
||||||
|
Masking = true;
|
||||||
|
CornerRadius = 1;
|
||||||
|
InternalChild = beatSync = new CaretBeatSyncedContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Hide() => this.FadeOut(200);
|
||||||
|
|
||||||
|
public float CaretWidth { get; set; }
|
||||||
|
|
||||||
|
public Color4 SelectionColour { get; set; }
|
||||||
|
|
||||||
|
public override void DisplayAt(Vector2 position, float? selectionWidth)
|
||||||
|
{
|
||||||
|
beatSync.HasSelection = selectionWidth != null;
|
||||||
|
|
||||||
|
if (selectionWidth != null)
|
||||||
|
{
|
||||||
|
this.MoveTo(new Vector2(position.X, position.Y), 60, Easing.Out);
|
||||||
|
this.ResizeWidthTo(selectionWidth.Value + CaretWidth / 2, caret_move_time, Easing.Out);
|
||||||
|
this.FadeColour(SelectionColour, 200, Easing.Out);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.MoveTo(new Vector2(position.X - CaretWidth / 2, position.Y), 60, Easing.Out);
|
||||||
|
this.ResizeWidthTo(CaretWidth, caret_move_time, Easing.Out);
|
||||||
|
this.FadeColour(Color4.White, 200, Easing.Out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class CaretBeatSyncedContainer : BeatSyncedContainer
|
||||||
|
{
|
||||||
|
private bool hasSelection;
|
||||||
|
|
||||||
|
public bool HasSelection
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
hasSelection = value;
|
||||||
|
if (value)
|
||||||
|
|
||||||
|
this.FadeTo(0.5f, 200, Easing.Out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public CaretBeatSyncedContainer()
|
||||||
|
{
|
||||||
|
MinimumBeatLength = 300;
|
||||||
|
InternalChild = new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Color4.White,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
|
||||||
|
{
|
||||||
|
if (!hasSelection)
|
||||||
|
this.FadeTo(0.7f).FadeTo(0.4f, timingPoint.BeatLength, Easing.InOutSine);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Game.Utils;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
@ -29,10 +30,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours) => AccentColour = colours.BlueLighter;
|
private void load(OsuColour colours) => AccentColour = colours.BlueLighter;
|
||||||
|
|
||||||
protected override string FormatCount(double count)
|
protected override string FormatCount(double count) => count.FormatAccuracy();
|
||||||
{
|
|
||||||
return $@"{count:P2}";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override double GetProportionalDuration(double currentValue, double newValue)
|
protected override double GetProportionalDuration(double currentValue, double newValue)
|
||||||
{
|
{
|
||||||
|
@ -82,7 +82,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
new TableColumn("max combo", Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 70, maxSize: 90))
|
new TableColumn("max combo", Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 70, maxSize: 90))
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var statistic in score.Statistics)
|
foreach (var statistic in score.SortedStatistics)
|
||||||
columns.Add(new TableColumn(statistic.Key.GetDescription(), Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 50, maxSize: 70)));
|
columns.Add(new TableColumn(statistic.Key.GetDescription(), Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 50, maxSize: 70)));
|
||||||
|
|
||||||
columns.AddRange(new[]
|
columns.AddRange(new[]
|
||||||
@ -150,7 +150,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
foreach (var kvp in score.Statistics)
|
foreach (var kvp in score.SortedStatistics)
|
||||||
{
|
{
|
||||||
content.Add(new OsuSpriteText
|
content.Add(new OsuSpriteText
|
||||||
{
|
{
|
||||||
|
@ -99,9 +99,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
maxComboColumn.Text = $@"{value.MaxCombo:N0}x";
|
maxComboColumn.Text = $@"{value.MaxCombo:N0}x";
|
||||||
ppColumn.Text = $@"{value.PP:N0}";
|
ppColumn.Text = $@"{value.PP:N0}";
|
||||||
|
|
||||||
statisticsColumns.ChildrenEnumerable = value.Statistics
|
statisticsColumns.ChildrenEnumerable = value.SortedStatistics.Select(kvp => createStatisticsColumn(kvp.Key, kvp.Value));
|
||||||
.OrderByDescending(pair => pair.Key)
|
|
||||||
.Select(kvp => createStatisticsColumn(kvp.Key, kvp.Value));
|
|
||||||
modsColumn.Mods = value.Mods;
|
modsColumn.Mods = value.Mods;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,6 +151,8 @@ namespace osu.Game.Scoring
|
|||||||
[JsonProperty("statistics")]
|
[JsonProperty("statistics")]
|
||||||
public Dictionary<HitResult, int> Statistics = new Dictionary<HitResult, int>();
|
public Dictionary<HitResult, int> Statistics = new Dictionary<HitResult, int>();
|
||||||
|
|
||||||
|
public IOrderedEnumerable<KeyValuePair<HitResult, int>> SortedStatistics => Statistics.OrderByDescending(pair => pair.Key);
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
[Column("Statistics")]
|
[Column("Statistics")]
|
||||||
public string StatisticsJson
|
public string StatisticsJson
|
||||||
|
@ -9,6 +9,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Utils;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play.Break
|
namespace osu.Game.Screens.Play.Break
|
||||||
{
|
{
|
||||||
@ -85,6 +86,6 @@ namespace osu.Game.Screens.Play.Break
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string Format(double count) => $@"{count:P2}";
|
protected override string Format(double count) => count.FormatAccuracy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -188,7 +188,7 @@ namespace osu.Game.Screens.Ranking.Pages
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
statisticsContainer.ChildrenEnumerable = Score.Statistics.OrderByDescending(p => p.Key).Select(s => new DrawableScoreStatistic(s));
|
statisticsContainer.ChildrenEnumerable = Score.SortedStatistics.Select(s => new DrawableScoreStatistic(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
|
@ -7,18 +7,16 @@ namespace osu.Game.Utils
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Turns the provided accuracy into a percentage with 2 decimal places.
|
/// Turns the provided accuracy into a percentage with 2 decimal places.
|
||||||
/// Omits all decimal places when <paramref name="accuracy"/> equals 1d.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="accuracy">The accuracy to be formatted</param>
|
/// <param name="accuracy">The accuracy to be formatted</param>
|
||||||
/// <returns>formatted accuracy in percentage</returns>
|
/// <returns>formatted accuracy in percentage</returns>
|
||||||
public static string FormatAccuracy(this double accuracy) => accuracy == 1 ? "100%" : $"{accuracy:0.00%}";
|
public static string FormatAccuracy(this double accuracy) => $"{accuracy:0.00%}";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Turns the provided accuracy into a percentage with 2 decimal places.
|
/// Turns the provided accuracy into a percentage with 2 decimal places.
|
||||||
/// Omits all decimal places when <paramref name="accuracy"/> equals 100m.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="accuracy">The accuracy to be formatted</param>
|
/// <param name="accuracy">The accuracy to be formatted</param>
|
||||||
/// <returns>formatted accuracy in percentage</returns>
|
/// <returns>formatted accuracy in percentage</returns>
|
||||||
public static string FormatAccuracy(this decimal accuracy) => accuracy == 100 ? "100%" : $"{accuracy:0.00}%";
|
public static string FormatAccuracy(this decimal accuracy) => $"{accuracy:0.00}%";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user