From e814583c0ebab5fe516b839f99e15b7e29e1410c Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sat, 31 Oct 2020 16:25:39 +0900 Subject: [PATCH] Implement switch lyric/note config --- .../Edit/Style/NoteColorSection.cs | 10 ++ .../Edit/Style/NoteFontSection.cs | 10 ++ .../Edit/Style/StyleScreen.cs | 95 +++++++++++++++---- 3 files changed, 96 insertions(+), 19 deletions(-) create mode 100644 osu.Game.Rulesets.Karaoke/Edit/Style/NoteColorSection.cs create mode 100644 osu.Game.Rulesets.Karaoke/Edit/Style/NoteFontSection.cs diff --git a/osu.Game.Rulesets.Karaoke/Edit/Style/NoteColorSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Style/NoteColorSection.cs new file mode 100644 index 000000000..51119fad7 --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Edit/Style/NoteColorSection.cs @@ -0,0 +1,10 @@ +// Copyright (c) andy840119 . Licensed under the GPL Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace osu.Game.Rulesets.Karaoke.Edit.Style +{ + internal class NoteColorSection : StyleSection + { + protected override string Title => "Color"; + } +} diff --git a/osu.Game.Rulesets.Karaoke/Edit/Style/NoteFontSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Style/NoteFontSection.cs new file mode 100644 index 000000000..fbb32f58a --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Edit/Style/NoteFontSection.cs @@ -0,0 +1,10 @@ +// Copyright (c) andy840119 . Licensed under the GPL Licence. +// See the LICENCE file in the repository root for full licence text. + +namespace osu.Game.Rulesets.Karaoke.Edit.Style +{ + internal class NoteFontSection : StyleSection + { + protected override string Title => "Font"; + } +} diff --git a/osu.Game.Rulesets.Karaoke/Edit/Style/StyleScreen.cs b/osu.Game.Rulesets.Karaoke/Edit/Style/StyleScreen.cs index a7b9e5e31..1a6ba7945 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Style/StyleScreen.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Style/StyleScreen.cs @@ -2,10 +2,12 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Containers; +using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; using osu.Game.Screens.Edit; using osuTK; @@ -14,8 +16,6 @@ namespace osu.Game.Rulesets.Karaoke.Edit.Style { public class StyleScreen : EditorScreen { - private const float section_scale = 0.75f; - [Cached] protected readonly OverlayColourProvider ColourProvider; @@ -58,18 +58,9 @@ private void load() Colour = ColourProvider.Background2, RelativeSizeAxes = Axes.Both, }, - new SectionsContainer + new StyleSectionsContainer { - FixedHeader = new StyleScreenHeader(), RelativeSizeAxes = Axes.Both, - Scale = new Vector2(section_scale), - Size = new Vector2(1 / section_scale), - Children = new StyleSection[] - { - new LyricColorSection(), - new LyricFontSection(), - new LyricShadowSection(), - } } } }, @@ -86,19 +77,85 @@ private void load() }; } - internal class StyleScreenHeader : OverlayHeader + internal class StyleSectionsContainer : SectionsContainer { - protected override OverlayTitle CreateTitle() => new LayoutScreenTitle(); + private const float section_scale = 0.75f; - private class LayoutScreenTitle : OverlayTitle + public StyleSectionsContainer() { - public LayoutScreenTitle() + FixedHeader = new StyleScreenHeader(); + + Scale = new Vector2(section_scale); + Size = new Vector2(1 / section_scale); + + if (FixedHeader is StyleScreenHeader screenHeader) { - Title = "style"; - Description = "create style of your beatmap"; - IconTexture = "Icons/Hexacons/social"; + screenHeader.BindableStyle.BindValueChanged(e => + { + switch (e.NewValue) + { + case Style.Lyric: + Children = new StyleSection[] + { + new LyricColorSection(), + new LyricFontSection(), + new LyricShadowSection(), + }; + break; + case Style.Note: + Children = new StyleSection[] + { + new NoteColorSection(), + new NoteFontSection(), + }; + break; + } + }, true); + } + } + + internal class StyleScreenHeader : OverlayHeader + { + public Bindable