1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-24 19:17:20 +08:00

Tidy up for pull request attempt

This commit is contained in:
Dean Herbert 2024-12-20 14:21:45 +09:00
parent 4924a35c31
commit 8c7af79f96
No known key found for this signature in database
5 changed files with 37 additions and 22 deletions

View File

@ -6,7 +6,6 @@ using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Screens.Menu;
namespace osu.Game.Tests.Visual.Menus
@ -16,15 +15,12 @@ namespace osu.Game.Tests.Visual.Menus
[Resolved]
private BeatmapManager beatmaps { get; set; } = null!;
[Resolved]
private RealmAccess realm { get; set; } = null!;
[SetUpSteps]
public void SetUpSteps()
{
AddStep("prepare beatmap", () =>
{
var setInfo = beatmaps.QueryBeatmapSet(b => b.Protected && b.Hash == "7e26183e72a496f672c3a21292e6b469fdecd084d31c259ea10a31df5b46cd77");
var setInfo = beatmaps.QueryBeatmapSet(b => b.Protected && b.Hash == IntroChristmas.CHRISTMAS_BEATMAP_SET_HASH);
Beatmap.Value = beatmaps.GetWorkingBeatmap(setInfo!.Value.Beatmaps.First());
});

View File

@ -22,7 +22,10 @@ namespace osu.Game.Screens.Menu
{
public partial class IntroChristmas : IntroScreen
{
protected override string BeatmapHash => "7e26183e72a496f672c3a21292e6b469fdecd084d31c259ea10a31df5b46cd77";
// nekodex - circle the halls
public const string CHRISTMAS_BEATMAP_SET_HASH = "7e26183e72a496f672c3a21292e6b469fdecd084d31c259ea10a31df5b46cd77";
protected override string BeatmapHash => CHRISTMAS_BEATMAP_SET_HASH;
protected override string BeatmapFile => "christmas2024.osz";

View File

@ -31,11 +31,13 @@ namespace osu.Game.Screens.Menu
private List<HitObject> hitObjects = null!;
[Resolved]
private RulesetStore rulesets { get; set; } = null!;
private RulesetInfo? osuRuleset;
private int? lastObjectIndex;
public MainMenuSeasonalLighting()
{
// match beatmap playfield
RelativeChildSize = new Vector2(512, 384);
RelativeSizeAxes = Axes.X;
@ -45,23 +47,37 @@ namespace osu.Game.Screens.Menu
}
[BackgroundDependencyLoader]
private void load(IBindable<WorkingBeatmap> working)
private void load(IBindable<WorkingBeatmap> working, RulesetStore rulesets)
{
this.working = working.GetBoundCopy();
this.working.BindValueChanged(_ => Scheduler.AddOnce(updateBeatmap), true);
// operate in osu! ruleset to keep things simple for now.
osuRuleset = rulesets.GetRuleset(0);
}
private void updateBeatmap()
{
lastObjectIndex = null;
if (osuRuleset == null)
{
beatmapClock = new InterpolatingFramedClock(Clock);
hitObjects = new List<HitObject>();
return;
}
// Intentionally maintain separately so the lighting is not in audio clock space (it shouldn't rewind etc.)
beatmapClock = new InterpolatingFramedClock(new FramedClock(working.Value.Track));
hitObjects = working.Value.GetPlayableBeatmap(rulesets.GetRuleset(0)).HitObjects.SelectMany(h => h.NestedHitObjects.Prepend(h))
hitObjects = working.Value
.GetPlayableBeatmap(osuRuleset)
.HitObjects
.SelectMany(h => h.NestedHitObjects.Prepend(h))
.OrderBy(h => h.StartTime)
.ToList();
}
private int? lastObjectIndex;
protected override void Update()
{
base.Update();
@ -116,19 +132,19 @@ namespace osu.Game.Screens.Menu
}
else
{
// default green
// default are green
Color4 col = SeasonalUI.PRIMARY_COLOUR_2;
// whistle red
// whistles are red
if (h.Samples.Any(s => s.Name == HitSampleInfo.HIT_WHISTLE))
col = SeasonalUI.PRIMARY_COLOUR_1;
// clap is third colour
// clap is third ambient (yellow) colour
else if (h.Samples.Any(s => s.Name == HitSampleInfo.HIT_CLAP))
col = SeasonalUI.AMBIENT_COLOUR_1;
light.Colour = col;
// finish larger lighting
// finish results in larger lighting
if (h.Samples.Any(s => s.Name == HitSampleInfo.HIT_FINISH))
light.Scale = new Vector2(3);
@ -141,7 +157,7 @@ namespace osu.Game.Screens.Menu
light.Expire();
}
public partial class Light : CompositeDrawable
private partial class Light : CompositeDrawable
{
private readonly Circle circle;

View File

@ -163,7 +163,7 @@ namespace osu.Game.Screens.Menu
new Container
{
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
Children = new[]
{
logoContainer = new CircularContainer
{

View File

@ -10,12 +10,12 @@ namespace osu.Game.Screens
{
public static readonly bool ENABLED = true;
public static readonly Color4 PRIMARY_COLOUR_1 = Color4Extensions.FromHex("D32F2F");
public static readonly Color4 PRIMARY_COLOUR_1 = Color4Extensions.FromHex(@"D32F2F");
public static readonly Color4 PRIMARY_COLOUR_2 = Color4Extensions.FromHex("388E3C");
public static readonly Color4 PRIMARY_COLOUR_2 = Color4Extensions.FromHex(@"388E3C");
public static readonly Color4 AMBIENT_COLOUR_1 = Color4Extensions.FromHex("FFC");
public static readonly Color4 AMBIENT_COLOUR_1 = Color4Extensions.FromHex(@"FFFFCC");
public static readonly Color4 AMBIENT_COLOUR_2 = Color4Extensions.FromHex("FFE4B5");
public static readonly Color4 AMBIENT_COLOUR_2 = Color4Extensions.FromHex(@"FFE4B5");
}
}