-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #284 from andy840119/lyric-editor/implement-time-t…
…ag-display Implement time tag display in lyric editor.
- Loading branch information
Showing
15 changed files
with
311 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
osu.Game.Rulesets.Karaoke/Edit/Lyrics/Components/TimeTags/DrawableTimeTag.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// 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.Sprites; | ||
using osu.Game.Graphics; | ||
using osu.Game.Rulesets.Karaoke.Graphics.Shapes; | ||
using osuTK; | ||
using System; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Edit.Lyrics.Components.TimeTags | ||
{ | ||
public class DrawableTimeTag : CompositeDrawable | ||
{ | ||
/// <summary> | ||
/// Height of major bar line triangles. | ||
/// </summary> | ||
private const float triangle_width = 3; | ||
|
||
private readonly Tuple<TimeTagIndex, double?> timeTag; | ||
|
||
public DrawableTimeTag(Tuple<TimeTagIndex, double?> timeTag) | ||
{ | ||
this.timeTag = timeTag; | ||
|
||
InternalChild = new RightTriangle | ||
{ | ||
Name = "Time tag triangle", | ||
Anchor = Anchor.TopCentre, | ||
Origin = Anchor.Centre, | ||
Size = new Vector2(triangle_width), | ||
Scale = new Vector2(timeTag.Item1.State == TimeTagIndex.IndexState.Start ? 1 : -1, 1) | ||
}; | ||
} | ||
|
||
[BackgroundDependencyLoader] | ||
private void load(OsuColour colours) | ||
{ | ||
InternalChild.Colour = timeTag.Item2.HasValue ? colours.Yellow : colours.Gray7; | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
osu.Game.Rulesets.Karaoke/Edit/Lyrics/DrawableLyricEditList.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright (c) andy840119 <[email protected]>. Licensed under the GPL Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using osu.Game.Graphics.Containers; | ||
using osu.Game.Rulesets.Karaoke.Objects; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Edit.Lyrics | ||
{ | ||
public class DrawableLyricEditList : OsuRearrangeableListContainer<Lyric> | ||
{ | ||
protected override OsuRearrangeableListItem<Lyric> CreateOsuDrawable(Lyric item) | ||
=> new DrawableLyricEditListItem(item); | ||
} | ||
} |
131 changes: 131 additions & 0 deletions
131
osu.Game.Rulesets.Karaoke/Edit/Lyrics/DrawableLyricEditListItem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
// 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.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.Objects; | ||
using osuTK; | ||
|
||
namespace osu.Game.Rulesets.Karaoke.Edit.Lyrics | ||
{ | ||
public class DrawableLyricEditListItem : OsuRearrangeableListItem<Lyric> | ||
{ | ||
private Box background; | ||
private Box dragAlert; | ||
private Box headerBackground; | ||
|
||
public DrawableLyricEditListItem(Lyric item) | ||
: base(item) | ||
{ | ||
} | ||
|
||
protected override Drawable CreateContent() | ||
{ | ||
return new Container | ||
{ | ||
Masking = true, | ||
CornerRadius = 5, | ||
AutoSizeAxes = Axes.Y, | ||
RelativeSizeAxes = Axes.X, | ||
Children = new Drawable[] | ||
{ | ||
background = new Box | ||
{ | ||
RelativeSizeAxes = Axes.Both, | ||
Alpha = 0.3f | ||
}, | ||
dragAlert = new Box | ||
{ | ||
RelativeSizeAxes = Axes.Both, | ||
Alpha = 0 | ||
}, | ||
new GridContainer | ||
{ | ||
RelativeSizeAxes = Axes.X, | ||
AutoSizeAxes = Axes.Y, | ||
Content = new[] | ||
{ | ||
new[] | ||
{ | ||
new Container | ||
{ | ||
RelativeSizeAxes = Axes.Both, | ||
Children = new Drawable[] | ||
{ | ||
headerBackground = new Box | ||
{ | ||
RelativeSizeAxes = Axes.Both, | ||
Alpha = 0.7f | ||
}, | ||
new BadgeFillFlowContainer | ||
{ | ||
Direction = FillDirection.Vertical, | ||
AutoSizeAxes = Axes.Both, | ||
Anchor = Anchor.TopRight, | ||
Origin = Anchor.TopRight, | ||
Spacing = new Vector2(5), | ||
Padding = new MarginPadding(10), | ||
Children = new Badge[] | ||
{ | ||
new TimeInfoBadge(Model), | ||
new StyleInfoBadge(Model), | ||
new LayoutInfoBadge(Model), | ||
} | ||
}, | ||
} | ||
}, | ||
new LyricControl(Model) | ||
{ | ||
Margin = new MarginPadding { Left = 10 }, | ||
RelativeSizeAxes = Axes.X, | ||
} | ||
} | ||
}, | ||
ColumnDimensions = new[] { new Dimension(GridSizeMode.Absolute, 200) }, | ||
RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) } | ||
} | ||
} | ||
}; | ||
} | ||
|
||
[BackgroundDependencyLoader] | ||
private void load(OsuColour colours) | ||
{ | ||
background.Colour = colours.Gray7; | ||
dragAlert.Colour = colours.YellowDarker; | ||
headerBackground.Colour = colours.Gray2; | ||
} | ||
|
||
protected override bool OnDragStart(DragStartEvent e) | ||
{ | ||
if (!base.OnDragStart(e)) | ||
return false; | ||
|
||
dragAlert.Show(); | ||
return true; | ||
} | ||
|
||
protected override void OnDragEnd(DragEndEvent e) | ||
{ | ||
dragAlert.Hide(); | ||
base.OnDragEnd(e); | ||
} | ||
|
||
public class BadgeFillFlowContainer : FillFlowContainer<Badge> | ||
{ | ||
public override void Add(Badge drawable) | ||
{ | ||
drawable.Anchor = Anchor.TopRight; | ||
drawable.Origin = Anchor.TopRight; | ||
base.Add(drawable); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.