osu/osu.Game/Screens/Edit/Setup/SetupScreen.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

73 lines
2.4 KiB
C#
Raw Normal View History

// 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.
2022-06-17 07:37:17 +00:00
#nullable disable
using System.Collections.Generic;
2020-09-07 10:21:35 +00:00
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
2020-09-07 10:21:35 +00:00
using osu.Game.Graphics.Containers;
using osu.Game.Overlays;
2020-09-07 10:21:35 +00:00
namespace osu.Game.Screens.Edit.Setup
{
public class SetupScreen : EditorScreen
{
2021-04-03 18:02:26 +00:00
[Cached]
private SectionsContainer<SetupSection> sections { get; } = new SetupScreenSectionsContainer();
2021-04-03 18:02:26 +00:00
2021-04-04 10:50:50 +00:00
[Cached]
private SetupScreenHeader header = new SetupScreenHeader();
public SetupScreen()
: base(EditorScreenMode.SongSetup)
{
}
2020-09-07 10:21:35 +00:00
[BackgroundDependencyLoader]
private void load(EditorBeatmap beatmap, OverlayColourProvider colourProvider)
{
var sectionsEnumerable = new List<SetupSection>
{
new ResourcesSection(),
new MetadataSection(),
new DifficultySection(),
new ColoursSection(),
new DesignSection(),
};
2022-01-12 13:34:07 +00:00
var rulesetSpecificSection = beatmap.BeatmapInfo.Ruleset.CreateInstance().CreateEditorSetupSection();
if (rulesetSpecificSection != null)
sectionsEnumerable.Add(rulesetSpecificSection);
Add(new Box
{
Colour = colourProvider.Background3,
RelativeSizeAxes = Axes.Both,
});
Add(sections.With(s =>
2020-09-07 10:21:35 +00:00
{
s.RelativeSizeAxes = Axes.Both;
s.ChildrenEnumerable = sectionsEnumerable;
s.FixedHeader = header;
}));
}
private class SetupScreenSectionsContainer : SectionsContainer<SetupSection>
{
protected override UserTrackingScrollContainer CreateScrollContainer()
{
var scrollContainer = base.CreateScrollContainer();
// Workaround for masking issues (see https://github.com/ppy/osu-framework/issues/1675#issuecomment-910023157)
// Note that this actually causes the full scroll range to be reduced by 2px at the bottom, but it's not really noticeable.
scrollContainer.Margin = new MarginPadding { Top = 2 };
return scrollContainer;
}
}
}
}