diff --git a/osu.Game.Rulesets.Karaoke/Edit/Style/ColorSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Style/LyricColorSection.cs similarity index 97% rename from osu.Game.Rulesets.Karaoke/Edit/Style/ColorSection.cs rename to osu.Game.Rulesets.Karaoke/Edit/Style/LyricColorSection.cs index 8405370e0..0ba52fc80 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Style/ColorSection.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Style/LyricColorSection.cs @@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.Karaoke.Edit.Style { - internal class ColorSection : StyleSection + internal class LyricColorSection : StyleSection { private LabelledDropdown colorAreaDropdown; private LabelledDropdown brushTypeDropdown; diff --git a/osu.Game.Rulesets.Karaoke/Edit/Style/FontSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Style/LyricFontSection.cs similarity index 95% rename from osu.Game.Rulesets.Karaoke/Edit/Style/FontSection.cs rename to osu.Game.Rulesets.Karaoke/Edit/Style/LyricFontSection.cs index 0741b82b5..dbb141c7a 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Style/FontSection.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Style/LyricFontSection.cs @@ -11,7 +11,7 @@ namespace osu.Game.Rulesets.Karaoke.Edit.Style { - internal class FontSection : StyleSection + internal class LyricFontSection : StyleSection { private LabelledDropdown fontDropdown; private LabelledSwitchButton boldSwitchButton; @@ -49,7 +49,7 @@ private void load(SkinManager manager) }, borderSliderBar = new LabelledRealTimeSliderBar { - Label = "Bold", + Label = "Border size", Description = "Adjust border size.", Current = new BindableInt { diff --git a/osu.Game.Rulesets.Karaoke/Edit/Style/ShadowSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Style/LyricShadowSection.cs similarity index 97% rename from osu.Game.Rulesets.Karaoke/Edit/Style/ShadowSection.cs rename to osu.Game.Rulesets.Karaoke/Edit/Style/LyricShadowSection.cs index 26dd550dd..8d2b65fe0 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Style/ShadowSection.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Style/LyricShadowSection.cs @@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.Karaoke.Edit.Style { - internal class ShadowSection : StyleSection + internal class LyricShadowSection : StyleSection { private LabelledSwitchButton displayShaderSwitchButton; private LabelledRealTimeSliderBar shadowXSliderBar; diff --git a/osu.Game.Rulesets.Karaoke/Edit/Style/StylePreview.cs b/osu.Game.Rulesets.Karaoke/Edit/Style/LyricStylePreview.cs similarity index 98% rename from osu.Game.Rulesets.Karaoke/Edit/Style/StylePreview.cs rename to osu.Game.Rulesets.Karaoke/Edit/Style/LyricStylePreview.cs index 67ceb64ac..bbfdcd50d 100644 --- a/osu.Game.Rulesets.Karaoke/Edit/Style/StylePreview.cs +++ b/osu.Game.Rulesets.Karaoke/Edit/Style/LyricStylePreview.cs @@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Karaoke.Edit.Style { - internal class StylePreview : Container + internal class LyricStylePreview : Container { [BackgroundDependencyLoader] private void load(OverlayColourProvider colourProvider, StyleManager manager) 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..aebb8b6fc --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Edit/Style/NoteColorSection.cs @@ -0,0 +1,34 @@ +// Copyright (c) andy840119 . Licensed under the GPL Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Game.Rulesets.Karaoke.Graphics.UserInterface; +using osu.Game.Skinning; + +namespace osu.Game.Rulesets.Karaoke.Edit.Style +{ + internal class NoteColorSection : StyleSection + { + private ColorPicker noteColorPicker; + private ColorPicker blinkColorPicker; + + protected override string Title => "Color"; + + [BackgroundDependencyLoader] + private void load(SkinManager manager) + { + Children = new Drawable[] + { + noteColorPicker = new ColorPicker + { + RelativeSizeAxes = Axes.X, + }, + blinkColorPicker = new ColorPicker + { + RelativeSizeAxes = Axes.X, + } + }; + } + } +} 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..1fcf3cd1c --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Edit/Style/NoteFontSection.cs @@ -0,0 +1,36 @@ +// Copyright (c) andy840119 . Licensed under the GPL Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Game.Graphics.UserInterfaceV2; +using osu.Game.Rulesets.Karaoke.Graphics.UserInterface; +using osu.Game.Skinning; + +namespace osu.Game.Rulesets.Karaoke.Edit.Style +{ + internal class NoteFontSection : StyleSection + { + private ColorPicker textColorPicker; + private LabelledSwitchButton boldSwitchButton; + + protected override string Title => "Font"; + + [BackgroundDependencyLoader] + private void load(SkinManager manager) + { + Children = new Drawable[] + { + textColorPicker = new ColorPicker + { + RelativeSizeAxes = Axes.X, + }, + boldSwitchButton = new LabelledSwitchButton + { + Label = "Bold", + Description = "Select bold or not.", + } + }; + } + } +} diff --git a/osu.Game.Rulesets.Karaoke/Edit/Style/NoteStylePreview.cs b/osu.Game.Rulesets.Karaoke/Edit/Style/NoteStylePreview.cs new file mode 100644 index 000000000..c939e63bb --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Edit/Style/NoteStylePreview.cs @@ -0,0 +1,98 @@ +// Copyright (c) andy840119 . Licensed under the GPL Licence. +// 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.Overlays; +using osu.Game.Rulesets.Karaoke.Configuration; +using osu.Game.Rulesets.Karaoke.UI; +using osu.Game.Rulesets.Karaoke.UI.Position; +using osu.Game.Rulesets.UI.Scrolling; +using osu.Game.Rulesets.UI.Scrolling.Algorithms; + +namespace osu.Game.Rulesets.Karaoke.Edit.Style +{ + public class NoteStylePreview : Container + { + private const int preview_column = 9; + + [Cached(Type = typeof(IScrollingInfo))] + private readonly PreviewScrollingInfo scrollingInfo = new PreviewScrollingInfo(); + + [Cached(Type = typeof(IPositionCalculator))] + private readonly PositionCalculator positionCalculator = new PositionCalculator(preview_column); + + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) + { + var configCache = parent.Get(); + var config = (KaraokeRulesetConfigManager)configCache.GetConfigFor(new KaraokeRuleset()); + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); + dependencies.Cache(new KaraokeSessionStatics(config, null)); + + return dependencies; + } + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider, StyleManager manager) + { + Masking = true; + CornerRadius = 15; + FillMode = FillMode.Fit; + FillAspectRatio = 2f; + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = colourProvider.Background1, + }, + new PreviewDrawableNoteArea + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre + } + }; + } + + public class PreviewDrawableNoteArea : NotePlayfield + { + public PreviewDrawableNoteArea() + : base(preview_column) + { + } + } + + public class PreviewScrollingInfo : IScrollingInfo + { + public IBindable Direction { get; } = new Bindable(); + + public IBindable TimeRange { get; } = new BindableDouble(); + + public IScrollAlgorithm Algorithm { get; set; } = new ZeroScrollAlgorithm(); + + private class ZeroScrollAlgorithm : IScrollAlgorithm + { + protected const double START_TIME = 1000000000; + + public double GetDisplayStartTime(double originTime, float offset, double timeRange, float scrollLength) + => double.MinValue; + + public float GetLength(double startTime, double endTime, double timeRange, float scrollLength) + => scrollLength; + + public float PositionAt(double time, double currentTime, double timeRange, float scrollLength) + => (float)((time - START_TIME) / timeRange) * scrollLength; + + public double TimeAt(float position, double currentTime, double timeRange, float scrollLength) + => 0; + + public void Reset() + { + } + } + } + } +} diff --git a/osu.Game.Rulesets.Karaoke/Edit/Style/StyleScreen.cs b/osu.Game.Rulesets.Karaoke/Edit/Style/StyleScreen.cs index a667415c2..408de0674 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,14 +16,15 @@ namespace osu.Game.Rulesets.Karaoke.Edit.Style { public class StyleScreen : EditorScreen { - private const float section_scale = 0.75f; - [Cached] protected readonly OverlayColourProvider ColourProvider; [Cached] protected readonly StyleManager StyleManager; + private StyleSectionsContainer styleSections; + private Container previewContainer; + public StyleScreen() : base(EditorScreenMode.SongSetup) { @@ -58,47 +61,129 @@ private void load() Colour = ColourProvider.Background2, RelativeSizeAxes = Axes.Both, }, - new SectionsContainer + styleSections = new StyleSectionsContainer { - FixedHeader = new StyleScreenHeader(), RelativeSizeAxes = Axes.Both, - Scale = new Vector2(section_scale), - Size = new Vector2(1 / section_scale), - Children = new StyleSection[] - { - new ColorSection(), - new FontSection(), - new ShadowSection(), - } } } }, - new StylePreview + previewContainer = new Container + { + RelativeSizeAxes = Axes.Both, + } + } + }, + }; + + styleSections.BindableStyle.BindValueChanged(e => + { + switch (e.NewValue) + { + case Style.Lyric: + previewContainer.Child = new LyricStylePreview { - Name = "Layout preview area", + Name = "Lyric style preview area", Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(0.95f), RelativeSizeAxes = Axes.Both - }, - } - }, - }; + }; + break; + + case Style.Note: + previewContainer.Child = new NoteStylePreview + { + Name = "Note style preview area", + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Size = new Vector2(0.95f), + RelativeSizeAxes = Axes.Both + }; + break; + }; + }, true); } - internal class StyleScreenHeader : OverlayHeader + internal class StyleSectionsContainer : SectionsContainer { - protected override OverlayTitle CreateTitle() => new LayoutScreenTitle(); + private readonly StyleScreenHeader header; + + private const float section_scale = 0.75f; - private class LayoutScreenTitle : OverlayTitle + public IBindable