1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 10:12:54 +08:00

Revert some changes

This commit is contained in:
smoogipoo 2021-08-31 18:56:26 +09:00
parent 90768a86a6
commit bfcadcc4ac
5 changed files with 32 additions and 66 deletions

View File

@ -19,7 +19,6 @@ using osu.Game.Graphics.Cursor;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API;
using osu.Game.Online.Placeholders;
using osu.Game.Rulesets.Scoring;
using osuTK;
using osuTK.Graphics;
@ -29,7 +28,6 @@ namespace osu.Game.Online.Leaderboards
{
private const double fade_duration = 300;
private readonly Bindable<ScoringMode> scoringMode = new Bindable<ScoringMode>();
private readonly OsuScrollContainer scrollContainer;
private readonly Container placeholderContainer;
private readonly UserTopScoreContainer<TScoreInfo> topScoreContainer;
@ -255,9 +253,6 @@ namespace osu.Game.Online.Leaderboards
apiState.BindTo(api.State);
apiState.BindValueChanged(onlineStateChanged, true);
configManager.BindWith(OsuSetting.ScoreDisplayMode, scoringMode);
scoringMode.BindValueChanged(_ => RefreshScores(), true);
}
private APIRequest getScoresRequest;

View File

@ -199,7 +199,7 @@ namespace osu.Game.Online.Leaderboards
TextColour = Color4.White,
GlowColour = Color4Extensions.FromHex(@"83ccfa"),
Font = OsuFont.Numeric.With(size: 23),
Text = scoreManager.GetTotalScore(score).ToLocalisableString(@"N0"),
Current = scoreManager.GetBindableTotalScoreString(score)
},
RankContainer = new Container
{

View File

@ -152,7 +152,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
{
Margin = new MarginPadding { Right = horizontal_inset },
Font = OsuFont.GetFont(size: text_size, weight: index == 0 ? FontWeight.Bold : FontWeight.Medium),
Text = scoreManager.GetTotalScore(score).ToLocalisableString(@"N0"),
Current = scoreManager.GetBindableTotalScoreString(score),
},
new OsuSpriteText
{

View File

@ -15,7 +15,6 @@ using osu.Framework.Bindables;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using osu.Game.Screens.Select.Leaderboards;
using osu.Game.Users;
@ -30,7 +29,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
private readonly Bindable<BeatmapLeaderboardScope> scope = new Bindable<BeatmapLeaderboardScope>(BeatmapLeaderboardScope.Global);
private readonly IBindable<User> user = new Bindable<User>();
private readonly Bindable<ScoringMode> scoringMode = new Bindable<ScoringMode>();
private readonly Box background;
private readonly ScoreTable scoreTable;
@ -51,15 +49,37 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
private GetScoresRequest getScoresRequest;
private APILegacyScores scores;
protected APILegacyScores Scores
{
set
set => Schedule(() =>
{
scores = value;
displayScores(value);
}
topScoresContainer.Clear();
if (value?.Scores.Any() != true)
{
scoreTable.ClearScores();
scoreTable.Hide();
return;
}
var scoreInfos = value.Scores.Select(s => s.CreateScoreInfo(rulesets))
.OrderByDescending(s => scoreManager.GetTotalScore(s))
.ThenBy(s => s.OnlineScoreID)
.ToList();
var topScore = scoreInfos.First();
scoreTable.DisplayScores(scoreInfos, topScore.Beatmap?.Status.GrantsPerformancePoints() == true);
scoreTable.Show();
var userScore = value.UserScore;
var userScoreInfo = userScore?.Score.CreateScoreInfo(rulesets);
topScoresContainer.Add(new DrawableTopScore(topScore));
if (userScoreInfo != null && userScoreInfo.OnlineScoreID != topScore.OnlineScoreID)
topScoresContainer.Add(new DrawableTopScore(userScoreInfo, userScore.Position));
});
}
public ScoresContainer()
@ -160,7 +180,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
background.Colour = colourProvider.Background5;
user.BindTo(api.LocalUser);
config.BindWith(OsuSetting.ScoreDisplayMode, scoringMode);
}
protected override void LoadComplete()
@ -173,8 +192,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
Beatmap.BindValueChanged(onBeatmapChanged);
user.BindValueChanged(onUserChanged, true);
scoringMode.BindValueChanged(_ => displayScores(scores));
}
private void onBeatmapChanged(ValueChangedEvent<BeatmapInfo> beatmap)
@ -246,39 +263,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
api.Queue(getScoresRequest);
}
private void displayScores(APILegacyScores newScores)
{
Schedule(() =>
{
topScoresContainer.Clear();
if (newScores?.Scores.Any() != true)
{
scoreTable.ClearScores();
scoreTable.Hide();
return;
}
var scoreInfos = newScores.Scores.Select(s => s.CreateScoreInfo(rulesets))
.OrderByDescending(s => scoreManager.GetTotalScore(s))
.ThenBy(s => s.OnlineScoreID)
.ToList();
var topScore = scoreInfos.First();
scoreTable.DisplayScores(scoreInfos, topScore.Beatmap?.Status.GrantsPerformancePoints() == true);
scoreTable.Show();
var userScore = newScores.UserScore;
var userScoreInfo = userScore?.Score.CreateScoreInfo(rulesets);
topScoresContainer.Add(new DrawableTopScore(topScore));
if (userScoreInfo != null && userScoreInfo.OnlineScoreID != topScore.OnlineScoreID)
topScoresContainer.Add(new DrawableTopScore(userScoreInfo, userScore.Position));
});
}
private bool userIsSupporter => api.IsLoggedIn && api.LocalUser.Value.IsSupporter;
}
}

View File

@ -10,9 +10,7 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
using osu.Game.Configuration;
using osu.Game.Graphics.Containers;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using osuTK;
using osuTK.Input;
@ -292,26 +290,15 @@ namespace osu.Game.Screens.Ranking
{
public override IEnumerable<Drawable> FlowingChildren => applySorting(AliveInternalChildren);
private readonly Bindable<ScoringMode> scoringMode = new Bindable<ScoringMode>();
[Resolved]
private ScoreManager scoreManager { get; set; }
[BackgroundDependencyLoader]
private void load(OsuConfigManager configManager)
{
configManager.BindWith(OsuSetting.ScoreDisplayMode, scoringMode);
}
protected override void LoadComplete()
{
base.LoadComplete();
scoringMode.BindValueChanged(mode =>
{
foreach (var c in Children)
SetLayoutPosition(c, scoreManager.GetTotalScore(c.Panel.Score));
}, true);
foreach (var c in Children)
SetLayoutPosition(c, scoreManager.GetTotalScore(c.Panel.Score));
}
public int GetPanelIndex(ScoreInfo score) => applySorting(Children).TakeWhile(s => s.Panel.Score != score).Count();