mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 15:47:26 +08:00
Merge branch 'master' into skin-components-bind-outwards-health
This commit is contained in:
commit
b274fdf20d
@ -52,6 +52,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.422.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.506.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.507.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -26,6 +26,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
{
|
||||
AccentColour = Color4.Transparent
|
||||
};
|
||||
|
||||
// SliderSelectionBlueprint relies on calling ReceivePositionalInputAt on this drawable to determine whether selection should occur.
|
||||
// Without AlwaysPresent, a movement in a parent container (ie. the editor composer area resizing) could cause incorrect input handling.
|
||||
AlwaysPresent = true;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -18,7 +18,6 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
public class TestSceneSkinEditorMultipleSkins : SkinnableTestScene
|
||||
{
|
||||
[Cached]
|
||||
private readonly ScoreProcessor scoreProcessor = new ScoreProcessor();
|
||||
|
||||
[Cached(typeof(HealthProcessor))]
|
||||
|
@ -1,49 +1,36 @@
|
||||
// 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.Testing;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
public class TestSceneSkinnableAccuracyCounter : SkinnableTestScene
|
||||
{
|
||||
private IEnumerable<SkinnableAccuracyCounter> accuracyCounters => CreatedDrawables.OfType<SkinnableAccuracyCounter>();
|
||||
|
||||
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();
|
||||
|
||||
[Cached]
|
||||
private ScoreProcessor scoreProcessor = new ScoreProcessor();
|
||||
|
||||
[SetUpSteps]
|
||||
public void SetUpSteps()
|
||||
{
|
||||
AddStep("Create combo counters", () => SetContents(() =>
|
||||
{
|
||||
var accuracyCounter = new SkinnableAccuracyCounter();
|
||||
|
||||
accuracyCounter.Current.Value = 1;
|
||||
|
||||
return accuracyCounter;
|
||||
}));
|
||||
AddStep("Set initial accuracy", () => scoreProcessor.Accuracy.Value = 1);
|
||||
AddStep("Create accuracy counters", () => SetContents(() => new SkinnableAccuracyCounter()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestChangingAccuracy()
|
||||
{
|
||||
AddStep(@"Reset all", delegate
|
||||
{
|
||||
foreach (var s in accuracyCounters)
|
||||
s.Current.Value = 1;
|
||||
});
|
||||
AddStep(@"Reset all", () => scoreProcessor.Accuracy.Value = 1);
|
||||
|
||||
AddStep(@"Hit! :D", delegate
|
||||
{
|
||||
foreach (var s in accuracyCounters)
|
||||
s.Current.Value -= 0.023f;
|
||||
});
|
||||
AddStep(@"Miss :(", () => scoreProcessor.Accuracy.Value -= 0.023);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
@ -18,37 +20,27 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
protected override Ruleset CreateRulesetForSkinProvider() => new OsuRuleset();
|
||||
|
||||
[Cached]
|
||||
private ScoreProcessor scoreProcessor = new ScoreProcessor();
|
||||
|
||||
[SetUpSteps]
|
||||
public void SetUpSteps()
|
||||
{
|
||||
AddStep("Create combo counters", () => SetContents(() =>
|
||||
{
|
||||
var comboCounter = new SkinnableScoreCounter();
|
||||
comboCounter.Current.Value = 1;
|
||||
return comboCounter;
|
||||
}));
|
||||
AddStep("Create score counters", () => SetContents(() => new SkinnableScoreCounter()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestScoreCounterIncrementing()
|
||||
{
|
||||
AddStep(@"Reset all", delegate
|
||||
{
|
||||
foreach (var s in scoreCounters)
|
||||
s.Current.Value = 0;
|
||||
});
|
||||
AddStep(@"Reset all", () => scoreProcessor.TotalScore.Value = 0);
|
||||
|
||||
AddStep(@"Hit! :D", delegate
|
||||
{
|
||||
foreach (var s in scoreCounters)
|
||||
s.Current.Value += 300;
|
||||
});
|
||||
AddStep(@"Hit! :D", () => scoreProcessor.TotalScore.Value += 300);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestVeryLargeScore()
|
||||
{
|
||||
AddStep("set large score", () => scoreCounters.ForEach(counter => counter.Current.Value = 1_000_000_000));
|
||||
AddStep("set large score", () => scoreCounters.ForEach(counter => scoreProcessor.TotalScore.Value = 1_000_000_000));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -133,6 +133,16 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddUntilStep("storyboard ends", () => Player.GameplayClockContainer.GameplayClock.CurrentTime >= currentStoryboardDuration);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPerformExitNoOutro()
|
||||
{
|
||||
CreateTest(null);
|
||||
AddStep("disable storyboard", () => LocalConfig.SetValue(OsuSetting.ShowStoryboard, false));
|
||||
AddUntilStep("completion set by processor", () => Player.ScoreProcessor.HasCompleted.Value);
|
||||
AddStep("exit via pause", () => Player.ExitViaPause());
|
||||
AddAssert("player exited", () => Stack.CurrentScreen == null);
|
||||
}
|
||||
|
||||
protected override bool AllowFail => true;
|
||||
|
||||
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();
|
||||
|
@ -2,7 +2,10 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
@ -14,21 +17,34 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
private DummyAPIAccess dummyAPI => (DummyAPIAccess)API;
|
||||
|
||||
private NewsOverlay news;
|
||||
private NewsOverlay overlay;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp() => Schedule(() => Child = news = new NewsOverlay());
|
||||
public void SetUp() => Schedule(() => Child = overlay = new NewsOverlay());
|
||||
|
||||
[Test]
|
||||
public void TestRequest()
|
||||
{
|
||||
setUpNewsResponse(responseExample);
|
||||
AddStep("Show", () => news.Show());
|
||||
AddStep("Show article", () => news.ShowArticle("article"));
|
||||
AddStep("Show", () => overlay.Show());
|
||||
AddStep("Show article", () => overlay.ShowArticle("article"));
|
||||
}
|
||||
|
||||
private void setUpNewsResponse(GetNewsResponse r)
|
||||
=> AddStep("set up response", () =>
|
||||
[Test]
|
||||
public void TestCursorRequest()
|
||||
{
|
||||
setUpNewsResponse(responseWithCursor, "Set up cursor response");
|
||||
AddStep("Show", () => overlay.Show());
|
||||
AddUntilStep("Show More button is visible", () => showMoreButton?.Alpha == 1);
|
||||
setUpNewsResponse(responseWithNoCursor, "Set up no cursor response");
|
||||
AddStep("Click Show More", () => showMoreButton?.Click());
|
||||
AddUntilStep("Show More button is hidden", () => showMoreButton?.Alpha == 0);
|
||||
}
|
||||
|
||||
private ShowMoreButton showMoreButton => overlay.ChildrenOfType<ShowMoreButton>().FirstOrDefault();
|
||||
|
||||
private void setUpNewsResponse(GetNewsResponse r, string testName = "Set up response")
|
||||
=> AddStep(testName, () =>
|
||||
{
|
||||
dummyAPI.HandleRequest = request =>
|
||||
{
|
||||
@ -40,7 +56,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
};
|
||||
});
|
||||
|
||||
private GetNewsResponse responseExample => new GetNewsResponse
|
||||
private static GetNewsResponse responseExample => new GetNewsResponse
|
||||
{
|
||||
NewsPosts = new[]
|
||||
{
|
||||
@ -62,5 +78,37 @@ namespace osu.Game.Tests.Visual.Online
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private static GetNewsResponse responseWithCursor => new GetNewsResponse
|
||||
{
|
||||
NewsPosts = new[]
|
||||
{
|
||||
new APINewsPost
|
||||
{
|
||||
Title = "This post has an image which starts with \"/\" and has many authors!",
|
||||
Preview = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
|
||||
Author = "someone, someone1, someone2, someone3, someone4",
|
||||
FirstImage = "/help/wiki/shared/news/banners/monthly-beatmapping-contest.png",
|
||||
PublishedAt = DateTimeOffset.Now
|
||||
}
|
||||
},
|
||||
Cursor = new Cursor()
|
||||
};
|
||||
|
||||
private static GetNewsResponse responseWithNoCursor => new GetNewsResponse
|
||||
{
|
||||
NewsPosts = new[]
|
||||
{
|
||||
new APINewsPost
|
||||
{
|
||||
Title = "This post has a full-url image! (HTML entity: &)",
|
||||
Preview = "boom (HTML entity: &)",
|
||||
Author = "user (HTML entity: &)",
|
||||
FirstImage = "https://assets.ppy.sh/artists/88/header.jpg",
|
||||
PublishedAt = DateTimeOffset.Now
|
||||
}
|
||||
},
|
||||
Cursor = null
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddAssert("check version", () => infoWedge.Info.VersionLabel.Current.Value == $"{ruleset.ShortName}Version");
|
||||
AddAssert("check title", () => infoWedge.Info.TitleLabel.Current.Value == $"{ruleset.ShortName}Source — {ruleset.ShortName}Title");
|
||||
AddAssert("check artist", () => infoWedge.Info.ArtistLabel.Current.Value == $"{ruleset.ShortName}Artist");
|
||||
AddAssert("check author", () => infoWedge.Info.MapperContainer.Children.OfType<OsuSpriteText>().Any(s => s.Current.Value == $"{ruleset.ShortName}Author"));
|
||||
AddAssert("check author", () => infoWedge.Info.MapperContainer.ChildrenOfType<OsuSpriteText>().Any(s => s.Current.Value == $"{ruleset.ShortName}Author"));
|
||||
}
|
||||
|
||||
private void testInfoLabels(int expectedCount)
|
||||
@ -124,7 +124,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddAssert("check empty version", () => string.IsNullOrEmpty(infoWedge.Info.VersionLabel.Current.Value));
|
||||
AddAssert("check default title", () => infoWedge.Info.TitleLabel.Current.Value == Beatmap.Default.BeatmapInfo.Metadata.Title);
|
||||
AddAssert("check default artist", () => infoWedge.Info.ArtistLabel.Current.Value == Beatmap.Default.BeatmapInfo.Metadata.Artist);
|
||||
AddAssert("check empty author", () => !infoWedge.Info.MapperContainer.Children.Any());
|
||||
AddAssert("check empty author", () => !infoWedge.Info.MapperContainer.ChildrenOfType<OsuSpriteText>().Any());
|
||||
AddAssert("check no info labels", () => !infoWedge.Info.ChildrenOfType<BeatmapInfoWedge.WedgeInfoText.InfoLabel>().Any());
|
||||
}
|
||||
|
||||
|
@ -304,6 +304,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddStep(@"Sort by BPM", () => config.SetValue(OsuSetting.SongSelectSortingMode, SortMode.BPM));
|
||||
AddStep(@"Sort by Length", () => config.SetValue(OsuSetting.SongSelectSortingMode, SortMode.Length));
|
||||
AddStep(@"Sort by Difficulty", () => config.SetValue(OsuSetting.SongSelectSortingMode, SortMode.Difficulty));
|
||||
AddStep(@"Sort by Source", () => config.SetValue(OsuSetting.SongSelectSortingMode, SortMode.Source));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -4,11 +4,10 @@
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public abstract class ScoreCounter : RollingCounter<double>, IScoreCounter
|
||||
public abstract class ScoreCounter : RollingCounter<double>
|
||||
{
|
||||
protected override double RollingDuration => 1000;
|
||||
protected override Easing RollingEasing => Easing.Out;
|
||||
|
@ -23,6 +23,8 @@ namespace osu.Game.Online.API.Requests
|
||||
return req;
|
||||
}
|
||||
|
||||
protected override string FileExtension => ".osz";
|
||||
|
||||
protected override string Target => $@"beatmapsets/{Model.OnlineBeatmapSetID}/download{(noVideo ? "?noVideo=1" : "")}";
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,8 @@ using osuTK.Graphics;
|
||||
using osu.Framework.Graphics.Effects;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Users;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
@ -50,7 +52,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
|
||||
fields.Children = new Drawable[]
|
||||
{
|
||||
new Field("mapped by", BeatmapSet.Metadata.Author.Username, OsuFont.GetFont(weight: FontWeight.Regular, italics: true)),
|
||||
new Field("mapped by", BeatmapSet.Metadata.Author, OsuFont.GetFont(weight: FontWeight.Regular, italics: true)),
|
||||
new Field("submitted", online.Submitted, OsuFont.GetFont(weight: FontWeight.Bold))
|
||||
{
|
||||
Margin = new MarginPadding { Top = 5 },
|
||||
@ -146,6 +148,25 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public Field(string first, User second, FontUsage secondFont)
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Direction = FillDirection.Horizontal;
|
||||
|
||||
Children = new[]
|
||||
{
|
||||
new LinkFlowContainer(s =>
|
||||
{
|
||||
s.Font = OsuFont.GetFont(size: 11);
|
||||
}).With(d =>
|
||||
{
|
||||
d.AutoSizeAxes = Axes.Both;
|
||||
d.AddText($"{first} ");
|
||||
d.AddUserLink(second, s => s.Font = secondFont.With(size: 11));
|
||||
}),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ namespace osu.Game.Overlays.News.Displays
|
||||
{
|
||||
content.Add(loaded);
|
||||
showMore.IsLoading = false;
|
||||
showMore.Show();
|
||||
showMore.Alpha = lastCursor == null ? 0 : 1;
|
||||
}, (cancellationToken = new CancellationTokenSource()).Token);
|
||||
}
|
||||
|
||||
|
@ -204,7 +204,7 @@ namespace osu.Game.Overlays.Volume
|
||||
{
|
||||
displayVolume = value;
|
||||
|
||||
if (displayVolume > 0.99f)
|
||||
if (displayVolume >= 0.995f)
|
||||
{
|
||||
text.Text = "MAX";
|
||||
maxGlow.EffectColour = meterColour.Opacity(2f);
|
||||
|
@ -17,7 +17,6 @@ using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
@ -144,8 +143,7 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
// Todo: should probably be done at a DrawableRuleset level to share logic with Player.
|
||||
clock = new EditorClock(playableBeatmap, beatDivisor) { IsCoupled = false };
|
||||
|
||||
UpdateClockSource();
|
||||
clock.ChangeSource(loadableBeatmap.Track);
|
||||
|
||||
dependencies.CacheAs(clock);
|
||||
AddInternal(clock);
|
||||
@ -308,11 +306,7 @@ namespace osu.Game.Screens.Edit
|
||||
/// <summary>
|
||||
/// If the beatmap's track has changed, this method must be called to keep the editor in a valid state.
|
||||
/// </summary>
|
||||
public void UpdateClockSource()
|
||||
{
|
||||
var sourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock();
|
||||
clock.ChangeSource(sourceClock);
|
||||
}
|
||||
public void UpdateClockSource() => clock.ChangeSource(Beatmap.Value.Track);
|
||||
|
||||
protected void Save()
|
||||
{
|
||||
@ -583,7 +577,7 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
private void resetTrack(bool seekToStart = false)
|
||||
{
|
||||
Beatmap.Value.Track?.Stop();
|
||||
Beatmap.Value.Track.Stop();
|
||||
|
||||
if (seekToStart)
|
||||
{
|
||||
|
@ -4,12 +4,11 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public class DefaultAccuracyCounter : PercentageCounter, IAccuracyCounter, ISkinnableComponent
|
||||
public class DefaultAccuracyCounter : GameplayAccuracyCounter, ISkinnableComponent
|
||||
{
|
||||
private readonly Vector2 offset = new Vector2(-20, 5);
|
||||
|
||||
|
@ -4,11 +4,10 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public class DefaultScoreCounter : ScoreCounter, ISkinnableComponent
|
||||
public class DefaultScoreCounter : GameplayScoreCounter, ISkinnableComponent
|
||||
{
|
||||
public DefaultScoreCounter()
|
||||
: base(6)
|
||||
|
18
osu.Game/Screens/Play/HUD/GameplayAccuracyCounter.cs
Normal file
18
osu.Game/Screens/Play/HUD/GameplayAccuracyCounter.cs
Normal file
@ -0,0 +1,18 @@
|
||||
// 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.Game.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public abstract class GameplayAccuracyCounter : PercentageCounter
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(ScoreProcessor scoreProcessor)
|
||||
{
|
||||
Current.BindTo(scoreProcessor.Accuracy);
|
||||
}
|
||||
}
|
||||
}
|
46
osu.Game/Screens/Play/HUD/GameplayScoreCounter.cs
Normal file
46
osu.Game/Screens/Play/HUD/GameplayScoreCounter.cs
Normal file
@ -0,0 +1,46 @@
|
||||
// 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.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public abstract class GameplayScoreCounter : ScoreCounter
|
||||
{
|
||||
private Bindable<ScoringMode> scoreDisplayMode;
|
||||
|
||||
protected GameplayScoreCounter(int leading = 0, bool useCommaSeparator = false)
|
||||
: base(leading, useCommaSeparator)
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config, ScoreProcessor scoreProcessor)
|
||||
{
|
||||
scoreDisplayMode = config.GetBindable<ScoringMode>(OsuSetting.ScoreDisplayMode);
|
||||
scoreDisplayMode.BindValueChanged(scoreMode =>
|
||||
{
|
||||
switch (scoreMode.NewValue)
|
||||
{
|
||||
case ScoringMode.Standardised:
|
||||
RequiredDisplayDigits.Value = 6;
|
||||
break;
|
||||
|
||||
case ScoringMode.Classic:
|
||||
RequiredDisplayDigits.Value = 8;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(scoreMode));
|
||||
}
|
||||
}, true);
|
||||
|
||||
Current.BindTo(scoreProcessor.TotalScore);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
// 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.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
/// <summary>
|
||||
/// An interface providing a set of methods to update a accuracy counter.
|
||||
/// </summary>
|
||||
public interface IAccuracyCounter : IDrawable
|
||||
{
|
||||
/// <summary>
|
||||
/// The current accuracy to be displayed.
|
||||
/// </summary>
|
||||
Bindable<double> Current { get; }
|
||||
}
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
// 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.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
/// <summary>
|
||||
/// An interface providing a set of methods to update a score counter.
|
||||
/// </summary>
|
||||
public interface IScoreCounter : IDrawable
|
||||
{
|
||||
/// <summary>
|
||||
/// The current score to be displayed.
|
||||
/// </summary>
|
||||
Bindable<double> Current { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The number of digits required to display most sane scores.
|
||||
/// This may be exceeded in very rare cases, but is useful to pad or space the display to avoid it jumping around.
|
||||
/// </summary>
|
||||
Bindable<int> RequiredDisplayDigits { get; }
|
||||
}
|
||||
}
|
@ -1,29 +1,16 @@
|
||||
// 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.Bindables;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public class SkinnableAccuracyCounter : SkinnableDrawable, IAccuracyCounter
|
||||
public class SkinnableAccuracyCounter : SkinnableDrawable
|
||||
{
|
||||
public Bindable<double> Current { get; } = new Bindable<double>();
|
||||
|
||||
public SkinnableAccuracyCounter()
|
||||
: base(new HUDSkinComponent(HUDSkinComponents.AccuracyCounter), _ => new DefaultAccuracyCounter())
|
||||
{
|
||||
CentreComponent = false;
|
||||
}
|
||||
|
||||
private IAccuracyCounter skinnedCounter;
|
||||
|
||||
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
||||
{
|
||||
base.SkinChanged(skin, allowFallback);
|
||||
|
||||
skinnedCounter = Drawable as IAccuracyCounter;
|
||||
skinnedCounter?.Current.BindTo(Current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,61 +1,16 @@
|
||||
// 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.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public class SkinnableScoreCounter : SkinnableDrawable, IScoreCounter
|
||||
public class SkinnableScoreCounter : SkinnableDrawable
|
||||
{
|
||||
public Bindable<double> Current { get; } = new Bindable<double>();
|
||||
|
||||
private Bindable<ScoringMode> scoreDisplayMode;
|
||||
|
||||
public Bindable<int> RequiredDisplayDigits { get; } = new Bindable<int>();
|
||||
|
||||
public SkinnableScoreCounter()
|
||||
: base(new HUDSkinComponent(HUDSkinComponents.ScoreCounter), _ => new DefaultScoreCounter())
|
||||
{
|
||||
CentreComponent = false;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
scoreDisplayMode = config.GetBindable<ScoringMode>(OsuSetting.ScoreDisplayMode);
|
||||
scoreDisplayMode.BindValueChanged(scoreMode =>
|
||||
{
|
||||
switch (scoreMode.NewValue)
|
||||
{
|
||||
case ScoringMode.Standardised:
|
||||
RequiredDisplayDigits.Value = 6;
|
||||
break;
|
||||
|
||||
case ScoringMode.Classic:
|
||||
RequiredDisplayDigits.Value = 8;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(scoreMode));
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
private IScoreCounter skinnedCounter;
|
||||
|
||||
protected override void SkinChanged(ISkinSource skin, bool allowFallback)
|
||||
{
|
||||
base.SkinChanged(skin, allowFallback);
|
||||
|
||||
skinnedCounter = Drawable as IScoreCounter;
|
||||
|
||||
skinnedCounter?.Current.BindTo(Current);
|
||||
skinnedCounter?.RequiredDisplayDigits.BindTo(RequiredDisplayDigits);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -156,9 +156,6 @@ namespace osu.Game.Screens.Play
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(OsuConfigManager config, NotificationOverlay notificationOverlay)
|
||||
{
|
||||
if (scoreProcessor != null)
|
||||
BindScoreProcessor(scoreProcessor);
|
||||
|
||||
if (drawableRuleset != null)
|
||||
{
|
||||
BindDrawableRuleset(drawableRuleset);
|
||||
@ -313,12 +310,6 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
protected virtual PlayerSettingsOverlay CreatePlayerSettingsOverlay() => new PlayerSettingsOverlay();
|
||||
|
||||
protected virtual void BindScoreProcessor(ScoreProcessor processor)
|
||||
{
|
||||
ScoreCounter?.Current.BindTo(processor.TotalScore);
|
||||
AccuracyCounter?.Current.BindTo(processor.Accuracy);
|
||||
}
|
||||
|
||||
public bool OnPressed(GlobalAction action)
|
||||
{
|
||||
switch (action)
|
||||
|
@ -208,8 +208,6 @@ namespace osu.Game.Screens.Play
|
||||
HealthProcessor = ruleset.CreateHealthProcessor(playableBeatmap.HitObjects[0].StartTime);
|
||||
HealthProcessor.ApplyBeatmap(playableBeatmap);
|
||||
|
||||
dependencies.CacheAs(HealthProcessor);
|
||||
|
||||
if (!ScoreProcessor.Mode.Disabled)
|
||||
config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode);
|
||||
|
||||
@ -545,8 +543,10 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
|
||||
// if the score is ready for display but results screen has not been pushed yet (e.g. storyboard is still playing beyond gameplay), then transition to results screen instead of exiting.
|
||||
if (prepareScoreForDisplayTask != null)
|
||||
if (prepareScoreForDisplayTask != null && completionProgressDelegate == null)
|
||||
{
|
||||
updateCompletionState(true);
|
||||
}
|
||||
}
|
||||
|
||||
this.Exit();
|
||||
|
@ -28,6 +28,7 @@ using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.Ranking.Expanded;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
@ -286,7 +287,7 @@ namespace osu.Game.Screens.Select
|
||||
Margin = new MarginPadding { Top = 10 },
|
||||
Direction = FillDirection.Horizontal,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = getMapper(metadata)
|
||||
Child = getMapper(metadata),
|
||||
},
|
||||
infoLabelContainer = new FillFlowContainer
|
||||
{
|
||||
@ -406,24 +407,20 @@ namespace osu.Game.Screens.Select
|
||||
});
|
||||
}
|
||||
|
||||
private OsuSpriteText[] getMapper(BeatmapMetadata metadata)
|
||||
private Drawable getMapper(BeatmapMetadata metadata)
|
||||
{
|
||||
if (string.IsNullOrEmpty(metadata.Author?.Username))
|
||||
return Array.Empty<OsuSpriteText>();
|
||||
if (metadata.Author == null)
|
||||
return Empty();
|
||||
|
||||
return new[]
|
||||
return new LinkFlowContainer(s =>
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "mapped by ",
|
||||
Font = OsuFont.GetFont(size: 15),
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = metadata.Author.Username,
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 15),
|
||||
}
|
||||
};
|
||||
s.Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 15);
|
||||
}).With(d =>
|
||||
{
|
||||
d.AutoSizeAxes = Axes.Both;
|
||||
d.AddText("mapped by ");
|
||||
d.AddUserLink(metadata.Author);
|
||||
});
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
|
@ -71,6 +71,9 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
case SortMode.Author:
|
||||
return string.Compare(BeatmapSet.Metadata.Author.Username, otherSet.BeatmapSet.Metadata.Author.Username, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
case SortMode.Source:
|
||||
return string.Compare(BeatmapSet.Metadata.Source, otherSet.BeatmapSet.Metadata.Source, StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
case SortMode.DateAdded:
|
||||
return otherSet.BeatmapSet.DateAdded.CompareTo(BeatmapSet.DateAdded);
|
||||
|
||||
|
@ -28,7 +28,10 @@ namespace osu.Game.Screens.Select.Filter
|
||||
[Description("Rank Achieved")]
|
||||
RankAchieved,
|
||||
|
||||
[Description("Source")]
|
||||
Source,
|
||||
|
||||
[Description("Title")]
|
||||
Title
|
||||
Title,
|
||||
}
|
||||
}
|
||||
|
@ -4,14 +4,13 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
public class LegacyAccuracyCounter : PercentageCounter, IAccuracyCounter, ISkinnableComponent
|
||||
public class LegacyAccuracyCounter : GameplayAccuracyCounter, ISkinnableComponent
|
||||
{
|
||||
private readonly ISkin skin;
|
||||
|
||||
|
@ -1,24 +1,20 @@
|
||||
// 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.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
public class LegacyScoreCounter : ScoreCounter, ISkinnableComponent
|
||||
public class LegacyScoreCounter : GameplayScoreCounter, ISkinnableComponent
|
||||
{
|
||||
private readonly ISkin skin;
|
||||
|
||||
protected override double RollingDuration => 1000;
|
||||
protected override Easing RollingEasing => Easing.Out;
|
||||
|
||||
public new Bindable<double> Current { get; } = new Bindable<double>();
|
||||
|
||||
public LegacyScoreCounter(ISkin skin)
|
||||
: base(6)
|
||||
{
|
||||
@ -27,9 +23,6 @@ namespace osu.Game.Skinning
|
||||
|
||||
this.skin = skin;
|
||||
|
||||
// base class uses int for display, but externally we bind to ScoreProcessor as a double for now.
|
||||
Current.BindValueChanged(v => base.Current.Value = (int)v.NewValue);
|
||||
|
||||
Scale = new Vector2(0.96f);
|
||||
Margin = new MarginPadding(10);
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Screens.Edit;
|
||||
@ -46,7 +45,7 @@ namespace osu.Game.Tests.Visual
|
||||
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> e)
|
||||
{
|
||||
Clock.ControlPointInfo = e.NewValue.Beatmap.ControlPointInfo;
|
||||
Clock.ChangeSource((IAdjustableClock)e.NewValue.Track ?? new StopwatchClock());
|
||||
Clock.ChangeSource(e.NewValue.Track);
|
||||
Clock.ProcessFrame();
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.NETCore.Targets" Version="3.1.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2021.506.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2021.507.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.422.0" />
|
||||
<PackageReference Include="Sentry" Version="3.3.4" />
|
||||
<PackageReference Include="SharpCompress" Version="0.28.2" />
|
||||
|
@ -70,7 +70,7 @@
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.506.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.507.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.422.0" />
|
||||
</ItemGroup>
|
||||
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
|
||||
@ -93,7 +93,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2021.506.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2021.507.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.28.2" />
|
||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
Loading…
Reference in New Issue
Block a user