mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:43:05 +08:00
Merge branch 'master' into mute-mod-improvements
This commit is contained in:
commit
b01b0d711f
@ -168,8 +168,8 @@ namespace osu.Game.Tests.Online
|
||||
|
||||
public override async Task<BeatmapSetInfo> Import(BeatmapSetInfo item, ArchiveReader archive = null, bool lowPriority = false, CancellationToken cancellationToken = default)
|
||||
{
|
||||
await AllowImport.Task;
|
||||
return await (CurrentImportTask = base.Import(item, archive, lowPriority, cancellationToken));
|
||||
await AllowImport.Task.ConfigureAwait(false);
|
||||
return await (CurrentImportTask = base.Import(item, archive, lowPriority, cancellationToken)).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -143,9 +143,9 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
public override async Task<StarDifficulty> GetDifficultyAsync(BeatmapInfo beatmapInfo, RulesetInfo rulesetInfo = null, IEnumerable<Mod> mods = null, CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (blockCalculation)
|
||||
await calculationBlocker.Task;
|
||||
await calculationBlocker.Task.ConfigureAwait(false);
|
||||
|
||||
return await base.GetDifficultyAsync(beatmapInfo, rulesetInfo, mods, cancellationToken);
|
||||
return await base.GetDifficultyAsync(beatmapInfo, rulesetInfo, mods, cancellationToken).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ namespace osu.Game.Online.API
|
||||
|
||||
userReq.Failure += ex =>
|
||||
{
|
||||
if (ex.InnerException is WebException webException && webException.Message == @"Unauthorized")
|
||||
if (ex is WebException webException && webException.Message == @"Unauthorized")
|
||||
{
|
||||
log.Add(@"Login no longer valid");
|
||||
Logout();
|
||||
|
@ -19,14 +19,14 @@ namespace osu.Game.Overlays.Rankings.Tables
|
||||
{
|
||||
}
|
||||
|
||||
protected override TableColumn[] CreateAdditionalHeaders() => new[]
|
||||
protected override RankingsTableColumn[] CreateAdditionalHeaders() => new[]
|
||||
{
|
||||
new TableColumn("Active Users", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
|
||||
new TableColumn("Play Count", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
|
||||
new TableColumn("Ranked Score", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
|
||||
new TableColumn("Avg. Score", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
|
||||
new TableColumn("Performance", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
|
||||
new TableColumn("Avg. Perf.", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
|
||||
new RankingsTableColumn("Active Users", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
|
||||
new RankingsTableColumn("Play Count", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
|
||||
new RankingsTableColumn("Ranked Score", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
|
||||
new RankingsTableColumn("Avg. Score", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
|
||||
new RankingsTableColumn("Performance", Anchor.Centre, new Dimension(GridSizeMode.AutoSize), true),
|
||||
new RankingsTableColumn("Avg. Perf.", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
|
||||
};
|
||||
|
||||
protected override Country GetCountry(CountryStatistics item) => item.Country;
|
||||
|
@ -15,9 +15,9 @@ namespace osu.Game.Overlays.Rankings.Tables
|
||||
{
|
||||
}
|
||||
|
||||
protected override TableColumn[] CreateUniqueHeaders() => new[]
|
||||
protected override RankingsTableColumn[] CreateUniqueHeaders() => new[]
|
||||
{
|
||||
new TableColumn("Performance", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
|
||||
new RankingsTableColumn("Performance", Anchor.Centre, new Dimension(GridSizeMode.AutoSize), true),
|
||||
};
|
||||
|
||||
protected override Drawable[] CreateUniqueContent(UserStatistics item) => new Drawable[]
|
||||
|
@ -55,29 +55,24 @@ namespace osu.Game.Overlays.Rankings.Tables
|
||||
|
||||
rankings.ForEach(_ => backgroundFlow.Add(new TableRowBackground { Height = row_height }));
|
||||
|
||||
Columns = mainHeaders.Concat(CreateAdditionalHeaders()).ToArray();
|
||||
Columns = mainHeaders.Concat(CreateAdditionalHeaders()).Cast<TableColumn>().ToArray();
|
||||
Content = rankings.Select((s, i) => createContent((page - 1) * items_per_page + i, s)).ToArray().ToRectangular();
|
||||
}
|
||||
|
||||
private Drawable[] createContent(int index, TModel item) => new Drawable[] { createIndexDrawable(index), createMainContent(item) }.Concat(CreateAdditionalContent(item)).ToArray();
|
||||
|
||||
private static TableColumn[] mainHeaders => new[]
|
||||
private static RankingsTableColumn[] mainHeaders => new[]
|
||||
{
|
||||
new TableColumn(string.Empty, Anchor.Centre, new Dimension(GridSizeMode.Absolute, 40)), // place
|
||||
new TableColumn(string.Empty, Anchor.CentreLeft, new Dimension()), // flag and username (country name)
|
||||
new RankingsTableColumn(string.Empty, Anchor.Centre, new Dimension(GridSizeMode.Absolute, 40)), // place
|
||||
new RankingsTableColumn(string.Empty, Anchor.CentreLeft, new Dimension()), // flag and username (country name)
|
||||
};
|
||||
|
||||
protected abstract TableColumn[] CreateAdditionalHeaders();
|
||||
protected abstract RankingsTableColumn[] CreateAdditionalHeaders();
|
||||
|
||||
protected abstract Drawable[] CreateAdditionalContent(TModel item);
|
||||
|
||||
protected virtual string HighlightedColumn => @"Performance";
|
||||
|
||||
protected override Drawable CreateHeader(int index, TableColumn column)
|
||||
{
|
||||
var title = column?.Header ?? default;
|
||||
return new HeaderText(title, title == HighlightedColumn);
|
||||
}
|
||||
protected sealed override Drawable CreateHeader(int index, TableColumn column)
|
||||
=> (column as RankingsTableColumn)?.CreateHeaderText() ?? new HeaderText(column?.Header ?? default, false);
|
||||
|
||||
protected abstract Country GetCountry(TModel item);
|
||||
|
||||
@ -106,6 +101,19 @@ namespace osu.Game.Overlays.Rankings.Tables
|
||||
}
|
||||
};
|
||||
|
||||
protected class RankingsTableColumn : TableColumn
|
||||
{
|
||||
protected readonly bool Highlighted;
|
||||
|
||||
public RankingsTableColumn(LocalisableString? header = null, Anchor anchor = Anchor.TopLeft, Dimension dimension = null, bool highlighted = false)
|
||||
: base(header, anchor, dimension)
|
||||
{
|
||||
Highlighted = highlighted;
|
||||
}
|
||||
|
||||
public virtual HeaderText CreateHeaderText() => new HeaderText(Header, Highlighted);
|
||||
}
|
||||
|
||||
protected class HeaderText : OsuSpriteText
|
||||
{
|
||||
private readonly bool isHighlighted;
|
||||
|
@ -15,10 +15,10 @@ namespace osu.Game.Overlays.Rankings.Tables
|
||||
{
|
||||
}
|
||||
|
||||
protected override TableColumn[] CreateUniqueHeaders() => new[]
|
||||
protected override RankingsTableColumn[] CreateUniqueHeaders() => new[]
|
||||
{
|
||||
new TableColumn("Total Score", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
|
||||
new TableColumn("Ranked Score", Anchor.Centre, new Dimension(GridSizeMode.AutoSize))
|
||||
new RankingsTableColumn("Total Score", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
|
||||
new RankingsTableColumn("Ranked Score", Anchor.Centre, new Dimension(GridSizeMode.AutoSize), true)
|
||||
};
|
||||
|
||||
protected override Drawable[] CreateUniqueContent(UserStatistics item) => new Drawable[]
|
||||
@ -32,7 +32,5 @@ namespace osu.Game.Overlays.Rankings.Tables
|
||||
Text = $@"{item.RankedScore:N0}",
|
||||
}
|
||||
};
|
||||
|
||||
protected override string HighlightedColumn => @"Ranked Score";
|
||||
}
|
||||
}
|
||||
|
@ -22,20 +22,14 @@ namespace osu.Game.Overlays.Rankings.Tables
|
||||
|
||||
protected virtual IEnumerable<string> GradeColumns => new List<string> { "SS", "S", "A" };
|
||||
|
||||
protected override TableColumn[] CreateAdditionalHeaders() => new[]
|
||||
protected override RankingsTableColumn[] CreateAdditionalHeaders() => new[]
|
||||
{
|
||||
new TableColumn("Accuracy", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
|
||||
new TableColumn("Play Count", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
|
||||
new RankingsTableColumn("Accuracy", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
|
||||
new RankingsTableColumn("Play Count", Anchor.Centre, new Dimension(GridSizeMode.AutoSize)),
|
||||
}.Concat(CreateUniqueHeaders())
|
||||
.Concat(GradeColumns.Select(grade => new TableColumn(grade, Anchor.Centre, new Dimension(GridSizeMode.AutoSize))))
|
||||
.Concat(GradeColumns.Select(grade => new GradeTableColumn(grade, Anchor.Centre, new Dimension(GridSizeMode.AutoSize))))
|
||||
.ToArray();
|
||||
|
||||
protected override Drawable CreateHeader(int index, TableColumn column)
|
||||
{
|
||||
var title = column?.Header ?? default;
|
||||
return new UserTableHeaderText(title, HighlightedColumn == title, GradeColumns.Contains(title.ToString()));
|
||||
}
|
||||
|
||||
protected sealed override Country GetCountry(UserStatistics item) => item.User.Country;
|
||||
|
||||
protected sealed override Drawable CreateFlagContent(UserStatistics item)
|
||||
@ -61,19 +55,29 @@ namespace osu.Game.Overlays.Rankings.Tables
|
||||
new ColoredRowText { Text = $@"{item.GradesCount[ScoreRank.A]:N0}", }
|
||||
}).ToArray();
|
||||
|
||||
protected abstract TableColumn[] CreateUniqueHeaders();
|
||||
protected abstract RankingsTableColumn[] CreateUniqueHeaders();
|
||||
|
||||
protected abstract Drawable[] CreateUniqueContent(UserStatistics item);
|
||||
|
||||
private class UserTableHeaderText : HeaderText
|
||||
private class GradeTableColumn : RankingsTableColumn
|
||||
{
|
||||
public UserTableHeaderText(LocalisableString text, bool isHighlighted, bool isGrade)
|
||||
public GradeTableColumn(LocalisableString? header = null, Anchor anchor = Anchor.TopLeft, Dimension dimension = null, bool highlighted = false)
|
||||
: base(header, anchor, dimension, highlighted)
|
||||
{
|
||||
}
|
||||
|
||||
public override HeaderText CreateHeaderText() => new GradeHeaderText(Header, Highlighted);
|
||||
}
|
||||
|
||||
private class GradeHeaderText : HeaderText
|
||||
{
|
||||
public GradeHeaderText(LocalisableString text, bool isHighlighted)
|
||||
: base(text, isHighlighted)
|
||||
{
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
// Grade columns have extra horizontal padding for readibility
|
||||
Horizontal = isGrade ? 20 : 10,
|
||||
Horizontal = 20,
|
||||
Vertical = 5
|
||||
};
|
||||
}
|
||||
|
@ -1,9 +1,9 @@
|
||||
// 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 osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Graphics.Containers;
|
||||
@ -11,11 +11,11 @@ using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public class Metronome : BeatSyncedContainer
|
||||
public class Metronome : BeatSyncedContainer, IAdjustableAudioComponent
|
||||
{
|
||||
private readonly double firstHitTime;
|
||||
|
||||
private PausableSkinnableSound sample;
|
||||
private readonly PausableSkinnableSound sample;
|
||||
|
||||
/// <param name="firstHitTime">Start time of the first hit object, used for providing a count down.</param>
|
||||
public Metronome(double firstHitTime)
|
||||
@ -23,15 +23,8 @@ namespace osu.Game.Rulesets.Mods
|
||||
this.firstHitTime = firstHitTime;
|
||||
AllowMistimedEventFiring = false;
|
||||
Divisor = 1;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
sample = new PausableSkinnableSound(new SampleInfo("Gameplay/catch-banana"))
|
||||
};
|
||||
InternalChild = sample = new PausableSkinnableSound(new SampleInfo("Gameplay/catch-banana"));
|
||||
}
|
||||
|
||||
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
|
||||
@ -49,5 +42,50 @@ namespace osu.Game.Rulesets.Mods
|
||||
sample.Frequency.Value = beatIndex % timeSignature == 0 ? 1 : 0.5f;
|
||||
sample.Play();
|
||||
}
|
||||
|
||||
#region IAdjustableAudioComponent
|
||||
|
||||
public IBindable<double> AggregateVolume => sample.AggregateVolume;
|
||||
|
||||
public IBindable<double> AggregateBalance => sample.AggregateBalance;
|
||||
|
||||
public IBindable<double> AggregateFrequency => sample.AggregateFrequency;
|
||||
|
||||
public IBindable<double> AggregateTempo => sample.AggregateTempo;
|
||||
|
||||
public BindableNumber<double> Volume => sample.Volume;
|
||||
|
||||
public BindableNumber<double> Balance => sample.Balance;
|
||||
|
||||
public BindableNumber<double> Frequency => sample.Frequency;
|
||||
|
||||
public BindableNumber<double> Tempo => sample.Tempo;
|
||||
|
||||
public void BindAdjustments(IAggregateAudioAdjustment component)
|
||||
{
|
||||
sample.BindAdjustments(component);
|
||||
}
|
||||
|
||||
public void UnbindAdjustments(IAggregateAudioAdjustment component)
|
||||
{
|
||||
sample.UnbindAdjustments(component);
|
||||
}
|
||||
|
||||
public void AddAdjustment(AdjustableProperty type, IBindable<double> adjustBindable)
|
||||
{
|
||||
sample.AddAdjustment(type, adjustBindable);
|
||||
}
|
||||
|
||||
public void RemoveAdjustment(AdjustableProperty type, IBindable<double> adjustBindable)
|
||||
{
|
||||
sample.RemoveAdjustment(type, adjustBindable);
|
||||
}
|
||||
|
||||
public void RemoveAllAdjustments(AdjustableProperty type)
|
||||
{
|
||||
sample.RemoveAllAdjustments(type);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -178,7 +178,7 @@ namespace osu.Game.Screens.Play
|
||||
float barHeight = bottom_bar_height + handle_size.Y;
|
||||
|
||||
bar.ResizeHeightTo(ShowGraph.Value ? barHeight + graph_height : barHeight, transition_duration, Easing.In);
|
||||
graph.MoveToY(ShowGraph.Value ? 0 : bottom_bar_height + graph_height, transition_duration, Easing.In);
|
||||
graph.FadeTo(ShowGraph.Value ? 1 : 0, transition_duration, Easing.In);
|
||||
|
||||
updateInfoMargin();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user