// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Configuration; using osuTK; namespace osu.Game.Tests.Visual.Settings { [TestFixture] public class TestSceneSettingsSource : OsuTestScene { public TestSceneSettingsSource() { Children = new Drawable[] { new FillFlowContainer { RelativeSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Spacing = new Vector2(20), Width = 0.5f, Anchor = Anchor.Centre, Origin = Anchor.Centre, Padding = new MarginPadding(50), ChildrenEnumerable = new TestTargetClass().CreateSettingsControls() }, }; } private class TestTargetClass { [SettingSource("Sample bool", "Clicking this changes a setting")] public BindableBool TickBindable { get; } = new BindableBool(); [SettingSource("Sample float", "Change something for a mod")] public BindableFloat SliderBindable { get; } = new BindableFloat { MinValue = 0, MaxValue = 10, Default = 5, Value = 7 }; [SettingSource("Sample enum", "Change something for a mod")] public Bindable EnumBindable { get; } = new Bindable { Default = TestEnum.Value1, Value = TestEnum.Value2 }; [SettingSource("Sample string", "Change something for a mod")] public Bindable StringBindable { get; } = new Bindable { Default = string.Empty, Value = "Sample text" }; } private enum TestEnum { Value1, Value2 } } }