Skip to content

Commit

Permalink
Merge pull request #312 from andy840119/lyric-editor/able-to-split-lyric
Browse files Browse the repository at this point in the history
Able to split lyric.
  • Loading branch information
andy840119 authored Dec 13, 2020
2 parents 2982aa3 + 5ecc442 commit edbb0de
Show file tree
Hide file tree
Showing 15 changed files with 441 additions and 232 deletions.
172 changes: 0 additions & 172 deletions osu.Game.Rulesets.Karaoke/Edit/Lyrics/Components/LyricControl.cs

This file was deleted.

55 changes: 4 additions & 51 deletions osu.Game.Rulesets.Karaoke/Edit/Lyrics/DrawableLyricEditListItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@
using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Rulesets.Karaoke.Edit.Lyrics.Components;
using osu.Game.Rulesets.Karaoke.Edit.Lyrics.Components.Badges;
using osu.Game.Rulesets.Karaoke.Edit.Lyrics.Components.Infos;
using osu.Game.Rulesets.Karaoke.Edit.Lyrics.Infos;
using osu.Game.Rulesets.Karaoke.Edit.Lyrics.Lyrics;
using osu.Game.Rulesets.Karaoke.Objects;
using osuTK;

namespace osu.Game.Rulesets.Karaoke.Edit.Lyrics
{
Expand All @@ -25,7 +23,6 @@ public class DrawableLyricEditListItem : OsuRearrangeableListItem<Lyric>

private Box background;
private Box dragAlert;
private Box headerBackground;

public DrawableLyricEditListItem(Lyric item)
: base(item)
Expand Down Expand Up @@ -73,46 +70,13 @@ protected override Drawable CreateContent()
RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize, minSize: min_height, maxSize: max_height) },
Content = new[]
{
new[]
new Drawable[]
{
new Container
new InfoControl(Model)
{
// todo : cannot use relative size to both because it will cause size cannot roll-back if make lyric smaller.
RelativeSizeAxes = Axes.X,
Height = min_height,
Children = new Drawable[]
{
headerBackground = new Box
{
RelativeSizeAxes = Axes.X,
Height = max_height,
Alpha = 0.7f
},
new BadgeFillFlowContainer
{
Direction = FillDirection.Vertical,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Spacing = new Vector2(5),
Children = new Drawable[]
{
new TimeInfoContainer(Model)
{
RelativeSizeAxes = Axes.X,
Height = 36,
},

// todo : in small display size use badge.
// in larger size should use real icon.
new LanguageInfoBadge(Model)
{
Margin = new MarginPadding { Right = 5 }
}
}
},
}
},
new LyricControl(Model)
{
Expand All @@ -131,7 +95,6 @@ private void load(OsuColour colours)
{
background.Colour = colours.Gray7;
dragAlert.Colour = colours.YellowDarker;
headerBackground.Colour = colours.Gray2;
}

protected override bool OnDragStart(DragStartEvent e)
Expand All @@ -148,15 +111,5 @@ protected override void OnDragEnd(DragEndEvent e)
dragAlert.Hide();
base.OnDragEnd(e);
}

public class BadgeFillFlowContainer : FillFlowContainer
{
public override void Add(Drawable drawable)
{
drawable.Anchor = Anchor.TopRight;
drawable.Origin = Anchor.TopRight;
base.Add(drawable);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Karaoke.Objects;

namespace osu.Game.Rulesets.Karaoke.Edit.Lyrics.Components.Badges
namespace osu.Game.Rulesets.Karaoke.Edit.Lyrics.Infos.Badges
{
public abstract class Badge : Container
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using osu.Game.Graphics;
using osu.Game.Rulesets.Karaoke.Objects;

namespace osu.Game.Rulesets.Karaoke.Edit.Lyrics.Components.Badges
namespace osu.Game.Rulesets.Karaoke.Edit.Lyrics.Infos.Badges
{
public class LanguageInfoBadge : Badge
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using osu.Game.Graphics;
using osu.Game.Rulesets.Karaoke.Objects;

namespace osu.Game.Rulesets.Karaoke.Edit.Lyrics.Components.Badges
namespace osu.Game.Rulesets.Karaoke.Edit.Lyrics.Infos.Badges
{
public class LayoutInfoBadge : Badge
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using osu.Game.Graphics;
using osu.Game.Rulesets.Karaoke.Objects;

namespace osu.Game.Rulesets.Karaoke.Edit.Lyrics.Components.Badges
namespace osu.Game.Rulesets.Karaoke.Edit.Lyrics.Infos.Badges
{
public class StyleInfoBadge : Badge
{
Expand Down
79 changes: 79 additions & 0 deletions osu.Game.Rulesets.Karaoke/Edit/Lyrics/Infos/InfoControl.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// Copyright (c) andy840119 <[email protected]>. 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.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Rulesets.Karaoke.Edit.Lyrics.Infos.Badges;
using osu.Game.Rulesets.Karaoke.Edit.Lyrics.Infos.TimeInfo;
using osu.Game.Rulesets.Karaoke.Objects;
using osuTK;

namespace osu.Game.Rulesets.Karaoke.Edit.Lyrics.Infos
{
public class InfoControl : Container
{
private const int max_height = 120;

private readonly Box headerBackground;

public Lyric Lyric { get; }

public InfoControl(Lyric lyric)
{
Lyric = lyric;

Children = new Drawable[]
{
headerBackground = new Box
{
RelativeSizeAxes = Axes.X,
Height = max_height,
Alpha = 0.7f
},
new BadgeFillFlowContainer
{
Direction = FillDirection.Vertical,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Spacing = new Vector2(5),
Children = new Drawable[]
{
new TimeInfoContainer(Lyric)
{
RelativeSizeAxes = Axes.X,
Height = 36,
},

// todo : in small display size use badge.
// in larger size should use real icon.
new LanguageInfoBadge(Lyric)
{
Margin = new MarginPadding { Right = 5 }
}
}
},
};
}

[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
headerBackground.Colour = colours.Gray2;
}

public class BadgeFillFlowContainer : FillFlowContainer
{
public override void Add(Drawable drawable)
{
drawable.Anchor = Anchor.TopRight;
drawable.Origin = Anchor.TopRight;
base.Add(drawable);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Karaoke.Objects;

namespace osu.Game.Rulesets.Karaoke.Edit.Lyrics.Components.Infos
namespace osu.Game.Rulesets.Karaoke.Edit.Lyrics.Infos.TimeInfo
{
public class TimeInfoContainer : Container
{
Expand Down
Loading

0 comments on commit edbb0de

Please sign in to comment.