mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 20:07:29 +08:00
Implement basic appearance of mod preset panels
This commit is contained in:
parent
de0a076eb6
commit
bdff7f1ef4
@ -0,0 +1,74 @@
|
||||
// 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.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Mods;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
[TestFixture]
|
||||
public class TestSceneModPresetPanel : OsuTestScene
|
||||
{
|
||||
[Cached]
|
||||
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
|
||||
|
||||
[Test]
|
||||
public void TestVariousModPresets()
|
||||
{
|
||||
AddStep("create content", () => Child = new FillFlowContainer
|
||||
{
|
||||
Width = 300,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Spacing = new Vector2(0, 5),
|
||||
ChildrenEnumerable = createTestPresets().Select(preset => new ModPresetPanel(preset))
|
||||
});
|
||||
}
|
||||
|
||||
private static IEnumerable<ModPreset> createTestPresets() => new[]
|
||||
{
|
||||
new ModPreset
|
||||
{
|
||||
Name = "First preset",
|
||||
Description = "Please ignore",
|
||||
Mods = new Mod[]
|
||||
{
|
||||
new OsuModHardRock(),
|
||||
new OsuModDoubleTime()
|
||||
}
|
||||
},
|
||||
new ModPreset
|
||||
{
|
||||
Name = "AR0",
|
||||
Description = "For good readers",
|
||||
Mods = new Mod[]
|
||||
{
|
||||
new OsuModDifficultyAdjust
|
||||
{
|
||||
ApproachRate = { Value = 0 }
|
||||
}
|
||||
}
|
||||
},
|
||||
new ModPreset
|
||||
{
|
||||
Name = "This preset is going to have an extraordinarily long name",
|
||||
Description = "This is done so that the capability to truncate overlong texts may be demonstrated",
|
||||
Mods = new Mod[]
|
||||
{
|
||||
new OsuModFlashlight(),
|
||||
new OsuModSpinIn()
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
27
osu.Game/Overlays/Mods/ModPresetPanel.cs
Normal file
27
osu.Game/Overlays/Mods/ModPresetPanel.cs
Normal file
@ -0,0 +1,27 @@
|
||||
// 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.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
public class ModPresetPanel : ModSelectOverlayPanel
|
||||
{
|
||||
public override BindableBool Active { get; } = new BindableBool();
|
||||
|
||||
public ModPresetPanel(ModPreset preset)
|
||||
{
|
||||
Title = preset.Name;
|
||||
Description = preset.Description;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
AccentColour = colours.Orange1;
|
||||
}
|
||||
}
|
||||
}
|
@ -122,6 +122,8 @@ namespace osu.Game.Overlays.Mods
|
||||
titleText = new OsuSpriteText
|
||||
{
|
||||
Font = OsuFont.TorusAlternate.With(size: 18, weight: FontWeight.SemiBold),
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Truncate = true,
|
||||
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0),
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user