2022-04-22 17:05:52 +08:00
|
|
|
// 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 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
2022-04-27 14:59:39 +08:00
|
|
|
using System.Linq;
|
2022-04-22 17:05:52 +08:00
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2022-04-29 06:54:50 +08:00
|
|
|
using osu.Framework.Localisation;
|
2022-04-22 17:05:52 +08:00
|
|
|
using osu.Framework.Testing;
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Containers;
|
2022-05-10 16:35:43 +08:00
|
|
|
using osu.Game.Graphics.UserInterfaceV2;
|
2022-04-22 17:05:52 +08:00
|
|
|
using osu.Game.Localisation;
|
|
|
|
using osu.Game.Overlays.Settings;
|
|
|
|
using osu.Game.Overlays.Settings.Sections;
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.FirstRunSetup
|
|
|
|
{
|
2022-04-29 06:54:50 +08:00
|
|
|
[LocalisableDescription(typeof(FirstRunSetupOverlayStrings), nameof(FirstRunSetupOverlayStrings.Behaviour))]
|
2022-04-22 17:05:52 +08:00
|
|
|
public partial class ScreenBehaviour : FirstRunSetupScreen
|
|
|
|
{
|
|
|
|
private SearchContainer<SettingsSection> searchContainer;
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2022-05-10 16:35:43 +08:00
|
|
|
private void load(OsuColour colours)
|
2022-04-22 17:05:52 +08:00
|
|
|
{
|
|
|
|
Content.Children = new Drawable[]
|
|
|
|
{
|
2022-05-10 16:33:37 +08:00
|
|
|
new OsuTextFlowContainer(cp => cp.Font = OsuFont.Default.With(size: CONTENT_FONT_SIZE))
|
2022-04-22 17:05:52 +08:00
|
|
|
{
|
|
|
|
Text = FirstRunSetupOverlayStrings.BehaviourDescription,
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y
|
|
|
|
},
|
|
|
|
new GridContainer
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
ColumnDimensions = new[]
|
|
|
|
{
|
|
|
|
new Dimension(),
|
|
|
|
new Dimension(GridSizeMode.Absolute, 10),
|
|
|
|
new Dimension(),
|
|
|
|
},
|
|
|
|
RowDimensions = new[]
|
|
|
|
{
|
|
|
|
new Dimension(GridSizeMode.AutoSize),
|
|
|
|
},
|
|
|
|
Content = new[]
|
|
|
|
{
|
|
|
|
new[]
|
|
|
|
{
|
2022-05-10 16:35:43 +08:00
|
|
|
new RoundedButton
|
2022-04-22 17:05:52 +08:00
|
|
|
{
|
|
|
|
Anchor = Anchor.TopLeft,
|
|
|
|
Origin = Anchor.TopLeft,
|
|
|
|
Text = FirstRunSetupOverlayStrings.NewDefaults,
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
Action = applyStandard,
|
|
|
|
},
|
|
|
|
Empty(),
|
2022-05-10 16:35:43 +08:00
|
|
|
new RoundedButton
|
2022-04-22 17:05:52 +08:00
|
|
|
{
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
Origin = Anchor.TopRight,
|
2022-05-10 16:35:43 +08:00
|
|
|
BackgroundColour = colours.Pink3,
|
2022-04-22 17:05:52 +08:00
|
|
|
Text = FirstRunSetupOverlayStrings.ClassicDefaults,
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
Action = applyClassic
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
searchContainer = new SearchContainer<SettingsSection>
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
AutoSizeAxes = Axes.Y,
|
|
|
|
Children = new SettingsSection[]
|
|
|
|
{
|
2022-04-27 15:02:39 +08:00
|
|
|
// This list should be kept in sync with SettingsOverlay.
|
2022-04-22 17:05:52 +08:00
|
|
|
new GeneralSection(),
|
|
|
|
new SkinSection(),
|
2022-04-27 15:02:39 +08:00
|
|
|
// InputSection is intentionally omitted for now due to its sub-panel being a pain to set up.
|
2022-04-22 17:05:52 +08:00
|
|
|
new UserInterfaceSection(),
|
|
|
|
new GameplaySection(),
|
|
|
|
new RulesetSection(),
|
|
|
|
new AudioSection(),
|
|
|
|
new GraphicsSection(),
|
|
|
|
new OnlineSection(),
|
|
|
|
new MaintenanceSection(),
|
|
|
|
new DebugSection(),
|
|
|
|
},
|
|
|
|
SearchTerm = SettingsItem<bool>.CLASSIC_DEFAULT_SEARCH_TERM,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
private void applyClassic()
|
|
|
|
{
|
2022-04-27 14:59:39 +08:00
|
|
|
foreach (var i in searchContainer.ChildrenOfType<ISettingsItem>().Where(s => s.HasClassicDefault))
|
|
|
|
i.ApplyClassicDefault();
|
2022-04-22 17:05:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
private void applyStandard()
|
|
|
|
{
|
2022-04-27 14:59:39 +08:00
|
|
|
foreach (var i in searchContainer.ChildrenOfType<ISettingsItem>().Where(s => s.HasClassicDefault))
|
|
|
|
i.ApplyDefault();
|
2022-04-22 17:05:52 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|