Skip to content

Commit

Permalink
Implement switch lyric/note config
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed Oct 31, 2020
1 parent 04901d2 commit e814583
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 19 deletions.
10 changes: 10 additions & 0 deletions osu.Game.Rulesets.Karaoke/Edit/Style/NoteColorSection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright (c) andy840119 <[email protected]>. 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";
}
}
10 changes: 10 additions & 0 deletions osu.Game.Rulesets.Karaoke/Edit/Style/NoteFontSection.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright (c) andy840119 <[email protected]>. 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";
}
}
95 changes: 76 additions & 19 deletions osu.Game.Rulesets.Karaoke/Edit/Style/StyleScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;

Expand Down Expand Up @@ -58,18 +58,9 @@ private void load()
Colour = ColourProvider.Background2,
RelativeSizeAxes = Axes.Both,
},
new SectionsContainer<StyleSection>
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(),
}
}
}
},
Expand All @@ -86,19 +77,85 @@ private void load()
};
}

internal class StyleScreenHeader : OverlayHeader
internal class StyleSectionsContainer : SectionsContainer<StyleSection>
{
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<Style> BindableStyle = new Bindable<Style>();

protected override OverlayTitle CreateTitle() => new LayoutScreenTitle();

protected override Drawable CreateTitleContent()
{
return new Container
{
RelativeSizeAxes = Axes.X,
Padding = new MarginPadding { Left = 100 },
Height = 40,
Child = new OsuEnumDropdown<Style>
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.X,
Current = BindableStyle,
}
};
}

private class LayoutScreenTitle : OverlayTitle
{
public LayoutScreenTitle()
{
Title = "style";
Description = "create style of your beatmap";
IconTexture = "Icons/Hexacons/social";
}
}
}
}
}

public enum Style
{
[System.ComponentModel.Description("Lyric")]
Lyric,

[System.ComponentModel.Description("Note")]
Note
}
}

0 comments on commit e814583

Please sign in to comment.