mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 05:22:54 +08:00
Merge branch 'master' into gameplay-leaderboard-fix
This commit is contained in:
commit
3faa7f5f74
@ -134,7 +134,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
AddAssert("player score matching expected bonus score", () =>
|
||||
{
|
||||
// multipled by 2 to nullify the score multiplier. (autoplay mod selected)
|
||||
double totalScore = ((ScoreExposedPlayer)Player).ScoreProcessor.TotalScore.Value * 2;
|
||||
long totalScore = ((ScoreExposedPlayer)Player).ScoreProcessor.TotalScore.Value * 2;
|
||||
return totalScore == (int)(drawableSpinner.Result.RateAdjustedRotation / 360) * new SpinnerTick().CreateJudgement().MaxNumericResult;
|
||||
});
|
||||
|
||||
|
@ -248,6 +248,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
break;
|
||||
}
|
||||
|
||||
slider.Path.ExpectedDistance.Value = null;
|
||||
piece.ControlPoint.Type = type;
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ namespace osu.Game.Tests.Gameplay
|
||||
// Apply a miss judgement
|
||||
scoreProcessor.ApplyResult(new JudgementResult(new HitObject(), new TestJudgement()) { Type = HitResult.Miss });
|
||||
|
||||
Assert.That(scoreProcessor.TotalScore.Value, Is.EqualTo(0.0));
|
||||
Assert.That(scoreProcessor.TotalScore.Value, Is.EqualTo(0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
private TestGameplayLeaderboard leaderboard;
|
||||
|
||||
private readonly BindableDouble playerScore = new BindableDouble();
|
||||
private readonly BindableLong playerScore = new BindableLong();
|
||||
|
||||
public TestSceneGameplayLeaderboard()
|
||||
{
|
||||
@ -76,8 +76,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
createLeaderboard();
|
||||
addLocalPlayer();
|
||||
|
||||
var player2Score = new BindableDouble(1234567);
|
||||
var player3Score = new BindableDouble(1111111);
|
||||
var player2Score = new BindableLong(1234567);
|
||||
var player3Score = new BindableLong(1111111);
|
||||
|
||||
AddStep("add player 2", () => createLeaderboardScore(player2Score, new APIUser { Username = "Player 2" }));
|
||||
AddStep("add player 3", () => createLeaderboardScore(player3Score, new APIUser { Username = "Player 3" }));
|
||||
@ -161,9 +161,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
});
|
||||
}
|
||||
|
||||
private void createRandomScore(APIUser user) => createLeaderboardScore(new BindableDouble(RNG.Next(0, 5_000_000)), user);
|
||||
private void createRandomScore(APIUser user) => createLeaderboardScore(new BindableLong(RNG.Next(0, 5_000_000)), user);
|
||||
|
||||
private void createLeaderboardScore(BindableDouble score, APIUser user, bool isTracked = false)
|
||||
private void createLeaderboardScore(BindableLong score, APIUser user, bool isTracked = false)
|
||||
{
|
||||
var leaderboardScore = leaderboard.Add(user, isTracked);
|
||||
leaderboardScore.TotalScore.BindTo(score);
|
||||
|
@ -436,6 +436,8 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
{
|
||||
AddUntilStep("Wait for toolbar to load", () => Game.Toolbar.IsLoaded);
|
||||
|
||||
AddStep("import beatmap", () => BeatmapImportHelper.LoadQuickOszIntoOsu(Game).WaitSafely());
|
||||
|
||||
TestPlaySongSelect songSelect = null;
|
||||
PushAndConfirm(() => songSelect = new TestPlaySongSelect());
|
||||
|
||||
|
@ -1055,6 +1055,18 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddUntilStep("mod overlay hidden", () => songSelect!.ModSelect.State.Value == Visibility.Hidden);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestBeatmapOptionsDisabled()
|
||||
{
|
||||
createSongSelect();
|
||||
|
||||
addRulesetImportStep(0);
|
||||
|
||||
AddAssert("options enabled", () => songSelect.ChildrenOfType<FooterButtonOptions>().Single().Enabled.Value);
|
||||
AddStep("delete all beatmaps", () => manager.Delete());
|
||||
AddAssert("options disabled", () => !songSelect.ChildrenOfType<FooterButtonOptions>().Single().Enabled.Value);
|
||||
}
|
||||
|
||||
private void waitForInitialSelection()
|
||||
{
|
||||
AddUntilStep("wait for initial selection", () => !Beatmap.IsDefault);
|
||||
|
@ -3,8 +3,10 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Screens.Select;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
@ -43,6 +45,12 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
InputManager.MoveMouseTo(Vector2.Zero);
|
||||
});
|
||||
|
||||
[Test]
|
||||
public void TestState()
|
||||
{
|
||||
AddRepeatStep("toggle options state", () => this.ChildrenOfType<FooterButton>().Last().Enabled.Toggle(), 20);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestFooterRandom()
|
||||
{
|
||||
|
@ -4,6 +4,7 @@
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
@ -69,6 +70,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
protected Box Background;
|
||||
protected SpriteText SpriteText;
|
||||
|
||||
private readonly Box flashLayer;
|
||||
|
||||
public OsuButton(HoverSampleSet? hoverSounds = HoverSampleSet.Button)
|
||||
{
|
||||
Height = 40;
|
||||
@ -99,6 +102,14 @@ namespace osu.Game.Graphics.UserInterface
|
||||
Depth = float.MinValue
|
||||
},
|
||||
SpriteText = CreateText(),
|
||||
flashLayer = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Blending = BlendingParameters.Additive,
|
||||
Depth = float.MinValue,
|
||||
Colour = Color4.White.Opacity(0.5f),
|
||||
Alpha = 0,
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
@ -125,7 +136,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
if (Enabled.Value)
|
||||
Background.FlashColour(Color4.White, 800, Easing.OutQuint);
|
||||
flashLayer.FadeOutFromOne(800, Easing.OutQuint);
|
||||
|
||||
return base.OnClick(e);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ using osu.Game.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public abstract class ScoreCounter : RollingCounter<double>
|
||||
public abstract class ScoreCounter : RollingCounter<long>
|
||||
{
|
||||
protected override double RollingDuration => 1000;
|
||||
protected override Easing RollingEasing => Easing.Out;
|
||||
@ -36,10 +36,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
UpdateDisplay();
|
||||
}
|
||||
|
||||
protected override double GetProportionalDuration(double currentValue, double newValue) =>
|
||||
protected override double GetProportionalDuration(long currentValue, long newValue) =>
|
||||
currentValue > newValue ? currentValue - newValue : newValue - currentValue;
|
||||
|
||||
protected override LocalisableString FormatCount(double count) => ((long)count).ToLocalisableString(formatString);
|
||||
protected override LocalisableString FormatCount(long count) => count.ToLocalisableString(formatString);
|
||||
|
||||
protected override OsuSpriteText CreateSpriteText()
|
||||
=> base.CreateSpriteText().With(s => s.Font = s.Font.With(fixedWidth: true));
|
||||
|
@ -419,7 +419,7 @@ namespace osu.Game.Online.API
|
||||
failureCount++;
|
||||
log.Add($@"API failure count is now {failureCount}");
|
||||
|
||||
if (failureCount >= 3 && State.Value == APIState.Online)
|
||||
if (failureCount >= 3)
|
||||
{
|
||||
state.Value = APIState.Failing;
|
||||
flushQueue();
|
||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
public bool Passed { get; set; }
|
||||
|
||||
[JsonProperty("total_score")]
|
||||
public int TotalScore { get; set; }
|
||||
public long TotalScore { get; set; }
|
||||
|
||||
[JsonProperty("accuracy")]
|
||||
public double Accuracy { get; set; }
|
||||
@ -213,7 +213,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
public static SoloScoreInfo ForSubmission(ScoreInfo score) => new SoloScoreInfo
|
||||
{
|
||||
Rank = score.Rank,
|
||||
TotalScore = (int)score.TotalScore,
|
||||
TotalScore = score.TotalScore,
|
||||
Accuracy = score.Accuracy,
|
||||
PP = score.PP,
|
||||
MaxCombo = score.MaxCombo,
|
||||
|
@ -7,6 +7,7 @@ using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Development;
|
||||
@ -727,13 +728,20 @@ namespace osu.Game.Online.Multiplayer
|
||||
if (Room == null)
|
||||
return;
|
||||
|
||||
Debug.Assert(APIRoom != null);
|
||||
try
|
||||
{
|
||||
Debug.Assert(APIRoom != null);
|
||||
|
||||
Room.Playlist[Room.Playlist.IndexOf(Room.Playlist.Single(existing => existing.ID == item.ID))] = item;
|
||||
Room.Playlist[Room.Playlist.IndexOf(Room.Playlist.Single(existing => existing.ID == item.ID))] = item;
|
||||
|
||||
int existingIndex = APIRoom.Playlist.IndexOf(APIRoom.Playlist.Single(existing => existing.ID == item.ID));
|
||||
APIRoom.Playlist.RemoveAt(existingIndex);
|
||||
APIRoom.Playlist.Insert(existingIndex, createPlaylistItem(item));
|
||||
int existingIndex = APIRoom.Playlist.IndexOf(APIRoom.Playlist.Single(existing => existing.ID == item.ID));
|
||||
APIRoom.Playlist.RemoveAt(existingIndex);
|
||||
APIRoom.Playlist.Insert(existingIndex, createPlaylistItem(item));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new AggregateException($"Item: {JsonConvert.SerializeObject(createPlaylistItem(item))}\n\nRoom:{JsonConvert.SerializeObject(APIRoom)}", ex);
|
||||
}
|
||||
|
||||
ItemChanged?.Invoke(item);
|
||||
RoomUpdated?.Invoke();
|
||||
|
@ -145,7 +145,9 @@ namespace osu.Game.Online
|
||||
|
||||
private async Task onConnectionClosed(Exception? ex, CancellationToken cancellationToken)
|
||||
{
|
||||
isConnected.Value = false;
|
||||
bool hasBeenCancelled = cancellationToken.IsCancellationRequested;
|
||||
|
||||
await disconnect(true);
|
||||
|
||||
if (ex != null)
|
||||
await handleErrorAndDelay(ex, cancellationToken).ConfigureAwait(false);
|
||||
@ -153,7 +155,7 @@ namespace osu.Game.Online
|
||||
Logger.Log($"{ClientName} disconnected", LoggingTarget.Network);
|
||||
|
||||
// make sure a disconnect wasn't triggered (and this is still the active connection).
|
||||
if (!cancellationToken.IsCancellationRequested)
|
||||
if (!hasBeenCancelled)
|
||||
await Task.Run(connect, default).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@ -174,7 +176,9 @@ namespace osu.Game.Online
|
||||
}
|
||||
finally
|
||||
{
|
||||
isConnected.Value = false;
|
||||
CurrentConnection = null;
|
||||
|
||||
if (takeLock)
|
||||
connectionLock.Release();
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Online.Rooms
|
||||
/// The total scores in the playlist item.
|
||||
/// </summary>
|
||||
[JsonProperty("total")]
|
||||
public int? TotalScores { get; set; }
|
||||
public long? TotalScores { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The user's score, if any.
|
||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Online.Spectator
|
||||
/// <summary>
|
||||
/// The current total score.
|
||||
/// </summary>
|
||||
public readonly BindableDouble TotalScore = new BindableDouble { MinValue = 0 };
|
||||
public readonly BindableLong TotalScore = new BindableLong { MinValue = 0 };
|
||||
|
||||
/// <summary>
|
||||
/// The current accuracy.
|
||||
|
@ -41,11 +41,8 @@ namespace osu.Game.Overlays
|
||||
|
||||
private IBindable<APIUser> apiUser;
|
||||
|
||||
private Drawable currentContent;
|
||||
private Container panelTarget;
|
||||
private FillFlowContainer<BeatmapCard> foundContent;
|
||||
private NotFoundDrawable notFoundContent;
|
||||
private SupporterRequiredDrawable supporterRequiredContent;
|
||||
private BeatmapListingFilterControl filterControl;
|
||||
|
||||
public BeatmapListingOverlay()
|
||||
@ -86,11 +83,6 @@ namespace osu.Game.Overlays
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Masking = true,
|
||||
Padding = new MarginPadding { Horizontal = 20 },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
notFoundContent = new NotFoundDrawable(),
|
||||
supporterRequiredContent = new SupporterRequiredDrawable(),
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
@ -107,7 +99,7 @@ namespace osu.Game.Overlays
|
||||
apiUser.BindValueChanged(_ => Schedule(() =>
|
||||
{
|
||||
if (api.IsLoggedIn)
|
||||
addContentToResultsArea(Drawable.Empty());
|
||||
replaceResultsAreaContent(Drawable.Empty());
|
||||
}));
|
||||
}
|
||||
|
||||
@ -155,8 +147,8 @@ namespace osu.Game.Overlays
|
||||
|
||||
if (searchResult.Type == BeatmapListingFilterControl.SearchResultType.SupporterOnlyFilters)
|
||||
{
|
||||
supporterRequiredContent.UpdateText(searchResult.SupporterOnlyFiltersUsed);
|
||||
addContentToResultsArea(supporterRequiredContent);
|
||||
var supporterOnly = new SupporterRequiredDrawable(searchResult.SupporterOnlyFiltersUsed);
|
||||
replaceResultsAreaContent(supporterOnly);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -167,13 +159,13 @@ namespace osu.Game.Overlays
|
||||
//No matches case
|
||||
if (!newCards.Any())
|
||||
{
|
||||
addContentToResultsArea(notFoundContent);
|
||||
replaceResultsAreaContent(new NotFoundDrawable());
|
||||
return;
|
||||
}
|
||||
|
||||
var content = createCardContainerFor(newCards);
|
||||
|
||||
panelLoadTask = LoadComponentAsync(foundContent = content, addContentToResultsArea, (cancellationToken = new CancellationTokenSource()).Token);
|
||||
panelLoadTask = LoadComponentAsync(foundContent = content, replaceResultsAreaContent, (cancellationToken = new CancellationTokenSource()).Token);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -221,36 +213,16 @@ namespace osu.Game.Overlays
|
||||
return content;
|
||||
}
|
||||
|
||||
private void addContentToResultsArea(Drawable content)
|
||||
private void replaceResultsAreaContent(Drawable content)
|
||||
{
|
||||
Loading.Hide();
|
||||
lastFetchDisplayedTime = Time.Current;
|
||||
|
||||
if (content == currentContent)
|
||||
return;
|
||||
|
||||
var lastContent = currentContent;
|
||||
|
||||
if (lastContent != null)
|
||||
{
|
||||
lastContent.FadeOut();
|
||||
if (!isPlaceholderContent(lastContent))
|
||||
lastContent.Expire();
|
||||
}
|
||||
|
||||
if (!content.IsAlive)
|
||||
panelTarget.Add(content);
|
||||
panelTarget.Child = content;
|
||||
|
||||
content.FadeInFromZero();
|
||||
currentContent = content;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether <paramref name="drawable"/> is a static placeholder reused multiple times by this overlay.
|
||||
/// </summary>
|
||||
private bool isPlaceholderContent(Drawable drawable)
|
||||
=> drawable == notFoundContent || drawable == supporterRequiredContent;
|
||||
|
||||
private void onCardSizeChanged()
|
||||
{
|
||||
if (foundContent?.IsAlive != true || !foundContent.Any())
|
||||
@ -287,7 +259,7 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
private void load(LargeTextureStore textures)
|
||||
{
|
||||
AddInternal(new FillFlowContainer
|
||||
{
|
||||
@ -324,15 +296,19 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
private LinkFlowContainer supporterRequiredText;
|
||||
|
||||
public SupporterRequiredDrawable()
|
||||
private readonly List<LocalisableString> filtersUsed;
|
||||
|
||||
public SupporterRequiredDrawable(List<LocalisableString> filtersUsed)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = 225;
|
||||
Alpha = 0;
|
||||
|
||||
this.filtersUsed = filtersUsed;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
private void load(LargeTextureStore textures)
|
||||
{
|
||||
AddInternal(new FillFlowContainer
|
||||
{
|
||||
@ -360,14 +336,9 @@ namespace osu.Game.Overlays
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void UpdateText(List<LocalisableString> filters)
|
||||
{
|
||||
supporterRequiredText.Clear();
|
||||
|
||||
supporterRequiredText.AddText(
|
||||
BeatmapsStrings.ListingSearchSupporterFilterQuoteDefault(string.Join(" and ", filters), "").ToString(),
|
||||
BeatmapsStrings.ListingSearchSupporterFilterQuoteDefault(string.Join(" and ", filtersUsed), "").ToString(),
|
||||
t =>
|
||||
{
|
||||
t.Font = OsuFont.GetFont(size: 16);
|
||||
|
@ -119,22 +119,17 @@ namespace osu.Game.Overlays.Dashboard.Home.News
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(GameHost host)
|
||||
{
|
||||
NewsPostBackground bg;
|
||||
|
||||
Child = new DelayedLoadWrapper(bg = new NewsPostBackground(post.FirstImage)
|
||||
Child = new DelayedLoadUnloadWrapper(() => new NewsPostBackground(post.FirstImage)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
FillMode = FillMode.Fill,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Alpha = 0
|
||||
})
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
};
|
||||
|
||||
bg.OnLoadComplete += d => d.FadeIn(250, Easing.In);
|
||||
|
||||
TooltipText = "view in browser";
|
||||
Action = () => host.OpenUrlExternally("https://osu.ppy.sh/home/news/" + post.Slug);
|
||||
|
||||
|
@ -49,7 +49,6 @@ namespace osu.Game.Overlays.News
|
||||
Action = () => host.OpenUrlExternally("https://osu.ppy.sh/home/news/" + post.Slug);
|
||||
}
|
||||
|
||||
NewsPostBackground bg;
|
||||
AddRange(new Drawable[]
|
||||
{
|
||||
background = new Box
|
||||
@ -71,14 +70,14 @@ namespace osu.Game.Overlays.News
|
||||
CornerRadius = 6,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new DelayedLoadWrapper(bg = new NewsPostBackground(post.FirstImage)
|
||||
new DelayedLoadUnloadWrapper(() => new NewsPostBackground(post.FirstImage)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
FillMode = FillMode.Fill,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Alpha = 0
|
||||
})
|
||||
}, timeBeforeUnload: 5000)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
},
|
||||
@ -116,8 +115,6 @@ namespace osu.Game.Overlays.News
|
||||
IdleColour = colourProvider.Background4;
|
||||
HoverColour = colourProvider.Background3;
|
||||
|
||||
bg.OnLoadComplete += d => d.FadeIn(250, Easing.In);
|
||||
|
||||
main.AddParagraph(post.Title, t => t.Font = OsuFont.GetFont(size: 20, weight: FontWeight.SemiBold));
|
||||
main.AddParagraph(post.Preview, t => t.Font = OsuFont.GetFont(size: 12)); // Should use sans-serif font
|
||||
main.AddParagraph("by ", t => t.Font = OsuFont.GetFont(size: 12));
|
||||
|
@ -4,6 +4,7 @@
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
|
||||
@ -25,6 +26,12 @@ namespace osu.Game.Overlays.News
|
||||
Texture = store.Get(createUrl(sourceUrl));
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
this.FadeInFromZero(500, Easing.OutQuint);
|
||||
}
|
||||
|
||||
private string createUrl(string source)
|
||||
{
|
||||
if (string.IsNullOrEmpty(source))
|
||||
|
@ -100,7 +100,7 @@ namespace osu.Game.Overlays
|
||||
},
|
||||
Children = new[]
|
||||
{
|
||||
background = new Background(),
|
||||
background = Empty(),
|
||||
title = new OsuSpriteText
|
||||
{
|
||||
Origin = Anchor.BottomCentre,
|
||||
@ -413,7 +413,7 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
private void load(LargeTextureStore textures)
|
||||
{
|
||||
sprite.Texture = beatmap?.Background ?? textures.Get(@"Backgrounds/bg4");
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ namespace osu.Game.Overlays
|
||||
Height = 80;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Masking = true;
|
||||
InternalChild = new Background(textureName);
|
||||
InternalChild = new DelayedLoadWrapper(() => new Background(textureName));
|
||||
}
|
||||
|
||||
private class Background : Sprite
|
||||
@ -36,10 +36,16 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
private void load(LargeTextureStore textures)
|
||||
{
|
||||
Texture = textures.Get(textureName);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
this.FadeInFromZero(500, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Localisation;
|
||||
@ -13,6 +15,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
{
|
||||
protected override LocalisableString Header => BindingSettingsStrings.ShortcutAndGameplayBindings;
|
||||
|
||||
public override IEnumerable<LocalisableString> FilterTerms => base.FilterTerms.Concat(new LocalisableString[] { "keybindings" });
|
||||
|
||||
public BindingSettings(KeyBindingPanel keyConfig)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
|
@ -3,8 +3,6 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
@ -22,8 +20,6 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
|
||||
public override LocalisableString Header => InputSettingsStrings.InputSectionHeader;
|
||||
|
||||
public override IEnumerable<LocalisableString> FilterTerms => base.FilterTerms.Concat(new LocalisableString[] { "keybindings" });
|
||||
|
||||
public override Drawable CreateIcon() => new SpriteIcon
|
||||
{
|
||||
Icon = FontAwesome.Solid.Keyboard
|
||||
|
@ -66,7 +66,7 @@ namespace osu.Game.Rulesets.Difficulty
|
||||
// calculate total score
|
||||
ScoreProcessor scoreProcessor = ruleset.CreateScoreProcessor();
|
||||
scoreProcessor.Mods.Value = perfectPlay.Mods;
|
||||
perfectPlay.TotalScore = (long)scoreProcessor.ComputeScore(ScoringMode.Standardised, perfectPlay);
|
||||
perfectPlay.TotalScore = scoreProcessor.ComputeScore(ScoringMode.Standardised, perfectPlay);
|
||||
|
||||
// compute rank achieved
|
||||
// default to SS, then adjust the rank with mods
|
||||
|
@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// <summary>
|
||||
/// The current total score.
|
||||
/// </summary>
|
||||
public readonly BindableDouble TotalScore = new BindableDouble { MinValue = 0 };
|
||||
public readonly BindableLong TotalScore = new BindableLong { MinValue = 0 };
|
||||
|
||||
/// <summary>
|
||||
/// The current accuracy.
|
||||
@ -267,7 +267,7 @@ namespace osu.Game.Rulesets.Scoring
|
||||
|
||||
private void updateScore()
|
||||
{
|
||||
Accuracy.Value = currentMaximumScoringValues.BaseScore > 0 ? currentScoringValues.BaseScore / currentMaximumScoringValues.BaseScore : 1;
|
||||
Accuracy.Value = currentMaximumScoringValues.BaseScore > 0 ? (double)currentScoringValues.BaseScore / currentMaximumScoringValues.BaseScore : 1;
|
||||
TotalScore.Value = ComputeScore(Mode.Value, currentScoringValues, maximumScoringValues);
|
||||
}
|
||||
|
||||
@ -298,7 +298,7 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// <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>
|
||||
[Pure]
|
||||
public double ComputeScore(ScoringMode mode, ScoreInfo scoreInfo)
|
||||
public long ComputeScore(ScoringMode mode, ScoreInfo scoreInfo)
|
||||
{
|
||||
if (!ruleset.RulesetInfo.Equals(scoreInfo.Ruleset))
|
||||
throw new ArgumentException($"Unexpected score ruleset. Expected \"{ruleset.RulesetInfo.ShortName}\" but was \"{scoreInfo.Ruleset.ShortName}\".");
|
||||
@ -316,9 +316,9 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// <param name="maximum">The maximum scoring values.</param>
|
||||
/// <returns>The total score computed from the given scoring values.</returns>
|
||||
[Pure]
|
||||
public double ComputeScore(ScoringMode mode, ScoringValues current, ScoringValues maximum)
|
||||
public long ComputeScore(ScoringMode mode, ScoringValues current, ScoringValues maximum)
|
||||
{
|
||||
double accuracyRatio = maximum.BaseScore > 0 ? current.BaseScore / maximum.BaseScore : 1;
|
||||
double accuracyRatio = maximum.BaseScore > 0 ? (double)current.BaseScore / maximum.BaseScore : 1;
|
||||
double comboRatio = maximum.MaxCombo > 0 ? (double)current.MaxCombo / maximum.MaxCombo : 1;
|
||||
return ComputeScore(mode, accuracyRatio, comboRatio, current.BonusScore, maximum.CountBasicHitObjects);
|
||||
}
|
||||
@ -333,21 +333,23 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// <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>
|
||||
[Pure]
|
||||
public double ComputeScore(ScoringMode mode, double accuracyRatio, double comboRatio, double bonusScore, int totalBasicHitObjects)
|
||||
public long ComputeScore(ScoringMode mode, double accuracyRatio, double comboRatio, long bonusScore, int totalBasicHitObjects)
|
||||
{
|
||||
double accuracyScore = accuracyPortion * accuracyRatio;
|
||||
double comboScore = comboPortion * comboRatio;
|
||||
double rawScore = (max_score * (accuracyScore + comboScore) + bonusScore) * scoreMultiplier;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
default:
|
||||
case ScoringMode.Standardised:
|
||||
double accuracyScore = accuracyPortion * accuracyRatio;
|
||||
double comboScore = comboPortion * comboRatio;
|
||||
return (max_score * (accuracyScore + comboScore) + bonusScore) * scoreMultiplier;
|
||||
return (long)Math.Round(rawScore);
|
||||
|
||||
case ScoringMode.Classic:
|
||||
// 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 = ComputeScore(ScoringMode.Standardised, accuracyRatio, comboRatio, bonusScore, totalBasicHitObjects) / max_score;
|
||||
return Math.Pow(scaledStandardised * Math.Max(1, totalBasicHitObjects), 2) * ClassicScoreMultiplier;
|
||||
double scaledRawScore = rawScore / max_score;
|
||||
return (long)Math.Round(Math.Pow(scaledRawScore * Math.Max(1, totalBasicHitObjects), 2) * ClassicScoreMultiplier);
|
||||
}
|
||||
}
|
||||
|
||||
@ -417,7 +419,7 @@ namespace osu.Game.Rulesets.Scoring
|
||||
score.MaximumStatistics[result] = maximumResultCounts.GetValueOrDefault(result);
|
||||
|
||||
// Populate total score after everything else.
|
||||
score.TotalScore = (long)Math.Round(ComputeScore(ScoringMode.Standardised, score));
|
||||
score.TotalScore = ComputeScore(ScoringMode.Standardised, score);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -99,7 +99,7 @@ namespace osu.Game.Scoring
|
||||
var scoreProcessor = ruleset.CreateScoreProcessor();
|
||||
scoreProcessor.Mods.Value = score.Mods;
|
||||
|
||||
return (long)Math.Round(scoreProcessor.ComputeScore(mode, score));
|
||||
return scoreProcessor.ComputeScore(mode, score);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -20,13 +20,13 @@ namespace osu.Game.Scoring
|
||||
/// The sum of all "basic" <see cref="HitObject"/> scoring values. See: <see cref="HitResultExtensions.IsBasic"/> and <see cref="Judgement.ToNumericResult"/>.
|
||||
/// </summary>
|
||||
[Key(0)]
|
||||
public double BaseScore;
|
||||
public long BaseScore;
|
||||
|
||||
/// <summary>
|
||||
/// The sum of all "bonus" <see cref="HitObject"/> scoring values. See: <see cref="HitResultExtensions.IsBonus"/> and <see cref="Judgement.ToNumericResult"/>.
|
||||
/// </summary>
|
||||
[Key(1)]
|
||||
public double BonusScore;
|
||||
public long BonusScore;
|
||||
|
||||
/// <summary>
|
||||
/// The highest achieved combo.
|
||||
|
@ -224,8 +224,8 @@ namespace osu.Game.Screens.Menu
|
||||
{
|
||||
rulesetsScale.ScaleTo(0.8f, 1000);
|
||||
rulesets.FadeIn().ScaleTo(1).TransformSpacingTo(new Vector2(200, 0));
|
||||
welcomeText.FadeOut();
|
||||
triangles.FadeOut();
|
||||
welcomeText.FadeOut().Expire();
|
||||
triangles.FadeOut().Expire();
|
||||
}
|
||||
|
||||
using (BeginDelayedSequence(rulesets_2))
|
||||
@ -307,7 +307,7 @@ namespace osu.Game.Screens.Menu
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
private void load(LargeTextureStore textures)
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
|
@ -67,7 +67,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
||||
{
|
||||
await base.PrepareScoreForResultsAsync(score).ConfigureAwait(false);
|
||||
|
||||
Score.ScoreInfo.TotalScore = (int)Math.Round(ScoreProcessor.ComputeScore(ScoringMode.Standardised, Score.ScoreInfo));
|
||||
Score.ScoreInfo.TotalScore = ScoreProcessor.ComputeScore(ScoringMode.Standardised, Score.ScoreInfo);
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
|
@ -50,7 +50,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
private OsuSpriteText positionText, scoreText, accuracyText, comboText, usernameText;
|
||||
|
||||
public BindableDouble TotalScore { get; } = new BindableDouble();
|
||||
public BindableLong TotalScore { get; } = new BindableLong();
|
||||
public BindableDouble Accuracy { get; } = new BindableDouble(1);
|
||||
public BindableInt Combo { get; } = new BindableInt();
|
||||
public BindableBool HasQuit { get; } = new BindableBool();
|
||||
|
@ -9,7 +9,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public interface ILeaderboardScore
|
||||
{
|
||||
BindableDouble TotalScore { get; }
|
||||
BindableLong TotalScore { get; }
|
||||
BindableDouble Accuracy { get; }
|
||||
BindableInt Combo { get; }
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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 System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
@ -184,7 +183,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
continue;
|
||||
|
||||
if (TeamScores.TryGetValue(u.Team.Value, out var team))
|
||||
team.Value += (int)Math.Round(u.ScoreProcessor.TotalScore.Value);
|
||||
team.Value += u.ScoreProcessor.TotalScore.Value;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -85,7 +85,7 @@ namespace osu.Game.Screens.Play
|
||||
api.Queue(req);
|
||||
|
||||
// Generally a timeout would not happen here as APIAccess will timeout first.
|
||||
if (!tcs.Task.Wait(60000))
|
||||
if (!tcs.Task.Wait(30000))
|
||||
req.TriggerFailure(new InvalidOperationException("Token retrieval timed out (request never run)"));
|
||||
|
||||
return true;
|
||||
|
@ -57,7 +57,18 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
}
|
||||
|
||||
private void updateModeLight() => modeLight.FadeColour(buttons.FirstOrDefault(b => b.IsHovered)?.SelectedColour ?? Color4.Transparent, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
private void updateModeLight()
|
||||
{
|
||||
var selectedButton = buttons.FirstOrDefault(b => b.Enabled.Value && b.IsHovered);
|
||||
|
||||
if (selectedButton != null)
|
||||
{
|
||||
modeLight.FadeIn(TRANSITION_LENGTH, Easing.OutQuint);
|
||||
modeLight.FadeColour(selectedButton.SelectedColour, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
}
|
||||
else
|
||||
modeLight.FadeOut(TRANSITION_LENGTH, Easing.OutQuint);
|
||||
}
|
||||
|
||||
public Footer()
|
||||
{
|
||||
@ -78,6 +89,7 @@ namespace osu.Game.Screens.Select
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 3,
|
||||
Position = new Vector2(0, -3),
|
||||
Colour = Color4.Black,
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
|
@ -120,10 +120,18 @@ namespace osu.Game.Screens.Select
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
Enabled.BindValueChanged(_ => updateDisplay(), true);
|
||||
}
|
||||
|
||||
public Action Hovered;
|
||||
public Action HoverLost;
|
||||
public GlobalAction? Hotkey;
|
||||
|
||||
private bool mouseDown;
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
@ -140,32 +148,38 @@ namespace osu.Game.Screens.Select
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
Hovered?.Invoke();
|
||||
light.ScaleTo(new Vector2(1, 2), Footer.TRANSITION_LENGTH, Easing.OutQuint);
|
||||
light.FadeColour(SelectedColour, Footer.TRANSITION_LENGTH, Easing.OutQuint);
|
||||
updateDisplay();
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(HoverLostEvent e)
|
||||
{
|
||||
HoverLost?.Invoke();
|
||||
light.ScaleTo(new Vector2(1, 1), Footer.TRANSITION_LENGTH, Easing.OutQuint);
|
||||
light.FadeColour(DeselectedColour, Footer.TRANSITION_LENGTH, Easing.OutQuint);
|
||||
updateDisplay();
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(MouseDownEvent e)
|
||||
{
|
||||
box.FadeTo(0.3f, Footer.TRANSITION_LENGTH * 2, Easing.OutQuint);
|
||||
if (!Enabled.Value)
|
||||
return true;
|
||||
|
||||
mouseDown = true;
|
||||
updateDisplay();
|
||||
return base.OnMouseDown(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseUpEvent e)
|
||||
{
|
||||
box.FadeOut(Footer.TRANSITION_LENGTH, Easing.OutQuint);
|
||||
mouseDown = false;
|
||||
updateDisplay();
|
||||
base.OnMouseUp(e);
|
||||
}
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
if (!Enabled.Value)
|
||||
return true;
|
||||
|
||||
box.ClearTransforms();
|
||||
box.Alpha = 1;
|
||||
box.FadeOut(Footer.TRANSITION_LENGTH * 3, Easing.OutQuint);
|
||||
@ -184,5 +198,20 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
|
||||
public virtual void OnReleased(KeyBindingReleaseEvent<GlobalAction> e) { }
|
||||
|
||||
private void updateDisplay()
|
||||
{
|
||||
this.FadeTo(Enabled.Value ? 1 : 0.25f, Footer.TRANSITION_LENGTH, Easing.OutQuint);
|
||||
|
||||
light.ScaleTo(Enabled.Value && IsHovered ? new Vector2(1, 2) : new Vector2(1), Footer.TRANSITION_LENGTH, Easing.OutQuint);
|
||||
light.FadeColour(Enabled.Value && IsHovered ? SelectedColour : DeselectedColour, Footer.TRANSITION_LENGTH, Easing.OutQuint);
|
||||
|
||||
box.FadeTo(Enabled.Value & mouseDown ? 0.3f : 0f, Footer.TRANSITION_LENGTH * 2, Easing.OutQuint);
|
||||
|
||||
if (Enabled.Value && IsHovered)
|
||||
Hovered?.Invoke();
|
||||
else
|
||||
HoverLost?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -112,6 +112,8 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
protected BeatmapDetailArea BeatmapDetails { get; private set; }
|
||||
|
||||
private FooterButtonOptions beatmapOptionsButton;
|
||||
|
||||
private readonly Bindable<RulesetInfo> decoupledRuleset = new Bindable<RulesetInfo>();
|
||||
|
||||
private double audioFeedbackLastPlaybackTime;
|
||||
@ -314,7 +316,7 @@ namespace osu.Game.Screens.Select
|
||||
NextRandom = () => Carousel.SelectNextRandom(),
|
||||
PreviousRandom = Carousel.SelectPreviousRandom
|
||||
}, null),
|
||||
(new FooterButtonOptions(), BeatmapOptions)
|
||||
(beatmapOptionsButton = new FooterButtonOptions(), BeatmapOptions)
|
||||
};
|
||||
|
||||
protected virtual ModSelectOverlay CreateModSelectOverlay() => new SoloModSelectOverlay();
|
||||
@ -739,6 +741,16 @@ namespace osu.Game.Screens.Select
|
||||
beatmapInfoWedge.Beatmap = beatmap;
|
||||
|
||||
BeatmapDetails.Beatmap = beatmap;
|
||||
|
||||
bool beatmapSelected = beatmap is not DummyWorkingBeatmap;
|
||||
|
||||
if (beatmapSelected)
|
||||
beatmapOptionsButton.Enabled.Value = true;
|
||||
else
|
||||
{
|
||||
beatmapOptionsButton.Enabled.Value = false;
|
||||
BeatmapOptions.Hide();
|
||||
}
|
||||
}
|
||||
|
||||
private readonly WeakReference<ITrack> lastTrack = new WeakReference<ITrack>(null);
|
||||
|
Loading…
Reference in New Issue
Block a user