mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 15:47:26 +08:00
Merge branch 'master' into fix-taiko-alignment
This commit is contained in:
commit
d26164e9fe
@ -21,9 +21,11 @@ using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Ranking;
|
||||
using osu.Game.Tests.Resources;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
@ -147,6 +149,38 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddUntilStep("score in database", () => Realm.Run(r => r.Find<ScoreInfo>(Player.Score.ScoreInfo.ID) != null));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestReplayExport()
|
||||
{
|
||||
CreateTest();
|
||||
|
||||
AddUntilStep("wait for track to start running", () => Beatmap.Value.Track.IsRunning);
|
||||
|
||||
AddStep("seek to completion", () => Player.GameplayClockContainer.Seek(Player.DrawableRuleset.Objects.Last().GetEndTime()));
|
||||
|
||||
AddUntilStep("results displayed", () => (Player.GetChildScreen() as ResultsScreen)?.IsLoaded == true);
|
||||
AddUntilStep("score in database", () => Realm.Run(r => r.Find<ScoreInfo>(Player.Score.ScoreInfo.ID) != null));
|
||||
|
||||
AddUntilStep("wait for button clickable", () => ((OsuScreen)Player.GetChildScreen())
|
||||
.ChildrenOfType<ReplayDownloadButton>().FirstOrDefault()?
|
||||
.ChildrenOfType<OsuClickableContainer>().FirstOrDefault()?
|
||||
.Enabled.Value == true);
|
||||
|
||||
AddAssert("no export files", () => !LocalStorage.GetFiles("exports").Any());
|
||||
|
||||
AddStep("Export replay", () => InputManager.PressKey(Key.F2));
|
||||
|
||||
string? filePath = null;
|
||||
|
||||
// Files starting with _ are temporary, created by CreateFileSafely call.
|
||||
AddUntilStep("wait for export file", () => filePath = LocalStorage.GetFiles("exports").SingleOrDefault(f => !f.StartsWith("_", StringComparison.Ordinal)), () => Is.Not.Null);
|
||||
AddAssert("filesize is non-zero", () =>
|
||||
{
|
||||
using (var stream = LocalStorage.GetStream(filePath))
|
||||
return stream.Length;
|
||||
}, () => Is.Not.Zero);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestScoreStoredLocallyCustomRuleset()
|
||||
{
|
||||
|
@ -542,7 +542,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
|
||||
AddStep("clear search", () => modSelectOverlay.SearchTerm = string.Empty);
|
||||
AddStep("press enter", () => InputManager.Key(Key.Enter));
|
||||
AddAssert("mod select still visible", () => modSelectOverlay.State.Value == Visibility.Visible);
|
||||
AddAssert("mod select hidden", () => modSelectOverlay.State.Value == Visibility.Hidden);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -1,8 +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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
@ -11,6 +9,7 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Graphics;
|
||||
@ -21,19 +20,18 @@ namespace osu.Game.Tournament.Components
|
||||
{
|
||||
public partial class TournamentBeatmapPanel : CompositeDrawable
|
||||
{
|
||||
public readonly TournamentBeatmap Beatmap;
|
||||
public readonly TournamentBeatmap? Beatmap;
|
||||
|
||||
private readonly string mod;
|
||||
|
||||
public const float HEIGHT = 50;
|
||||
|
||||
private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
|
||||
private Box flash;
|
||||
private readonly Bindable<TournamentMatch?> currentMatch = new Bindable<TournamentMatch?>();
|
||||
|
||||
public TournamentBeatmapPanel(TournamentBeatmap beatmap, string mod = null)
|
||||
private Box flash = null!;
|
||||
|
||||
public TournamentBeatmapPanel(TournamentBeatmap? beatmap, string mod = "")
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(beatmap);
|
||||
|
||||
Beatmap = beatmap;
|
||||
this.mod = mod;
|
||||
|
||||
@ -73,7 +71,7 @@ namespace osu.Game.Tournament.Components
|
||||
{
|
||||
new TournamentSpriteText
|
||||
{
|
||||
Text = Beatmap.GetDisplayTitleRomanisable(false, false),
|
||||
Text = Beatmap?.GetDisplayTitleRomanisable(false, false) ?? (LocalisableString)@"unknown",
|
||||
Font = OsuFont.Torus.With(weight: FontWeight.Bold),
|
||||
},
|
||||
new FillFlowContainer
|
||||
@ -90,7 +88,7 @@ namespace osu.Game.Tournament.Components
|
||||
},
|
||||
new TournamentSpriteText
|
||||
{
|
||||
Text = Beatmap.Metadata.Author.Username,
|
||||
Text = Beatmap?.Metadata.Author.Username ?? "unknown",
|
||||
Padding = new MarginPadding { Right = 20 },
|
||||
Font = OsuFont.Torus.With(weight: FontWeight.Bold, size: 14)
|
||||
},
|
||||
@ -102,7 +100,7 @@ namespace osu.Game.Tournament.Components
|
||||
},
|
||||
new TournamentSpriteText
|
||||
{
|
||||
Text = Beatmap.DifficultyName,
|
||||
Text = Beatmap?.DifficultyName ?? "unknown",
|
||||
Font = OsuFont.Torus.With(weight: FontWeight.Bold, size: 14)
|
||||
},
|
||||
}
|
||||
@ -131,36 +129,37 @@ namespace osu.Game.Tournament.Components
|
||||
}
|
||||
}
|
||||
|
||||
private void matchChanged(ValueChangedEvent<TournamentMatch> match)
|
||||
private void matchChanged(ValueChangedEvent<TournamentMatch?> match)
|
||||
{
|
||||
if (match.OldValue != null)
|
||||
match.OldValue.PicksBans.CollectionChanged -= picksBansOnCollectionChanged;
|
||||
match.NewValue.PicksBans.CollectionChanged += picksBansOnCollectionChanged;
|
||||
if (match.NewValue != null)
|
||||
match.NewValue.PicksBans.CollectionChanged += picksBansOnCollectionChanged;
|
||||
|
||||
updateState();
|
||||
}
|
||||
|
||||
private void picksBansOnCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
|
||||
private void picksBansOnCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e)
|
||||
=> updateState();
|
||||
|
||||
private BeatmapChoice choice;
|
||||
private BeatmapChoice? choice;
|
||||
|
||||
private void updateState()
|
||||
{
|
||||
var found = currentMatch.Value.PicksBans.FirstOrDefault(p => p.BeatmapID == Beatmap.OnlineID);
|
||||
var newChoice = currentMatch.Value?.PicksBans.FirstOrDefault(p => p.BeatmapID == Beatmap?.OnlineID);
|
||||
|
||||
bool doFlash = found != choice;
|
||||
choice = found;
|
||||
bool shouldFlash = newChoice != choice;
|
||||
|
||||
if (found != null)
|
||||
if (newChoice != null)
|
||||
{
|
||||
if (doFlash)
|
||||
flash?.FadeOutFromOne(500).Loop(0, 10);
|
||||
if (shouldFlash)
|
||||
flash.FadeOutFromOne(500).Loop(0, 10);
|
||||
|
||||
BorderThickness = 6;
|
||||
|
||||
BorderColour = TournamentGame.GetTeamColour(found.Team);
|
||||
BorderColour = TournamentGame.GetTeamColour(newChoice.Team);
|
||||
|
||||
switch (found.Type)
|
||||
switch (newChoice.Type)
|
||||
{
|
||||
case ChoiceType.Pick:
|
||||
Colour = Color4.White;
|
||||
@ -179,6 +178,8 @@ namespace osu.Game.Tournament.Components
|
||||
BorderThickness = 0;
|
||||
Alpha = 1;
|
||||
}
|
||||
|
||||
choice = newChoice;
|
||||
}
|
||||
|
||||
private partial class NoUnloadBeatmapSetCover : UpdateableOnlineBeatmapSetCover
|
||||
|
@ -1,8 +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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace osu.Game.Tournament.Models
|
||||
@ -10,9 +8,10 @@ namespace osu.Game.Tournament.Models
|
||||
public class RoundBeatmap
|
||||
{
|
||||
public int ID;
|
||||
public string Mods;
|
||||
|
||||
public string Mods = string.Empty;
|
||||
|
||||
[JsonProperty("BeatmapInfo")]
|
||||
public TournamentBeatmap Beatmap;
|
||||
public TournamentBeatmap? Beatmap;
|
||||
}
|
||||
}
|
||||
|
@ -139,9 +139,11 @@ namespace osu.Game.Tournament.Screens.Editors
|
||||
|
||||
public void CreateNew()
|
||||
{
|
||||
var user = new RoundBeatmap();
|
||||
round.Beatmaps.Add(user);
|
||||
flow.Add(new RoundBeatmapRow(round, user));
|
||||
var b = new RoundBeatmap();
|
||||
|
||||
round.Beatmaps.Add(b);
|
||||
|
||||
flow.Add(new RoundBeatmapRow(round, b));
|
||||
}
|
||||
|
||||
public partial class RoundBeatmapRow : CompositeDrawable
|
||||
|
@ -165,11 +165,11 @@ namespace osu.Game.Tournament.Screens.MapPool
|
||||
|
||||
if (map != null)
|
||||
{
|
||||
if (e.Button == MouseButton.Left && map.Beatmap.OnlineID > 0)
|
||||
if (e.Button == MouseButton.Left && map.Beatmap?.OnlineID > 0)
|
||||
addForBeatmap(map.Beatmap.OnlineID);
|
||||
else
|
||||
{
|
||||
var existing = CurrentMatch.Value.PicksBans.FirstOrDefault(p => p.BeatmapID == map.Beatmap.OnlineID);
|
||||
var existing = CurrentMatch.Value.PicksBans.FirstOrDefault(p => p.BeatmapID == map.Beatmap?.OnlineID);
|
||||
|
||||
if (existing != null)
|
||||
{
|
||||
@ -195,7 +195,7 @@ namespace osu.Game.Tournament.Screens.MapPool
|
||||
if (CurrentMatch.Value == null)
|
||||
return;
|
||||
|
||||
if (CurrentMatch.Value.Round.Value.Beatmaps.All(b => b.Beatmap.OnlineID != beatmapId))
|
||||
if (CurrentMatch.Value.Round.Value.Beatmaps.All(b => b.Beatmap?.OnlineID != beatmapId))
|
||||
// don't attempt to add if the beatmap isn't in our pool
|
||||
return;
|
||||
|
||||
|
@ -11,6 +11,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterfaceV2;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Overlays;
|
||||
@ -57,14 +58,18 @@ namespace osu.Game.Tournament.Screens.Setup
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.Gray(0.2f),
|
||||
},
|
||||
fillFlow = new FillFlowContainer
|
||||
new OsuScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Padding = new MarginPadding(10),
|
||||
Spacing = new Vector2(10),
|
||||
}
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = fillFlow = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Padding = new MarginPadding(10),
|
||||
Spacing = new Vector2(10),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
api.LocalUser.BindValueChanged(_ => Schedule(reload));
|
||||
|
@ -19,7 +19,6 @@ using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Online;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Tournament.IO;
|
||||
using osu.Game.Tournament.IPC;
|
||||
using osu.Game.Tournament.Models;
|
||||
@ -236,7 +235,7 @@ namespace osu.Game.Tournament
|
||||
{
|
||||
var beatmapsRequiringPopulation = ladder.Rounds
|
||||
.SelectMany(r => r.Beatmaps)
|
||||
.Where(b => b.Beatmap?.OnlineID == 0 && b.ID > 0).ToList();
|
||||
.Where(b => (b.Beatmap == null || b.Beatmap?.OnlineID == 0) && b.ID > 0).ToList();
|
||||
|
||||
if (beatmapsRequiringPopulation.Count == 0)
|
||||
return false;
|
||||
@ -245,7 +244,9 @@ namespace osu.Game.Tournament
|
||||
{
|
||||
var b = beatmapsRequiringPopulation[i];
|
||||
|
||||
b.Beatmap = new TournamentBeatmap(await beatmapCache.GetBeatmapAsync(b.ID).ConfigureAwait(false) ?? new APIBeatmap());
|
||||
var populated = await beatmapCache.GetBeatmapAsync(b.ID).ConfigureAwait(false);
|
||||
if (populated != null)
|
||||
b.Beatmap = new TournamentBeatmap(populated);
|
||||
|
||||
updateLoadProgressMessage($"Populating round beatmaps ({i} / {beatmapsRequiringPopulation.Count})");
|
||||
}
|
||||
@ -270,7 +271,9 @@ namespace osu.Game.Tournament
|
||||
{
|
||||
var b = beatmapsRequiringPopulation[i];
|
||||
|
||||
b.Beatmap = new TournamentBeatmap(await beatmapCache.GetBeatmapAsync(b.ID).ConfigureAwait(false) ?? new APIBeatmap());
|
||||
var populated = await beatmapCache.GetBeatmapAsync(b.ID).ConfigureAwait(false);
|
||||
if (populated != null)
|
||||
b.Beatmap = new TournamentBeatmap(populated);
|
||||
|
||||
updateLoadProgressMessage($"Populating seeding beatmaps ({i} / {beatmapsRequiringPopulation.Count})");
|
||||
}
|
||||
|
@ -638,8 +638,12 @@ namespace osu.Game.Overlays.Mods
|
||||
case GlobalAction.Select:
|
||||
{
|
||||
// Pressing select should select first filtered mod if a search is in progress.
|
||||
// If there is no search in progress, it should exit the dialog (a bit weird, but this is the expectation from stable).
|
||||
if (string.IsNullOrEmpty(SearchTerm))
|
||||
{
|
||||
hideOverlay(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
ModState? firstMod = columnFlow.Columns.OfType<ModColumn>().FirstOrDefault(m => m.IsPresent)?.AvailableMods.FirstOrDefault(x => x.Visible);
|
||||
|
||||
|
@ -22,6 +22,7 @@ using osu.Framework.Threading;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Extensions;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.IO.Archives;
|
||||
@ -1170,6 +1171,7 @@ namespace osu.Game.Screens.Play
|
||||
// because of the clone above, it's required that we copy back the post-import hash/ID to use for availability matching.
|
||||
score.ScoreInfo.Hash = s.Hash;
|
||||
score.ScoreInfo.ID = s.ID;
|
||||
score.ScoreInfo.Files.AddRange(s.Files.Detach());
|
||||
});
|
||||
|
||||
return Task.CompletedTask;
|
||||
|
@ -107,6 +107,9 @@ namespace osu.Game.Screens.Ranking
|
||||
|
||||
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||
{
|
||||
if (e.Repeat)
|
||||
return false;
|
||||
|
||||
switch (e.Action)
|
||||
{
|
||||
case GlobalAction.SaveReplay:
|
||||
|
Loading…
Reference in New Issue
Block a user