mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 05:42:56 +08:00
Merge branch 'master' into chat-mention-highlight
This commit is contained in:
commit
cc87563d57
@ -7,5 +7,6 @@ namespace osu.Game.Rulesets.Catch.Scoring
|
||||
{
|
||||
public class CatchScoreProcessor : ScoreProcessor
|
||||
{
|
||||
protected override double ClassicScoreMultiplier => 28;
|
||||
}
|
||||
}
|
||||
|
@ -10,5 +10,7 @@ namespace osu.Game.Rulesets.Mania.Scoring
|
||||
protected override double DefaultAccuracyPortion => 0.99;
|
||||
|
||||
protected override double DefaultComboPortion => 0.01;
|
||||
|
||||
protected override double ClassicScoreMultiplier => 16;
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,8 @@ namespace osu.Game.Rulesets.Osu.Scoring
|
||||
{
|
||||
public class OsuScoreProcessor : ScoreProcessor
|
||||
{
|
||||
protected override double ClassicScoreMultiplier => 36;
|
||||
|
||||
protected override HitEvent CreateHitEvent(JudgementResult result)
|
||||
=> base.CreateHitEvent(result).With((result as OsuHitCircleJudgementResult)?.CursorPositionAtHit);
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
// 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 System;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@ -37,7 +38,7 @@ namespace osu.Game.Rulesets.Osu.Skinning.Default
|
||||
Child
|
||||
.FadeTo(flash_opacity, EarlyActivationMilliseconds, Easing.OutQuint)
|
||||
.Then()
|
||||
.FadeOut(timingPoint.BeatLength - fade_length, Easing.OutSine);
|
||||
.FadeOut(Math.Max(fade_length, timingPoint.BeatLength - fade_length), Easing.OutSine);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,5 +10,7 @@ namespace osu.Game.Rulesets.Taiko.Scoring
|
||||
protected override double DefaultAccuracyPortion => 0.75;
|
||||
|
||||
protected override double DefaultComboPortion => 0.25;
|
||||
|
||||
protected override double ClassicScoreMultiplier => 22;
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,20 @@ namespace osu.Game.Tests.Online
|
||||
[TestFixture]
|
||||
public class TestAPIModJsonSerialization
|
||||
{
|
||||
[Test]
|
||||
public void TestUnknownMod()
|
||||
{
|
||||
var apiMod = new APIMod { Acronym = "WNG" };
|
||||
|
||||
var deserialized = JsonConvert.DeserializeObject<APIMod>(JsonConvert.SerializeObject(apiMod));
|
||||
|
||||
var converted = deserialized?.ToMod(new TestRuleset());
|
||||
|
||||
Assert.That(converted, Is.TypeOf(typeof(UnknownMod)));
|
||||
Assert.That(converted?.Type, Is.EqualTo(ModType.System));
|
||||
Assert.That(converted?.Acronym, Is.EqualTo("WNG??"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAcronymIsPreserved()
|
||||
{
|
||||
|
@ -118,7 +118,7 @@ namespace osu.Game.Tests.Online
|
||||
[Test]
|
||||
public void TestBeatmapDownloadingFlow()
|
||||
{
|
||||
AddAssert("ensure beatmap unavailable", () => !beatmaps.IsAvailableLocally(testBeatmapSet));
|
||||
AddUntilStep("ensure beatmap unavailable", () => !beatmaps.IsAvailableLocally(testBeatmapSet));
|
||||
addAvailabilityCheckStep("state not downloaded", BeatmapAvailability.NotDownloaded);
|
||||
|
||||
AddStep("start downloading", () => beatmapDownloader.Download(testBeatmapSet));
|
||||
@ -132,7 +132,7 @@ namespace osu.Game.Tests.Online
|
||||
|
||||
AddStep("allow importing", () => beatmaps.AllowImport.SetResult(true));
|
||||
AddUntilStep("wait for import", () => beatmaps.CurrentImport != null);
|
||||
AddAssert("ensure beatmap available", () => beatmaps.IsAvailableLocally(testBeatmapSet));
|
||||
AddUntilStep("ensure beatmap available", () => beatmaps.IsAvailableLocally(testBeatmapSet));
|
||||
addAvailabilityCheckStep("state is locally available", BeatmapAvailability.LocallyAvailable);
|
||||
}
|
||||
|
||||
|
@ -6,11 +6,15 @@ using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Difficulty;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Osu.Judgements;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Tests.Beatmaps;
|
||||
|
||||
namespace osu.Game.Tests.Rulesets.Scoring
|
||||
@ -300,7 +304,26 @@ namespace osu.Game.Tests.Rulesets.Scoring
|
||||
HitObjects = { new TestHitObject(result) }
|
||||
});
|
||||
|
||||
Assert.That(scoreProcessor.GetImmediateScore(ScoringMode.Standardised, result.AffectsCombo() ? 1 : 0, statistic), Is.EqualTo(expectedScore).Within(0.5d));
|
||||
Assert.That(scoreProcessor.ComputeFinalScore(ScoringMode.Standardised, new ScoreInfo
|
||||
{
|
||||
Ruleset = new TestRuleset().RulesetInfo,
|
||||
MaxCombo = result.AffectsCombo() ? 1 : 0,
|
||||
Statistics = statistic
|
||||
}), Is.EqualTo(expectedScore).Within(0.5d));
|
||||
}
|
||||
|
||||
private class TestRuleset : Ruleset
|
||||
{
|
||||
public override IEnumerable<Mod> GetModsFor(ModType type) => throw new System.NotImplementedException();
|
||||
|
||||
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => throw new System.NotImplementedException();
|
||||
|
||||
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => throw new System.NotImplementedException();
|
||||
|
||||
public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => throw new System.NotImplementedException();
|
||||
|
||||
public override string Description => string.Empty;
|
||||
public override string ShortName => string.Empty;
|
||||
}
|
||||
|
||||
private class TestJudgement : Judgement
|
||||
|
@ -25,7 +25,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddUntilStep("wait for multiple judgements", () => ((FailPlayer)Player).ScoreProcessor.JudgedHits > 1);
|
||||
AddAssert("total number of results == 1", () =>
|
||||
{
|
||||
var score = new ScoreInfo();
|
||||
var score = new ScoreInfo { Ruleset = Ruleset.Value };
|
||||
|
||||
((FailPlayer)Player).ScoreProcessor.PopulateScore(score);
|
||||
|
||||
|
29
osu.Game.Tests/Visual/Gameplay/TestSceneUnknownMod.cs
Normal file
29
osu.Game.Tests/Visual/Gameplay/TestSceneUnknownMod.cs
Normal file
@ -0,0 +1,29 @@
|
||||
// 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.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
public class TestSceneUnknownMod : ModTestScene
|
||||
{
|
||||
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();
|
||||
|
||||
/// <summary>
|
||||
/// This test also covers the scenario of exiting Player after an unsuccessful beatmap load.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestUnknownModDoesntEnterGameplay()
|
||||
{
|
||||
CreateModTest(new ModTestData
|
||||
{
|
||||
Beatmap = CreateWorkingBeatmap(new OsuRuleset().RulesetInfo).Beatmap,
|
||||
Mod = new UnknownMod("WNG"),
|
||||
PassCondition = () => Player.IsLoaded && !Player.LoadedBeatmapSuccessfully
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -46,7 +46,10 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
var scoreProcessor = new OsuScoreProcessor();
|
||||
scoreProcessor.ApplyBeatmap(playable);
|
||||
|
||||
LoadComponentAsync(leaderboard = new MultiSpectatorLeaderboard(scoreProcessor, clocks.Keys.Select(id => new MultiplayerRoomUser(id)).ToArray()) { Expanded = { Value = true } }, Add);
|
||||
LoadComponentAsync(leaderboard = new MultiSpectatorLeaderboard(Ruleset.Value, scoreProcessor, clocks.Keys.Select(id => new MultiplayerRoomUser(id)).ToArray())
|
||||
{
|
||||
Expanded = { Value = true }
|
||||
}, Add);
|
||||
});
|
||||
|
||||
AddUntilStep("wait for load", () => leaderboard.IsLoaded);
|
||||
|
@ -69,7 +69,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
scoreProcessor.ApplyBeatmap(playableBeatmap);
|
||||
|
||||
LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(scoreProcessor, multiplayerUsers.ToArray())
|
||||
LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(Ruleset.Value, scoreProcessor, multiplayerUsers.ToArray())
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
@ -80,7 +80,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
scoreProcessor.ApplyBeatmap(playableBeatmap);
|
||||
|
||||
LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(scoreProcessor, multiplayerUsers.ToArray())
|
||||
LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(Ruleset.Value, scoreProcessor, multiplayerUsers.ToArray())
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
@ -133,7 +133,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
AddStep("confirm deletion", () => InputManager.Key(Key.Number1));
|
||||
AddUntilStep("wait for dialog dismissed", () => Game.Dependencies.Get<DialogOverlay>().CurrentDialog == null);
|
||||
|
||||
AddAssert("ensure score is pending deletion", () => Game.Realm.Run(r => r.Find<ScoreInfo>(score.ID)?.DeletePending == true));
|
||||
AddUntilStep("ensure score is pending deletion", () => Game.Realm.Run(r => r.Find<ScoreInfo>(score.ID)?.DeletePending == true));
|
||||
|
||||
AddUntilStep("wait for score panel removal", () => scorePanel.Parent == null);
|
||||
}
|
||||
@ -178,7 +178,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
AddStep("confirm deletion", () => InputManager.Key(Key.Number1));
|
||||
AddUntilStep("wait for dialog dismissed", () => Game.Dependencies.Get<DialogOverlay>().CurrentDialog == null);
|
||||
|
||||
AddAssert("ensure score is pending deletion", () => Game.Realm.Run(r => r.Find<ScoreInfo>(score.ID)?.DeletePending == true));
|
||||
AddUntilStep("ensure score is pending deletion", () => Game.Realm.Run(r => r.Find<ScoreInfo>(score.ID)?.DeletePending == true));
|
||||
|
||||
AddUntilStep("wait for score panel removal", () => scorePanel.Parent == null);
|
||||
}
|
||||
|
90
osu.Game.Tests/Visual/Online/TestSceneChannelListing.cs
Normal file
90
osu.Game.Tests/Visual/Online/TestSceneChannelListing.cs
Normal file
@ -0,0 +1,90 @@
|
||||
// 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 System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.Chat;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Chat.Listing;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestSceneChannelListing : OsuTestScene
|
||||
{
|
||||
[Cached]
|
||||
private readonly OverlayColourProvider overlayColours = new OverlayColourProvider(OverlayColourScheme.Pink);
|
||||
|
||||
private SearchTextBox search;
|
||||
private ChannelListing listing;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
Schedule(() =>
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
search = new SearchTextBox
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Width = 300,
|
||||
Margin = new MarginPadding { Top = 100 },
|
||||
},
|
||||
listing = new ChannelListing
|
||||
{
|
||||
Size = new Vector2(800, 400),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
};
|
||||
listing.Show();
|
||||
search.Current.ValueChanged += term => listing.SearchTerm = term.NewValue;
|
||||
});
|
||||
}
|
||||
|
||||
[SetUpSteps]
|
||||
public void SetUpSteps()
|
||||
{
|
||||
AddStep("Add Join/Leave callbacks", () =>
|
||||
{
|
||||
listing.OnRequestJoin += channel => channel.Joined.Value = true;
|
||||
listing.OnRequestLeave += channel => channel.Joined.Value = false;
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddRandomChannels()
|
||||
{
|
||||
AddStep("Add Random Channels", () =>
|
||||
{
|
||||
listing.UpdateAvailableChannels(createRandomChannels(20));
|
||||
});
|
||||
}
|
||||
|
||||
private Channel createRandomChannel()
|
||||
{
|
||||
int id = RNG.Next(0, 10000);
|
||||
return new Channel
|
||||
{
|
||||
Name = $"#channel-{id}",
|
||||
Topic = RNG.Next(4) < 3 ? $"We talk about the number {id} here" : null,
|
||||
Type = ChannelType.Public,
|
||||
Id = id,
|
||||
};
|
||||
}
|
||||
|
||||
private List<Channel> createRandomChannels(int num)
|
||||
=> Enumerable.Range(0, num)
|
||||
.Select(_ => createRandomChannel())
|
||||
.ToList();
|
||||
}
|
||||
}
|
@ -8,6 +8,7 @@ using Humanizer;
|
||||
using MessagePack;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
@ -51,7 +52,10 @@ namespace osu.Game.Online.API
|
||||
Mod resultMod = ruleset.CreateModFromAcronym(Acronym);
|
||||
|
||||
if (resultMod == null)
|
||||
throw new InvalidOperationException($"There is no mod in the ruleset ({ruleset.ShortName}) matching the acronym {Acronym}.");
|
||||
{
|
||||
Logger.Log($"There is no mod in the ruleset ({ruleset.ShortName}) matching the acronym {Acronym}.");
|
||||
return new UnknownMod(Acronym);
|
||||
}
|
||||
|
||||
if (Settings.Count > 0)
|
||||
{
|
||||
|
79
osu.Game/Overlays/Chat/Listing/ChannelListing.cs
Normal file
79
osu.Game/Overlays/Chat/Listing/ChannelListing.cs
Normal file
@ -0,0 +1,79 @@
|
||||
// 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.
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Online.Chat;
|
||||
|
||||
namespace osu.Game.Overlays.Chat.Listing
|
||||
{
|
||||
public class ChannelListing : VisibilityContainer
|
||||
{
|
||||
public event Action<Channel>? OnRequestJoin;
|
||||
public event Action<Channel>? OnRequestLeave;
|
||||
|
||||
public string SearchTerm
|
||||
{
|
||||
get => flow.SearchTerm;
|
||||
set => flow.SearchTerm = value;
|
||||
}
|
||||
|
||||
private SearchContainer<ChannelListingItem> flow = null!;
|
||||
|
||||
[Resolved]
|
||||
private OverlayColourProvider colourProvider { get; set; } = null!;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colourProvider.Background4,
|
||||
},
|
||||
new OsuScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ScrollbarAnchor = Anchor.TopRight,
|
||||
Child = flow = new SearchContainer<ChannelListingItem>
|
||||
{
|
||||
Direction = FillDirection.Vertical,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Vertical = 13,
|
||||
Horizontal = 15,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
public void UpdateAvailableChannels(IEnumerable<Channel> newChannels)
|
||||
{
|
||||
flow.ChildrenEnumerable = newChannels.Where(c => c.Type == ChannelType.Public)
|
||||
.Select(c => new ChannelListingItem(c));
|
||||
|
||||
foreach (var item in flow.Children)
|
||||
{
|
||||
item.OnRequestJoin += channel => OnRequestJoin?.Invoke(channel);
|
||||
item.OnRequestLeave += channel => OnRequestLeave?.Invoke(channel);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void PopIn() => this.FadeIn();
|
||||
|
||||
protected override void PopOut() => this.FadeOut();
|
||||
}
|
||||
}
|
173
osu.Game/Overlays/Chat/Listing/ChannelListingItem.cs
Normal file
173
osu.Game/Overlays/Chat/Listing/ChannelListingItem.cs
Normal file
@ -0,0 +1,173 @@
|
||||
// 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.
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Online.Chat;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Overlays.Chat.Listing
|
||||
{
|
||||
public class ChannelListingItem : OsuClickableContainer, IFilterable
|
||||
{
|
||||
public event Action<Channel>? OnRequestJoin;
|
||||
public event Action<Channel>? OnRequestLeave;
|
||||
|
||||
public bool FilteringActive { get; set; }
|
||||
public IEnumerable<string> FilterTerms => new[] { channel.Name, channel.Topic ?? string.Empty };
|
||||
public bool MatchingFilter { set => this.FadeTo(value ? 1f : 0f, 100); }
|
||||
|
||||
private readonly Channel channel;
|
||||
|
||||
private Box hoverBox = null!;
|
||||
private SpriteIcon checkbox = null!;
|
||||
private OsuSpriteText channelText = null!;
|
||||
private OsuSpriteText topicText = null!;
|
||||
private IBindable<bool> channelJoined = null!;
|
||||
|
||||
[Resolved]
|
||||
private OverlayColourProvider colourProvider { get; set; } = null!;
|
||||
|
||||
private const float text_size = 18;
|
||||
private const float icon_size = 14;
|
||||
|
||||
private const float vertical_margin = 1.5f;
|
||||
|
||||
public ChannelListingItem(Channel channel)
|
||||
{
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Masking = true;
|
||||
CornerRadius = 5;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = 20 + (vertical_margin * 2);
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
hoverBox = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colourProvider.Background3,
|
||||
Margin = new MarginPadding { Vertical = vertical_margin },
|
||||
Alpha = 0f,
|
||||
},
|
||||
new GridContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ColumnDimensions = new[]
|
||||
{
|
||||
new Dimension(GridSizeMode.Absolute, 40),
|
||||
new Dimension(GridSizeMode.Absolute, 200),
|
||||
new Dimension(GridSizeMode.Absolute, 400),
|
||||
new Dimension(GridSizeMode.AutoSize),
|
||||
new Dimension(),
|
||||
},
|
||||
Content = new[]
|
||||
{
|
||||
new Drawable[]
|
||||
{
|
||||
checkbox = new SpriteIcon
|
||||
{
|
||||
Alpha = 0,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Icon = FontAwesome.Solid.Check,
|
||||
Size = new Vector2(icon_size),
|
||||
},
|
||||
channelText = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Text = channel.Name,
|
||||
Font = OsuFont.Torus.With(size: text_size, weight: FontWeight.SemiBold),
|
||||
Margin = new MarginPadding { Bottom = 2 },
|
||||
},
|
||||
topicText = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Text = channel.Topic,
|
||||
Font = OsuFont.Torus.With(size: text_size),
|
||||
Margin = new MarginPadding { Bottom = 2 },
|
||||
},
|
||||
new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Icon = FontAwesome.Solid.User,
|
||||
Size = new Vector2(icon_size),
|
||||
Margin = new MarginPadding { Right = 5 },
|
||||
Colour = colourProvider.Light3,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Text = "0",
|
||||
Font = OsuFont.Torus.With(size: text_size),
|
||||
Margin = new MarginPadding { Bottom = 2 },
|
||||
Colour = colourProvider.Light3,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
channelJoined = channel.Joined.GetBoundCopy();
|
||||
channelJoined.BindValueChanged(change =>
|
||||
{
|
||||
const double duration = 500;
|
||||
|
||||
if (change.NewValue)
|
||||
{
|
||||
checkbox.FadeIn(duration, Easing.OutQuint);
|
||||
checkbox.ScaleTo(1f, duration, Easing.OutElastic);
|
||||
channelText.Colour = Colour4.White;
|
||||
topicText.Colour = Colour4.White;
|
||||
}
|
||||
else
|
||||
{
|
||||
checkbox.FadeOut(duration, Easing.OutQuint);
|
||||
checkbox.ScaleTo(0.8f, duration, Easing.OutQuint);
|
||||
channelText.Colour = colourProvider.Light3;
|
||||
topicText.Colour = colourProvider.Content2;
|
||||
}
|
||||
}, true);
|
||||
|
||||
Action = () => (channelJoined.Value ? OnRequestLeave : OnRequestJoin)?.Invoke(channel);
|
||||
}
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
hoverBox.Show();
|
||||
return base.OnHover(e);
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(HoverLostEvent e)
|
||||
{
|
||||
hoverBox.FadeOut(300, Easing.OutQuint);
|
||||
base.OnHoverLost(e);
|
||||
}
|
||||
}
|
||||
}
|
@ -162,7 +162,9 @@ namespace osu.Game.Overlays
|
||||
|
||||
Expanded.BindValueChanged(v =>
|
||||
{
|
||||
content.ClearTransforms();
|
||||
// clearing transforms can break autosizing, see: https://github.com/ppy/osu-framework/issues/5064
|
||||
if (v.NewValue != v.OldValue)
|
||||
content.ClearTransforms();
|
||||
|
||||
if (v.NewValue)
|
||||
content.AutoSizeAxes = Axes.Y;
|
||||
|
@ -63,9 +63,8 @@ namespace osu.Game.Rulesets.Difficulty
|
||||
|
||||
// calculate total score
|
||||
ScoreProcessor scoreProcessor = ruleset.CreateScoreProcessor();
|
||||
scoreProcessor.HighestCombo.Value = perfectPlay.MaxCombo;
|
||||
scoreProcessor.Mods.Value = perfectPlay.Mods;
|
||||
perfectPlay.TotalScore = (long)scoreProcessor.GetImmediateScore(ScoringMode.Standardised, perfectPlay.MaxCombo, statistics);
|
||||
perfectPlay.TotalScore = (long)scoreProcessor.ComputeFinalScore(ScoringMode.Standardised, perfectPlay);
|
||||
|
||||
// compute rank achieved
|
||||
// default to SS, then adjust the rank with mods
|
||||
|
29
osu.Game/Rulesets/Mods/UnknownMod.cs
Normal file
29
osu.Game/Rulesets/Mods/UnknownMod.cs
Normal file
@ -0,0 +1,29 @@
|
||||
// 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.
|
||||
|
||||
namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public class UnknownMod : Mod
|
||||
{
|
||||
/// <summary>
|
||||
/// The acronym of the mod which could not be resolved.
|
||||
/// </summary>
|
||||
public readonly string OriginalAcronym;
|
||||
|
||||
public override string Name => $"Unknown mod ({OriginalAcronym})";
|
||||
public override string Acronym => $"{OriginalAcronym}??";
|
||||
public override string Description => "This mod could not be resolved by the game.";
|
||||
public override double ScoreMultiplier => 0;
|
||||
|
||||
public override bool UserPlayable => false;
|
||||
|
||||
public override ModType Type => ModType.System;
|
||||
|
||||
public UnknownMod(string acronym)
|
||||
{
|
||||
OriginalAcronym = acronym;
|
||||
}
|
||||
|
||||
public override Mod DeepClone() => new UnknownMod(OriginalAcronym);
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
@ -76,6 +77,11 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// </summary>
|
||||
protected virtual double DefaultComboPortion => 0.7;
|
||||
|
||||
/// <summary>
|
||||
/// An arbitrary multiplier to scale scores in the <see cref="ScoringMode.Classic"/> scoring mode.
|
||||
/// </summary>
|
||||
protected virtual double ClassicScoreMultiplier => 36;
|
||||
|
||||
private readonly double accuracyPortion;
|
||||
private readonly double comboPortion;
|
||||
|
||||
@ -86,9 +92,23 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// </summary>
|
||||
private double maxBaseScore;
|
||||
|
||||
/// <summary>
|
||||
/// The maximum number of basic (non-tick and non-bonus) hitobjects.
|
||||
/// </summary>
|
||||
private int maxBasicHitObjects;
|
||||
|
||||
/// <summary>
|
||||
/// The maximum <see cref="HitResult"/> of a basic (non-tick and non-bonus) hitobject.
|
||||
/// Only populated via <see cref="ComputeFinalScore"/> or <see cref="ResetFromReplayFrame"/>.
|
||||
/// </summary>
|
||||
private HitResult? maxBasicResult;
|
||||
|
||||
private double rollingMaxBaseScore;
|
||||
private double baseScore;
|
||||
private int basicHitObjects;
|
||||
private bool beatmapApplied;
|
||||
|
||||
private readonly Dictionary<HitResult, int> scoreResultCounts = new Dictionary<HitResult, int>();
|
||||
private readonly List<HitEvent> hitEvents = new List<HitEvent>();
|
||||
private HitObject lastHitObject;
|
||||
|
||||
@ -122,7 +142,11 @@ namespace osu.Game.Rulesets.Scoring
|
||||
};
|
||||
}
|
||||
|
||||
private readonly Dictionary<HitResult, int> scoreResultCounts = new Dictionary<HitResult, int>();
|
||||
public override void ApplyBeatmap(IBeatmap beatmap)
|
||||
{
|
||||
base.ApplyBeatmap(beatmap);
|
||||
beatmapApplied = true;
|
||||
}
|
||||
|
||||
protected sealed override void ApplyResultInternal(JudgementResult result)
|
||||
{
|
||||
@ -160,6 +184,9 @@ namespace osu.Game.Rulesets.Scoring
|
||||
rollingMaxBaseScore += result.Judgement.MaxNumericResult;
|
||||
}
|
||||
|
||||
if (result.Type.IsBasic())
|
||||
basicHitObjects++;
|
||||
|
||||
hitEvents.Add(CreateHitEvent(result));
|
||||
lastHitObject = result.HitObject;
|
||||
|
||||
@ -195,6 +222,9 @@ namespace osu.Game.Rulesets.Scoring
|
||||
rollingMaxBaseScore -= result.Judgement.MaxNumericResult;
|
||||
}
|
||||
|
||||
if (result.Type.IsBasic())
|
||||
basicHitObjects--;
|
||||
|
||||
Debug.Assert(hitEvents.Count > 0);
|
||||
lastHitObject = hitEvents[^1].LastHitObject;
|
||||
hitEvents.RemoveAt(hitEvents.Count - 1);
|
||||
@ -204,29 +234,113 @@ namespace osu.Game.Rulesets.Scoring
|
||||
|
||||
private void updateScore()
|
||||
{
|
||||
if (rollingMaxBaseScore != 0)
|
||||
Accuracy.Value = calculateAccuracyRatio(baseScore, true);
|
||||
double rollingAccuracyRatio = rollingMaxBaseScore > 0 ? baseScore / rollingMaxBaseScore : 1;
|
||||
double accuracyRatio = maxBaseScore > 0 ? baseScore / maxBaseScore : 1;
|
||||
double comboRatio = maxAchievableCombo > 0 ? (double)HighestCombo.Value / maxAchievableCombo : 1;
|
||||
|
||||
TotalScore.Value = getScore(Mode.Value);
|
||||
}
|
||||
|
||||
private double getScore(ScoringMode mode)
|
||||
{
|
||||
return GetScore(mode,
|
||||
calculateAccuracyRatio(baseScore),
|
||||
calculateComboRatio(HighestCombo.Value),
|
||||
scoreResultCounts);
|
||||
Accuracy.Value = rollingAccuracyRatio;
|
||||
TotalScore.Value = ComputeScore(Mode.Value, accuracyRatio, comboRatio, getBonusScore(scoreResultCounts), maxBasicHitObjects);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Computes the total score.
|
||||
/// Computes the total score of a given finalised <see cref="ScoreInfo"/>. This should be used when a score is known to be complete.
|
||||
/// </summary>
|
||||
/// <param name="mode">The <see cref="ScoringMode"/> to compute the total score in.</param>
|
||||
/// <remarks>
|
||||
/// Does not require <see cref="JudgementProcessor.ApplyBeatmap"/> to have been called before use.
|
||||
/// </remarks>
|
||||
/// <param name="mode">The <see cref="ScoringMode"/> to represent the score as.</param>
|
||||
/// <param name="scoreInfo">The <see cref="ScoreInfo"/> to compute the total score of.</param>
|
||||
/// <returns>The total score in the given <see cref="ScoringMode"/>.</returns>
|
||||
public double ComputeFinalScore(ScoringMode mode, ScoreInfo scoreInfo)
|
||||
{
|
||||
extractFromStatistics(scoreInfo.Ruleset.CreateInstance(),
|
||||
scoreInfo.Statistics,
|
||||
out double extractedBaseScore,
|
||||
out double extractedMaxBaseScore,
|
||||
out int extractedMaxCombo,
|
||||
out int extractedBasicHitObjects);
|
||||
|
||||
double accuracyRatio = extractedMaxBaseScore > 0 ? extractedBaseScore / extractedMaxBaseScore : 1;
|
||||
double comboRatio = extractedMaxCombo > 0 ? (double)scoreInfo.MaxCombo / extractedMaxCombo : 1;
|
||||
|
||||
return ComputeScore(mode, accuracyRatio, comboRatio, getBonusScore(scoreInfo.Statistics), extractedBasicHitObjects);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Computes the total score of a partially-completed <see cref="ScoreInfo"/>. This should be used when it is unknown whether a score is complete.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Requires <see cref="JudgementProcessor.ApplyBeatmap"/> to have been called before use.
|
||||
/// </remarks>
|
||||
/// <param name="mode">The <see cref="ScoringMode"/> to represent the score as.</param>
|
||||
/// <param name="scoreInfo">The <see cref="ScoreInfo"/> to compute the total score of.</param>
|
||||
/// <returns>The total score in the given <see cref="ScoringMode"/>.</returns>
|
||||
public double ComputePartialScore(ScoringMode mode, ScoreInfo scoreInfo)
|
||||
{
|
||||
if (!beatmapApplied)
|
||||
throw new InvalidOperationException($"Cannot compute partial score without calling {nameof(ApplyBeatmap)}.");
|
||||
|
||||
extractFromStatistics(scoreInfo.Ruleset.CreateInstance(),
|
||||
scoreInfo.Statistics,
|
||||
out double extractedBaseScore,
|
||||
out _,
|
||||
out _,
|
||||
out _);
|
||||
|
||||
double accuracyRatio = maxBaseScore > 0 ? extractedBaseScore / maxBaseScore : 1;
|
||||
double comboRatio = maxAchievableCombo > 0 ? (double)scoreInfo.MaxCombo / maxAchievableCombo : 1;
|
||||
|
||||
return ComputeScore(mode, accuracyRatio, comboRatio, getBonusScore(scoreInfo.Statistics), maxBasicHitObjects);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Computes the total score of a given <see cref="ScoreInfo"/> with a given custom max achievable combo.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is useful for processing legacy scores in which the maximum achievable combo can be more accurately determined via external means (e.g. database values or difficulty calculation).
|
||||
/// <p>Does not require <see cref="JudgementProcessor.ApplyBeatmap"/> to have been called before use.</p>
|
||||
/// </remarks>
|
||||
/// <param name="mode">The <see cref="ScoringMode"/> to represent the score as.</param>
|
||||
/// <param name="scoreInfo">The <see cref="ScoreInfo"/> to compute the total score of.</param>
|
||||
/// <param name="maxAchievableCombo">The maximum achievable combo for the provided beatmap.</param>
|
||||
/// <returns>The total score in the given <see cref="ScoringMode"/>.</returns>
|
||||
public double ComputeFinalLegacyScore(ScoringMode mode, ScoreInfo scoreInfo, int maxAchievableCombo)
|
||||
{
|
||||
double accuracyRatio = scoreInfo.Accuracy;
|
||||
double comboRatio = maxAchievableCombo > 0 ? (double)scoreInfo.MaxCombo / maxAchievableCombo : 1;
|
||||
|
||||
// For legacy osu!mania scores, a full-GREAT score has 100% accuracy. If combined with a full-combo, the score becomes indistinguishable from a full-PERFECT score.
|
||||
// To get around this, the accuracy ratio is always recalculated based on the hit statistics rather than trusting the score.
|
||||
// Note: This cannot be applied universally to all legacy scores, as some rulesets (e.g. catch) group multiple judgements together.
|
||||
if (scoreInfo.IsLegacyScore && scoreInfo.Ruleset.OnlineID == 3)
|
||||
{
|
||||
extractFromStatistics(
|
||||
scoreInfo.Ruleset.CreateInstance(),
|
||||
scoreInfo.Statistics,
|
||||
out double computedBaseScore,
|
||||
out double computedMaxBaseScore,
|
||||
out _,
|
||||
out _);
|
||||
|
||||
if (computedMaxBaseScore > 0)
|
||||
accuracyRatio = computedBaseScore / computedMaxBaseScore;
|
||||
}
|
||||
|
||||
int computedBasicHitObjects = scoreInfo.Statistics.Where(kvp => kvp.Key.IsBasic()).Select(kvp => kvp.Value).Sum();
|
||||
|
||||
return ComputeScore(mode, accuracyRatio, comboRatio, getBonusScore(scoreInfo.Statistics), computedBasicHitObjects);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Computes the total score from individual scoring components.
|
||||
/// </summary>
|
||||
/// <param name="mode">The <see cref="ScoringMode"/> to represent the score as.</param>
|
||||
/// <param name="accuracyRatio">The accuracy percentage achieved by the player.</param>
|
||||
/// <param name="comboRatio">The proportion of the max combo achieved by the player.</param>
|
||||
/// <param name="statistics">Any statistics to be factored in.</param>
|
||||
/// <returns>The total score.</returns>
|
||||
public double GetScore(ScoringMode mode, double accuracyRatio, double comboRatio, Dictionary<HitResult, int> statistics)
|
||||
/// <param name="comboRatio">The portion of the max combo achieved by the player.</param>
|
||||
/// <param name="bonusScore">The total bonus score.</param>
|
||||
/// <param name="totalBasicHitObjects">The total number of basic (non-tick and non-bonus) hitobjects in the beatmap.</param>
|
||||
/// <returns>The total score computed from the given scoring component ratios.</returns>
|
||||
public double ComputeScore(ScoringMode mode, double accuracyRatio, double comboRatio, double bonusScore, int totalBasicHitObjects)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
@ -234,62 +348,22 @@ namespace osu.Game.Rulesets.Scoring
|
||||
case ScoringMode.Standardised:
|
||||
double accuracyScore = accuracyPortion * accuracyRatio;
|
||||
double comboScore = comboPortion * comboRatio;
|
||||
return (max_score * (accuracyScore + comboScore) + getBonusScore(statistics)) * scoreMultiplier;
|
||||
return (max_score * (accuracyScore + comboScore) + bonusScore) * scoreMultiplier;
|
||||
|
||||
case ScoringMode.Classic:
|
||||
int totalHitObjects = statistics.Where(k => k.Key >= HitResult.Miss && k.Key <= HitResult.Perfect).Sum(k => k.Value);
|
||||
|
||||
// If there are no hitobjects then the beatmap can be composed of only ticks or spinners, so ensure we don't multiply by 0 at all times.
|
||||
if (totalHitObjects == 0)
|
||||
totalHitObjects = 1;
|
||||
|
||||
// This gives a similar feeling to osu!stable scoring (ScoreV1) while keeping classic scoring as only a constant multiple of standardised scoring.
|
||||
// The invariant is important to ensure that scores don't get re-ordered on leaderboards between the two scoring modes.
|
||||
double scaledStandardised = GetScore(ScoringMode.Standardised, accuracyRatio, comboRatio, statistics) / max_score;
|
||||
return Math.Pow(scaledStandardised * totalHitObjects, 2) * 36;
|
||||
double scaledStandardised = ComputeScore(ScoringMode.Standardised, accuracyRatio, comboRatio, bonusScore, totalBasicHitObjects) / max_score;
|
||||
return Math.Pow(scaledStandardised * Math.Max(1, totalBasicHitObjects), 2) * ClassicScoreMultiplier;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Given a minimal set of inputs, return the computed score for the tracked beatmap / mods combination, at the current point in time.
|
||||
/// Calculates the total bonus score from score statistics.
|
||||
/// </summary>
|
||||
/// <param name="mode">The <see cref="ScoringMode"/> to compute the total score in.</param>
|
||||
/// <param name="maxCombo">The maximum combo achievable in the beatmap.</param>
|
||||
/// <param name="statistics">Statistics to be used for calculating accuracy, bonus score, etc.</param>
|
||||
/// <returns>The computed score for provided inputs.</returns>
|
||||
public double GetImmediateScore(ScoringMode mode, int maxCombo, Dictionary<HitResult, int> statistics)
|
||||
{
|
||||
// calculate base score from statistics pairs
|
||||
int computedBaseScore = 0;
|
||||
|
||||
foreach (var pair in statistics)
|
||||
{
|
||||
if (!pair.Key.AffectsAccuracy())
|
||||
continue;
|
||||
|
||||
computedBaseScore += Judgement.ToNumericResult(pair.Key) * pair.Value;
|
||||
}
|
||||
|
||||
return GetScore(mode, calculateAccuracyRatio(computedBaseScore), calculateComboRatio(maxCombo), statistics);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the accuracy fraction for the provided base score.
|
||||
/// </summary>
|
||||
/// <param name="baseScore">The score to be used for accuracy calculation.</param>
|
||||
/// <param name="preferRolling">Whether the rolling base score should be used (ie. for the current point in time based on Apply/Reverted results).</param>
|
||||
/// <returns>The computed accuracy.</returns>
|
||||
private double calculateAccuracyRatio(double baseScore, bool preferRolling = false)
|
||||
{
|
||||
if (preferRolling && rollingMaxBaseScore != 0)
|
||||
return baseScore / rollingMaxBaseScore;
|
||||
|
||||
return maxBaseScore > 0 ? baseScore / maxBaseScore : 1;
|
||||
}
|
||||
|
||||
private double calculateComboRatio(int maxCombo) => maxAchievableCombo > 0 ? (double)maxCombo / maxAchievableCombo : 1;
|
||||
|
||||
private double getBonusScore(Dictionary<HitResult, int> statistics)
|
||||
/// <param name="statistics">The score statistics.</param>
|
||||
/// <returns>The total bonus score.</returns>
|
||||
private double getBonusScore(IReadOnlyDictionary<HitResult, int> statistics)
|
||||
=> statistics.GetValueOrDefault(HitResult.SmallBonus) * Judgement.SMALL_BONUS_SCORE
|
||||
+ statistics.GetValueOrDefault(HitResult.LargeBonus) * Judgement.LARGE_BONUS_SCORE;
|
||||
|
||||
@ -311,8 +385,6 @@ namespace osu.Game.Rulesets.Scoring
|
||||
|
||||
public int GetStatistic(HitResult result) => scoreResultCounts.GetValueOrDefault(result);
|
||||
|
||||
public double GetStandardisedScore() => getScore(ScoringMode.Standardised);
|
||||
|
||||
/// <summary>
|
||||
/// Resets this ScoreProcessor to a default state.
|
||||
/// </summary>
|
||||
@ -329,10 +401,12 @@ namespace osu.Game.Rulesets.Scoring
|
||||
{
|
||||
maxAchievableCombo = HighestCombo.Value;
|
||||
maxBaseScore = baseScore;
|
||||
maxBasicHitObjects = basicHitObjects;
|
||||
}
|
||||
|
||||
baseScore = 0;
|
||||
rollingMaxBaseScore = 0;
|
||||
basicHitObjects = 0;
|
||||
|
||||
TotalScore.Value = 0;
|
||||
Accuracy.Value = 1;
|
||||
@ -346,23 +420,19 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// </summary>
|
||||
public virtual void PopulateScore(ScoreInfo score)
|
||||
{
|
||||
score.TotalScore = (long)Math.Round(GetStandardisedScore());
|
||||
score.Combo = Combo.Value;
|
||||
score.MaxCombo = HighestCombo.Value;
|
||||
score.Accuracy = Accuracy.Value;
|
||||
score.Rank = Rank.Value;
|
||||
score.HitEvents = hitEvents;
|
||||
|
||||
foreach (var result in HitResultExtensions.ALL_TYPES)
|
||||
score.Statistics[result] = GetStatistic(result);
|
||||
|
||||
score.HitEvents = hitEvents;
|
||||
// Populate total score after everything else.
|
||||
score.TotalScore = (long)Math.Round(ComputeFinalScore(ScoringMode.Standardised, score));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Maximum <see cref="HitResult"/> for a normal hit (i.e. not tick/bonus) for this ruleset. Only populated via <see cref="ResetFromReplayFrame"/>.
|
||||
/// </summary>
|
||||
private HitResult? maxNormalResult;
|
||||
|
||||
public override void ResetFromReplayFrame(Ruleset ruleset, ReplayFrame frame)
|
||||
{
|
||||
base.ResetFromReplayFrame(ruleset, frame);
|
||||
@ -370,11 +440,26 @@ namespace osu.Game.Rulesets.Scoring
|
||||
if (frame.Header == null)
|
||||
return;
|
||||
|
||||
baseScore = 0;
|
||||
rollingMaxBaseScore = 0;
|
||||
extractFromStatistics(ruleset, frame.Header.Statistics, out baseScore, out rollingMaxBaseScore, out _, out _);
|
||||
HighestCombo.Value = frame.Header.MaxCombo;
|
||||
|
||||
foreach ((HitResult result, int count) in frame.Header.Statistics)
|
||||
scoreResultCounts.Clear();
|
||||
scoreResultCounts.AddRange(frame.Header.Statistics);
|
||||
|
||||
updateScore();
|
||||
|
||||
OnResetFromReplayFrame?.Invoke();
|
||||
}
|
||||
|
||||
private void extractFromStatistics(Ruleset ruleset, IReadOnlyDictionary<HitResult, int> statistics, out double baseScore, out double maxBaseScore, out int maxCombo,
|
||||
out int basicHitObjects)
|
||||
{
|
||||
baseScore = 0;
|
||||
maxBaseScore = 0;
|
||||
maxCombo = 0;
|
||||
basicHitObjects = 0;
|
||||
|
||||
foreach ((HitResult result, int count) in statistics)
|
||||
{
|
||||
// Bonus scores are counted separately directly from the statistics dictionary later on.
|
||||
if (!result.IsScorable() || result.IsBonus())
|
||||
@ -397,20 +482,19 @@ namespace osu.Game.Rulesets.Scoring
|
||||
break;
|
||||
|
||||
default:
|
||||
maxResult = maxNormalResult ??= ruleset.GetHitResults().OrderByDescending(kvp => Judgement.ToNumericResult(kvp.result)).First().result;
|
||||
maxResult = maxBasicResult ??= ruleset.GetHitResults().OrderByDescending(kvp => Judgement.ToNumericResult(kvp.result)).First().result;
|
||||
break;
|
||||
}
|
||||
|
||||
baseScore += count * Judgement.ToNumericResult(result);
|
||||
rollingMaxBaseScore += count * Judgement.ToNumericResult(maxResult);
|
||||
maxBaseScore += count * Judgement.ToNumericResult(maxResult);
|
||||
|
||||
if (result.AffectsCombo())
|
||||
maxCombo += count;
|
||||
|
||||
if (result.IsBasic())
|
||||
basicHitObjects += count;
|
||||
}
|
||||
|
||||
scoreResultCounts.Clear();
|
||||
scoreResultCounts.AddRange(frame.Header.Statistics);
|
||||
|
||||
updateScore();
|
||||
|
||||
OnResetFromReplayFrame?.Invoke();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
|
@ -18,7 +18,6 @@ using osu.Game.Database;
|
||||
using osu.Game.IO.Archives;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Scoring
|
||||
@ -136,21 +135,9 @@ namespace osu.Game.Scoring
|
||||
return score.TotalScore;
|
||||
|
||||
int beatmapMaxCombo;
|
||||
double accuracy = score.Accuracy;
|
||||
|
||||
if (score.IsLegacyScore)
|
||||
{
|
||||
if (score.RulesetID == 3)
|
||||
{
|
||||
// In osu!stable, a full-GREAT score has 100% accuracy in mania. Along with a full combo, the score becomes indistinguishable from a full-PERFECT score.
|
||||
// To get around this, recalculate accuracy based on the hit statistics.
|
||||
// Note: This cannot be applied universally to all legacy scores, as some rulesets (e.g. catch) group multiple judgements together.
|
||||
double maxBaseScore = score.Statistics.Select(kvp => kvp.Value).Sum() * Judgement.ToNumericResult(HitResult.Perfect);
|
||||
double baseScore = score.Statistics.Select(kvp => Judgement.ToNumericResult(kvp.Key) * kvp.Value).Sum();
|
||||
if (maxBaseScore > 0)
|
||||
accuracy = baseScore / maxBaseScore;
|
||||
}
|
||||
|
||||
// This score is guaranteed to be an osu!stable score.
|
||||
// The combo must be determined through either the beatmap's max combo value or the difficulty calculator, as lazer's scoring has changed and the score statistics cannot be used.
|
||||
if (score.BeatmapInfo.MaxCombo != null)
|
||||
@ -184,7 +171,7 @@ namespace osu.Game.Scoring
|
||||
var scoreProcessor = ruleset.CreateScoreProcessor();
|
||||
scoreProcessor.Mods.Value = score.Mods;
|
||||
|
||||
return (long)Math.Round(scoreProcessor.GetScore(mode, accuracy, (double)score.MaxCombo / beatmapMaxCombo, score.Statistics));
|
||||
return (long)Math.Round(scoreProcessor.ComputeFinalLegacyScore(mode, score, beatmapMaxCombo));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -73,6 +73,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
|
||||
SelectionHandler = CreateSelectionHandler();
|
||||
SelectionHandler.DeselectAll = deselectAll;
|
||||
SelectionHandler.SelectedItems.BindTo(SelectedItems);
|
||||
|
||||
AddRangeInternal(new[]
|
||||
{
|
||||
|
@ -29,11 +29,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
// bring in updates from selection changes
|
||||
EditorBeatmap.HitObjectUpdated += _ => Scheduler.AddOnce(UpdateTernaryStates);
|
||||
|
||||
SelectedItems.BindTo(EditorBeatmap.SelectedHitObjects);
|
||||
SelectedItems.CollectionChanged += (sender, args) =>
|
||||
{
|
||||
Scheduler.AddOnce(UpdateTernaryStates);
|
||||
};
|
||||
SelectedItems.CollectionChanged += (sender, args) => Scheduler.AddOnce(UpdateTernaryStates);
|
||||
}
|
||||
|
||||
protected override void DeleteItems(IEnumerable<HitObject> items) => EditorBeatmap.RemoveRange(items);
|
||||
|
@ -10,6 +10,7 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Online.Rooms;
|
||||
@ -76,7 +77,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
});
|
||||
|
||||
// todo: this should be implemented via a custom HUD implementation, and correctly masked to the main content area.
|
||||
LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(ScoreProcessor, users), l =>
|
||||
LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(GameplayState.Ruleset.RulesetInfo, ScoreProcessor, users), l =>
|
||||
{
|
||||
if (!LoadedBeatmapSuccessfully)
|
||||
return;
|
||||
@ -171,11 +172,25 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
|
||||
private void onMatchStarted() => Scheduler.Add(() =>
|
||||
{
|
||||
if (!this.IsCurrentScreen())
|
||||
return;
|
||||
|
||||
loadingDisplay.Hide();
|
||||
base.StartGameplay();
|
||||
});
|
||||
|
||||
private void onResultsReady() => resultsReady.SetResult(true);
|
||||
private void onResultsReady()
|
||||
{
|
||||
// Schedule is required to ensure that `TaskCompletionSource.SetResult` is not called more than once.
|
||||
// A scenario where this can occur is if this instance is not immediately disposed (ie. async disposal queue).
|
||||
Schedule(() =>
|
||||
{
|
||||
if (!this.IsCurrentScreen())
|
||||
return;
|
||||
|
||||
resultsReady.SetResult(true);
|
||||
});
|
||||
}
|
||||
|
||||
protected override async Task PrepareScoreForResultsAsync(Score score)
|
||||
{
|
||||
|
@ -5,6 +5,7 @@ using System;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
|
||||
@ -12,8 +13,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
{
|
||||
public class MultiSpectatorLeaderboard : MultiplayerGameplayLeaderboard
|
||||
{
|
||||
public MultiSpectatorLeaderboard([NotNull] ScoreProcessor scoreProcessor, MultiplayerRoomUser[] users)
|
||||
: base(scoreProcessor, users)
|
||||
public MultiSpectatorLeaderboard(RulesetInfo ruleset, [NotNull] ScoreProcessor scoreProcessor, MultiplayerRoomUser[] users)
|
||||
: base(ruleset, scoreProcessor, users)
|
||||
{
|
||||
}
|
||||
|
||||
@ -33,7 +34,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
((SpectatingTrackedUserData)data).Clock = null;
|
||||
}
|
||||
|
||||
protected override TrackedUserData CreateUserData(MultiplayerRoomUser user, ScoreProcessor scoreProcessor) => new SpectatingTrackedUserData(user, scoreProcessor);
|
||||
protected override TrackedUserData CreateUserData(MultiplayerRoomUser user, RulesetInfo ruleset, ScoreProcessor scoreProcessor) => new SpectatingTrackedUserData(user, ruleset, scoreProcessor);
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
@ -48,8 +49,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
[CanBeNull]
|
||||
public IClock Clock;
|
||||
|
||||
public SpectatingTrackedUserData(MultiplayerRoomUser user, ScoreProcessor scoreProcessor)
|
||||
: base(user, scoreProcessor)
|
||||
public SpectatingTrackedUserData(MultiplayerRoomUser user, RulesetInfo ruleset, ScoreProcessor scoreProcessor)
|
||||
: base(user, ruleset, scoreProcessor)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
var scoreProcessor = Ruleset.Value.CreateInstance().CreateScoreProcessor();
|
||||
scoreProcessor.ApplyBeatmap(playableBeatmap);
|
||||
|
||||
LoadComponentAsync(leaderboard = new MultiSpectatorLeaderboard(scoreProcessor, users)
|
||||
LoadComponentAsync(leaderboard = new MultiSpectatorLeaderboard(Ruleset.Value, scoreProcessor, users)
|
||||
{
|
||||
Expanded = { Value = true },
|
||||
}, l =>
|
||||
|
@ -11,6 +11,7 @@ using osu.Framework.Screens;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Ranking;
|
||||
@ -64,7 +65,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
||||
{
|
||||
await base.PrepareScoreForResultsAsync(score).ConfigureAwait(false);
|
||||
|
||||
Score.ScoreInfo.TotalScore = (int)Math.Round(ScoreProcessor.GetStandardisedScore());
|
||||
Score.ScoreInfo.TotalScore = (int)Math.Round(ScoreProcessor.ComputeFinalScore(ScoringMode.Standardised, Score.ScoreInfo));
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
|
@ -17,7 +17,9 @@ using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Online.Multiplayer.MatchTypes.TeamVersus;
|
||||
using osu.Game.Online.Spectator;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
@ -41,6 +43,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
[Resolved]
|
||||
private UserLookupCache userLookupCache { get; set; }
|
||||
|
||||
private readonly RulesetInfo ruleset;
|
||||
private readonly ScoreProcessor scoreProcessor;
|
||||
private readonly MultiplayerRoomUser[] playingUsers;
|
||||
private Bindable<ScoringMode> scoringMode;
|
||||
@ -52,11 +55,13 @@ namespace osu.Game.Screens.Play.HUD
|
||||
/// <summary>
|
||||
/// Construct a new leaderboard.
|
||||
/// </summary>
|
||||
/// <param name="ruleset">The ruleset.</param>
|
||||
/// <param name="scoreProcessor">A score processor instance to handle score calculation for scores of users in the match.</param>
|
||||
/// <param name="users">IDs of all users in this match.</param>
|
||||
public MultiplayerGameplayLeaderboard(ScoreProcessor scoreProcessor, MultiplayerRoomUser[] users)
|
||||
public MultiplayerGameplayLeaderboard(RulesetInfo ruleset, ScoreProcessor scoreProcessor, MultiplayerRoomUser[] users)
|
||||
{
|
||||
// todo: this will eventually need to be created per user to support different mod combinations.
|
||||
this.ruleset = ruleset;
|
||||
this.scoreProcessor = scoreProcessor;
|
||||
|
||||
playingUsers = users;
|
||||
@ -69,7 +74,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
foreach (var user in playingUsers)
|
||||
{
|
||||
var trackedUser = CreateUserData(user, scoreProcessor);
|
||||
var trackedUser = CreateUserData(user, ruleset, scoreProcessor);
|
||||
trackedUser.ScoringMode.BindTo(scoringMode);
|
||||
UserScores[user.UserID] = trackedUser;
|
||||
|
||||
@ -119,7 +124,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
spectatorClient.OnNewFrames += handleIncomingFrames;
|
||||
}
|
||||
|
||||
protected virtual TrackedUserData CreateUserData(MultiplayerRoomUser user, ScoreProcessor scoreProcessor) => new TrackedUserData(user, scoreProcessor);
|
||||
protected virtual TrackedUserData CreateUserData(MultiplayerRoomUser user, RulesetInfo ruleset, ScoreProcessor scoreProcessor) => new TrackedUserData(user, ruleset, scoreProcessor);
|
||||
|
||||
protected override GameplayLeaderboardScore CreateLeaderboardScoreDrawable(APIUser user, bool isTracked)
|
||||
{
|
||||
@ -222,8 +227,12 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
public int? Team => (User.MatchState as TeamVersusUserState)?.TeamID;
|
||||
|
||||
public TrackedUserData(MultiplayerRoomUser user, ScoreProcessor scoreProcessor)
|
||||
private readonly RulesetInfo ruleset;
|
||||
|
||||
public TrackedUserData(MultiplayerRoomUser user, RulesetInfo ruleset, ScoreProcessor scoreProcessor)
|
||||
{
|
||||
this.ruleset = ruleset;
|
||||
|
||||
User = user;
|
||||
ScoreProcessor = scoreProcessor;
|
||||
|
||||
@ -244,7 +253,13 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
var header = frame.Header;
|
||||
|
||||
Score.Value = ScoreProcessor.GetImmediateScore(ScoringMode.Value, header.MaxCombo, header.Statistics);
|
||||
Score.Value = ScoreProcessor.ComputePartialScore(ScoringMode.Value, new ScoreInfo
|
||||
{
|
||||
Ruleset = ruleset,
|
||||
MaxCombo = header.MaxCombo,
|
||||
Statistics = header.Statistics
|
||||
});
|
||||
|
||||
Accuracy.Value = header.Accuracy;
|
||||
CurrentCombo.Value = header.Combo;
|
||||
}
|
||||
|
@ -185,6 +185,12 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
var gameplayMods = Mods.Value.Select(m => m.DeepClone()).ToArray();
|
||||
|
||||
if (gameplayMods.Any(m => m is UnknownMod))
|
||||
{
|
||||
Logger.Log("Gameplay was started with an unknown mod applied.", level: LogLevel.Important);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Beatmap.Value is DummyWorkingBeatmap)
|
||||
return;
|
||||
|
||||
@ -988,24 +994,27 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
public override bool OnExiting(IScreen next)
|
||||
{
|
||||
if (!GameplayState.HasPassed && !GameplayState.HasFailed)
|
||||
GameplayState.HasQuit = true;
|
||||
|
||||
screenSuspension?.RemoveAndDisposeImmediately();
|
||||
failAnimationLayer?.RemoveFilters();
|
||||
|
||||
// if arriving here and the results screen preparation task hasn't run, it's safe to say the user has not completed the beatmap.
|
||||
if (prepareScoreForDisplayTask == null)
|
||||
if (LoadedBeatmapSuccessfully)
|
||||
{
|
||||
Score.ScoreInfo.Passed = false;
|
||||
// potentially should be ScoreRank.F instead? this is the best alternative for now.
|
||||
Score.ScoreInfo.Rank = ScoreRank.D;
|
||||
}
|
||||
if (!GameplayState.HasPassed && !GameplayState.HasFailed)
|
||||
GameplayState.HasQuit = true;
|
||||
|
||||
// EndPlaying() is typically called from ReplayRecorder.Dispose(). Disposal is currently asynchronous.
|
||||
// To resolve test failures, forcefully end playing synchronously when this screen exits.
|
||||
// Todo: Replace this with a more permanent solution once osu-framework has a synchronous cleanup method.
|
||||
spectatorClient.EndPlaying(GameplayState);
|
||||
// if arriving here and the results screen preparation task hasn't run, it's safe to say the user has not completed the beatmap.
|
||||
if (prepareScoreForDisplayTask == null)
|
||||
{
|
||||
Score.ScoreInfo.Passed = false;
|
||||
// potentially should be ScoreRank.F instead? this is the best alternative for now.
|
||||
Score.ScoreInfo.Rank = ScoreRank.D;
|
||||
}
|
||||
|
||||
// EndPlaying() is typically called from ReplayRecorder.Dispose(). Disposal is currently asynchronous.
|
||||
// To resolve test failures, forcefully end playing synchronously when this screen exits.
|
||||
// Todo: Replace this with a more permanent solution once osu-framework has a synchronous cleanup method.
|
||||
spectatorClient.EndPlaying(GameplayState);
|
||||
}
|
||||
|
||||
// GameplayClockContainer performs seeks / start / stop operations on the beatmap's track.
|
||||
// as we are no longer the current screen, we cannot guarantee the track is still usable.
|
||||
|
@ -1,6 +1,8 @@
|
||||
// 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.
|
||||
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
@ -23,8 +25,6 @@ using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Ranking.Statistics;
|
||||
using osuTK;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace osu.Game.Screens.Play.PlayerSettings
|
||||
{
|
||||
public class BeatmapOffsetControl : CompositeDrawable
|
||||
@ -122,7 +122,19 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
beatmapOffsetSubscription = realm.SubscribeToPropertyChanged(
|
||||
r => r.Find<BeatmapInfo>(beatmap.Value.BeatmapInfo.ID)?.UserSettings,
|
||||
settings => settings.Offset,
|
||||
val => Current.Value = val);
|
||||
val =>
|
||||
{
|
||||
// At the point we reach here, it's not guaranteed that all realm writes have taken place (there may be some in-flight).
|
||||
// We are only aware of writes that originated from our own flow, so if we do see one that's active we can avoid handling the feedback value arriving.
|
||||
if (realmWriteTask == null)
|
||||
Current.Value = val;
|
||||
|
||||
if (realmWriteTask?.IsCompleted == true)
|
||||
{
|
||||
// we can also mark any in-flight write that is managed locally as "seen" and start handling any incoming changes again.
|
||||
realmWriteTask = null;
|
||||
}
|
||||
});
|
||||
|
||||
Current.BindValueChanged(currentChanged);
|
||||
}
|
||||
@ -158,10 +170,12 @@ namespace osu.Game.Screens.Play.PlayerSettings
|
||||
if (settings == null) // only the case for tests.
|
||||
return;
|
||||
|
||||
if (settings.Offset == Current.Value)
|
||||
double val = Current.Value;
|
||||
|
||||
if (settings.Offset == val)
|
||||
return;
|
||||
|
||||
settings.Offset = Current.Value;
|
||||
settings.Offset = val;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,8 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
bool exiting = base.OnExiting(next);
|
||||
|
||||
submitScore(Score.DeepClone());
|
||||
if (LoadedBeatmapSuccessfully)
|
||||
submitScore(Score.DeepClone());
|
||||
|
||||
return exiting;
|
||||
}
|
||||
|
@ -152,7 +152,6 @@ namespace osu.Game.Screens.Select
|
||||
public OsuSpriteText VersionLabel { get; private set; }
|
||||
public OsuSpriteText TitleLabel { get; private set; }
|
||||
public OsuSpriteText ArtistLabel { get; private set; }
|
||||
public BeatmapSetOnlineStatusPill StatusPill { get; private set; }
|
||||
public FillFlowContainer MapperContainer { get; private set; }
|
||||
|
||||
private Container difficultyColourBar;
|
||||
@ -169,6 +168,12 @@ namespace osu.Game.Screens.Select
|
||||
[Resolved]
|
||||
private IBindable<IReadOnlyList<Mod>> mods { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private BeatmapDifficultyCache difficultyCache { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
private ModSettingChangeTracker settingChangeTracker;
|
||||
|
||||
public WedgeInfoText(WorkingBeatmap working, RulesetInfo userRuleset)
|
||||
@ -181,7 +186,7 @@ namespace osu.Game.Screens.Select
|
||||
private IBindable<StarDifficulty?> starDifficulty;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, LocalisationManager localisation, BeatmapDifficultyCache difficultyCache)
|
||||
private void load(LocalisationManager localisation)
|
||||
{
|
||||
var beatmapInfo = working.BeatmapInfo;
|
||||
var metadata = beatmapInfo.Metadata;
|
||||
@ -255,7 +260,7 @@ namespace osu.Game.Screens.Select
|
||||
Shear = -wedged_container_shear,
|
||||
Alpha = 0f,
|
||||
},
|
||||
StatusPill = new BeatmapSetOnlineStatusPill
|
||||
new BeatmapSetOnlineStatusPill
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.TopRight,
|
||||
@ -264,6 +269,7 @@ namespace osu.Game.Screens.Select
|
||||
TextSize = 11,
|
||||
TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 },
|
||||
Status = beatmapInfo.Status,
|
||||
Alpha = string.IsNullOrEmpty(beatmapInfo.DifficultyName) ? 0 : 1
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -311,22 +317,6 @@ namespace osu.Game.Screens.Select
|
||||
titleBinding.BindValueChanged(_ => setMetadata(metadata.Source));
|
||||
artistBinding.BindValueChanged(_ => setMetadata(metadata.Source), true);
|
||||
|
||||
starRatingDisplay.DisplayedStars.BindValueChanged(s =>
|
||||
{
|
||||
difficultyColourBar.Colour = colours.ForStarDifficulty(s.NewValue);
|
||||
}, true);
|
||||
|
||||
starDifficulty = difficultyCache.GetBindableDifficulty(beatmapInfo, (cancellationSource = new CancellationTokenSource()).Token);
|
||||
starDifficulty.BindValueChanged(s =>
|
||||
{
|
||||
starRatingDisplay.FadeIn(transition_duration);
|
||||
starRatingDisplay.Current.Value = s.NewValue ?? default;
|
||||
});
|
||||
|
||||
// no difficulty means it can't have a status to show
|
||||
if (string.IsNullOrEmpty(beatmapInfo.DifficultyName))
|
||||
StatusPill.Hide();
|
||||
|
||||
addInfoLabels();
|
||||
}
|
||||
|
||||
@ -334,6 +324,23 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
starRatingDisplay.DisplayedStars.BindValueChanged(s =>
|
||||
{
|
||||
difficultyColourBar.Colour = colours.ForStarDifficulty(s.NewValue);
|
||||
}, true);
|
||||
|
||||
starDifficulty = difficultyCache.GetBindableDifficulty(working.BeatmapInfo, (cancellationSource = new CancellationTokenSource()).Token);
|
||||
starDifficulty.BindValueChanged(s =>
|
||||
{
|
||||
starRatingDisplay.Current.Value = s.NewValue ?? default;
|
||||
|
||||
// Don't roll the counter on initial display (but still allow it to roll on applying mods etc.)
|
||||
if (!starRatingDisplay.IsPresent)
|
||||
starRatingDisplay.FinishTransforms(true);
|
||||
|
||||
starRatingDisplay.FadeIn(transition_duration);
|
||||
});
|
||||
|
||||
mods.BindValueChanged(m =>
|
||||
{
|
||||
settingChangeTracker?.Dispose();
|
||||
|
Loading…
Reference in New Issue
Block a user