mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 20:22:55 +08:00
Merge pull request #24601 from peppy/fix-tournament-song-bar-crash
Fix crash in tournament client when pick/ban is activated
This commit is contained in:
commit
58d5c26bcd
@ -2,27 +2,36 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps.Legacy;
|
using osu.Game.Beatmaps.Legacy;
|
||||||
using osu.Game.Tests.Visual;
|
|
||||||
using osu.Game.Tournament.Components;
|
using osu.Game.Tournament.Components;
|
||||||
using osu.Game.Tournament.Models;
|
using osu.Game.Tournament.Models;
|
||||||
|
|
||||||
namespace osu.Game.Tournament.Tests.Components
|
namespace osu.Game.Tournament.Tests.Components
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public partial class TestSceneSongBar : OsuTestScene
|
public partial class TestSceneSongBar : TournamentTestScene
|
||||||
{
|
{
|
||||||
[Cached]
|
|
||||||
private readonly LadderInfo ladder = new LadderInfo();
|
|
||||||
|
|
||||||
private SongBar songBar = null!;
|
private SongBar songBar = null!;
|
||||||
|
private TournamentBeatmap ladderBeatmap = null!;
|
||||||
|
|
||||||
[SetUpSteps]
|
[SetUpSteps]
|
||||||
public void SetUpSteps()
|
public override void SetUpSteps()
|
||||||
{
|
{
|
||||||
|
base.SetUpSteps();
|
||||||
|
|
||||||
|
AddStep("setup picks bans", () =>
|
||||||
|
{
|
||||||
|
ladderBeatmap = CreateSampleBeatmap();
|
||||||
|
Ladder.CurrentMatch.Value!.PicksBans.Add(new BeatmapChoice
|
||||||
|
{
|
||||||
|
BeatmapID = ladderBeatmap.OnlineID,
|
||||||
|
Team = TeamColour.Red,
|
||||||
|
Type = ChoiceType.Pick,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
AddStep("create bar", () => Child = songBar = new SongBar
|
AddStep("create bar", () => Child = songBar = new SongBar
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
@ -38,12 +47,14 @@ namespace osu.Game.Tournament.Tests.Components
|
|||||||
AddStep("set beatmap", () =>
|
AddStep("set beatmap", () =>
|
||||||
{
|
{
|
||||||
var beatmap = CreateAPIBeatmap(Ruleset.Value);
|
var beatmap = CreateAPIBeatmap(Ruleset.Value);
|
||||||
|
|
||||||
beatmap.CircleSize = 3.4f;
|
beatmap.CircleSize = 3.4f;
|
||||||
beatmap.ApproachRate = 6.8f;
|
beatmap.ApproachRate = 6.8f;
|
||||||
beatmap.OverallDifficulty = 5.5f;
|
beatmap.OverallDifficulty = 5.5f;
|
||||||
beatmap.StarRating = 4.56f;
|
beatmap.StarRating = 4.56f;
|
||||||
beatmap.Length = 123456;
|
beatmap.Length = 123456;
|
||||||
beatmap.BPM = 133;
|
beatmap.BPM = 133;
|
||||||
|
beatmap.OnlineID = ladderBeatmap.OnlineID;
|
||||||
|
|
||||||
songBar.Beatmap = new TournamentBeatmap(beatmap);
|
songBar.Beatmap = new TournamentBeatmap(beatmap);
|
||||||
});
|
});
|
||||||
|
@ -234,7 +234,7 @@ namespace osu.Game.Tournament.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new UnmaskedTournamentBeatmapPanel(beatmap)
|
new TournamentBeatmapPanel(beatmap)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Width = 0.5f,
|
Width = 0.5f,
|
||||||
@ -277,18 +277,4 @@ namespace osu.Game.Tournament.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal partial class UnmaskedTournamentBeatmapPanel : TournamentBeatmapPanel
|
|
||||||
{
|
|
||||||
public UnmaskedTournamentBeatmapPanel(IBeatmapInfo? beatmap, string mod = "")
|
|
||||||
: base(beatmap, mod)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load()
|
|
||||||
{
|
|
||||||
Masking = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user