diff --git a/osu.Game.Rulesets.Karaoke.Tests/Edit/TestSceneSinger.cs b/osu.Game.Rulesets.Karaoke.Tests/Edit/TestSceneSinger.cs index c60642a57..d07d796a3 100644 --- a/osu.Game.Rulesets.Karaoke.Tests/Edit/TestSceneSinger.cs +++ b/osu.Game.Rulesets.Karaoke.Tests/Edit/TestSceneSinger.cs @@ -1,236 +1,88 @@ // Copyright (c) andy840119 . Licensed under the GPL Licence. // See the LICENCE file in the repository root for full licence text. -using System.Collections.Generic; -using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; -using osu.Framework.Bindables; -using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Game.Graphics; -using osu.Game.Graphics.Containers; -using osu.Game.Graphics.Sprites; -using osu.Game.Graphics.UserInterface; -using osu.Game.Rulesets.Karaoke.Beatmaps.Metadatas; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Karaoke.Beatmaps; +using osu.Game.Rulesets.Karaoke.Edit.Singers; +using osu.Game.Rulesets.Karaoke.Tests.Beatmaps; +using osu.Game.Screens.Edit; using osu.Game.Tests.Visual; +using osuTK; namespace osu.Game.Rulesets.Karaoke.Tests.Edit { [TestFixture] - public class TestSceneSinger : OsuTestScene + public class TestSceneSinger : OsuManualInputManagerTestScene { - private readonly Box background; - private readonly SingerTableContainer singerTableContainer; - private readonly SingerInfoContainer singerInfoContainer; + [Cached(typeof(EditorBeatmap))] + [Cached(typeof(IBeatSnapProvider))] + private readonly EditorBeatmap editorBeatmap; + + protected override Container Content { get; } = new Container { RelativeSizeAxes = Axes.Both }; public TestSceneSinger() { - Child = new Container + var beatmap = new TestKaraokeBeatmap(null); + var karaokeBeatmap = new KaraokeBeatmapConverter(beatmap, new KaraokeRuleset()).Convert() as KaraokeBeatmap; + // todo : insert singers + karaokeBeatmap.SingerMetadata.CreateSinger(singer => { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Width = 700, - Height = 500, - Masking = true, - CornerRadius = 5, - Children = new Drawable[] - { - background = new Box - { - Name = "Background", - RelativeSizeAxes = Axes.Both - }, - new GridContainer - { - RelativeSizeAxes = Axes.Both, - ColumnDimensions = new[] - { - new Dimension(GridSizeMode.Absolute, 300) - }, - Content = new[] - { - new Drawable[] - { - new OsuScrollContainer - { - RelativeSizeAxes = Axes.Both, - Child = singerTableContainer = new SingerTableContainer() - }, - new OsuScrollContainer - { - RelativeSizeAxes = Axes.Both, - Child = singerInfoContainer = new SingerInfoContainer - { - RelativeSizeAxes = Axes.X - } - } - } - } - } - } - }; - - // todo : add singer. - var singerMetadata = new SingerMetadata(); - singerTableContainer.Metadata = singerMetadata; - - singerTableContainer.BindableSinger.BindValueChanged(x => + singer.Name = "初音ミク"; + singer.RomajiName = "Hatsune Miku"; + singer.EnglishName = "Miku"; + singer.Description = "International superstar vocaloid Hatsune Miku."; + singer.Color = Colour4.AliceBlue; + }); + karaokeBeatmap.SingerMetadata.CreateSinger(singer => { - // Update singer info - singerInfoContainer.Singer = x.NewValue; + singer.Name = "ハク"; + singer.RomajiName = "haku"; + singer.EnglishName = "andy840119"; + singer.Description = "Creator of this ruleset."; + singer.Color = Colour4.Yellow; + }); + karaokeBeatmap.SingerMetadata.CreateSinger(singer => + { + singer.Name = "ゴミパソコン"; + singer.RomajiName = "gomi-pasokonn"; + singer.EnglishName = "garbage desktop"; + singer.Description = "My fucking slow desktop."; + singer.Color = Colour4.Brown; }); - } - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - background.Colour = colours.Gray9; + editorBeatmap = new EditorBeatmap(karaokeBeatmap); } - public class SingerTableContainer : TableContainer + [BackgroundDependencyLoader] + private void load() { - private const float horizontal_inset = 20; - private const float row_height = 10; - - public Bindable BindableSinger { get; } = new Bindable(); - - private readonly FillFlowContainer backgroundFlow; - - public SingerTableContainer() - { - RelativeSizeAxes = Axes.X; - AutoSizeAxes = Axes.Y; - - Padding = new MarginPadding { Horizontal = horizontal_inset }; - RowSize = new Dimension(GridSizeMode.AutoSize); - - AddInternal(backgroundFlow = new FillFlowContainer - { - RelativeSizeAxes = Axes.Both, - Depth = 1f, - Padding = new MarginPadding { Horizontal = -horizontal_inset }, - Margin = new MarginPadding { Top = row_height } - }); - } - - private SingerMetadata metadata; + Beatmap.Value = CreateWorkingBeatmap(editorBeatmap.PlayableBeatmap); - public SingerMetadata Metadata + var beatDivisor = new BindableBeatDivisor { - get => metadata; - set - { - metadata = value; - - Content = null; - backgroundFlow.Clear(); - - var signer = Metadata.Singers; - if (signer?.Any() != true) - return; - - Columns = createHeaders(); - Content = signer.Select(s => createContent(s.ID, s)).ToArray().ToRectangular(); - - // All the singer is not selected - BindableSinger.Value = signer.FirstOrDefault(); - } - } - - private TableColumn[] createHeaders() - { - var columns = new List - { - new TableColumn("Selected", Anchor.Centre, new Dimension(GridSizeMode.Absolute, 50)), - new TableColumn("Singer name", Anchor.Centre), - }; - - return columns.ToArray(); - } + Value = Beatmap.Value.BeatmapInfo.BeatDivisor + }; + var editorClock = new EditorClock(Beatmap.Value, beatDivisor) { IsCoupled = false }; + Dependencies.CacheAs(editorClock); - private Drawable[] createContent(int index, Singer singer) - { - return new Drawable[] - { - new OsuSpriteText - { - Text = $"# {index}" - }, - new OsuSpriteText - { - Text = singer.Name - }, - }; - } + base.Content.Add(Content); } - public class SingerInfoContainer : TableContainer + [SetUp] + public void SetUp() => Schedule(() => { - private readonly OsuTextBox nameTextBox; - private readonly OsuTextBox englishNameTextBox; - private readonly OsuTextBox romajiNameTextBox; + Child = new SingerScreen(); + }); - public SingerInfoContainer() - { - AutoSizeAxes = Axes.Y; - RowSize = new Dimension(GridSizeMode.AutoSize); - Content = new Drawable[,] - { - { - new OsuSpriteText - { - Text = "Singer name :" - }, - nameTextBox = new OsuTextBox - { - RelativeSizeAxes = Axes.X, - } - }, - { - new OsuSpriteText - { - Text = "English name :" - }, - englishNameTextBox = new OsuTextBox - { - RelativeSizeAxes = Axes.X, - } - }, - { - new OsuSpriteText - { - Text = "Romaji name :" - }, - romajiNameTextBox = new OsuTextBox - { - RelativeSizeAxes = Axes.X, - } - }, - }; - - nameTextBox.Current.BindValueChanged(x => { Singer.Name = x.NewValue; }); - - englishNameTextBox.Current.BindValueChanged(x => { Singer.EnglishName = x.NewValue; }); - - romajiNameTextBox.Current.BindValueChanged(x => { Singer.RomajiName = x.NewValue; }); - } - - private Singer singer; - - public Singer Singer - { - get => singer; - set - { - singer = value; - nameTextBox.Text = singer.Name; - englishNameTextBox.Text = singer.EnglishName; - romajiNameTextBox.Text = singer.RomajiName; - } - } + [Test] + public void HoverToSingerArea() + { + // todo : add this step because description is not showing. + AddStep("Move mouse to singer area", () => InputManager.MoveMouseTo(Child, new Vector2(-400,-100))); } } } diff --git a/osu.Game.Rulesets.Karaoke/Beatmaps/Metadatas/Singer.cs b/osu.Game.Rulesets.Karaoke/Beatmaps/Metadatas/Singer.cs index 2178e1e4b..272715bef 100644 --- a/osu.Game.Rulesets.Karaoke/Beatmaps/Metadatas/Singer.cs +++ b/osu.Game.Rulesets.Karaoke/Beatmaps/Metadatas/Singer.cs @@ -21,7 +21,7 @@ public Singer(int id) public string EnglishName { get; set; } - public Color4 Color { get; set; } + public Color4? Color { get; set; } public string Avatar { get; set; } diff --git a/osu.Game.Rulesets.Karaoke/Edit/Singers/Components/DefaultLyricPlacementColumn.cs b/osu.Game.Rulesets.Karaoke/Edit/Singers/Components/DefaultLyricPlacementColumn.cs new file mode 100644 index 000000000..7b907e322 --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Edit/Singers/Components/DefaultLyricPlacementColumn.cs @@ -0,0 +1,22 @@ +// Copyright (c) andy840119 . Licensed under the GPL Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Rulesets.Karaoke.Beatmaps.Metadatas; + +namespace osu.Game.Rulesets.Karaoke.Edit.Singers.Components +{ + public class DefaultLyricPlacementColumn : LyricPlacementColumn + { + public DefaultLyricPlacementColumn() + : base(new Singer(-1) { Name = "Default" }) + { + } + + protected override float SingerInfoSize => 200; + + // todo : might display song info? + protected override Drawable CreateSingerInfo(Singer singer) => new Container(); + } +} diff --git a/osu.Game.Rulesets.Karaoke/Edit/Singers/Components/LyricPlacementColumn.cs b/osu.Game.Rulesets.Karaoke/Edit/Singers/Components/LyricPlacementColumn.cs new file mode 100644 index 000000000..51e31a649 --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Edit/Singers/Components/LyricPlacementColumn.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.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Overlays; +using osu.Game.Rulesets.Edit; +using osu.Game.Rulesets.Karaoke.Beatmaps.Metadatas; +using osu.Game.Screens.Edit.Components.Timelines.Summary.Parts; +using osu.Game.Screens.Edit.Compose.Components; +using osu.Game.Screens.Edit.Compose.Components.Timeline; + +namespace osu.Game.Rulesets.Karaoke.Edit.Singers.Components +{ + public abstract class LyricPlacementColumn : CompositeDrawable + { + private Box background; + private readonly Singer singer; + + protected LyricPlacementColumn(Singer singer) + { + this.singer = singer; + } + + [BackgroundDependencyLoader] + private void load(OverlayColourProvider colourProvider) + { + InternalChildren = new Drawable[] + { + background = new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0.3f, + Colour = colourProvider.Background1, + }, + new GridContainer + { + RelativeSizeAxes = Axes.Both, + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, SingerInfoSize), + new Dimension(GridSizeMode.Absolute, 5), + new Dimension(), + }, + Content = new[] + { + new[] + { + CreateSingerInfo(singer).With(x => + { + x.RelativeSizeAxes = Axes.Both; + }), + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = colourProvider.Dark1, + }, + new SingerLyricBlueprintContainer + { + RelativeSizeAxes = Axes.Both, + } + } + } + } + }; + } + + protected abstract float SingerInfoSize { get; } + + protected abstract Drawable CreateSingerInfo(Singer singer); + + protected class SingerLyricBlueprintContainer : BlueprintContainer + { + [Resolved(CanBeNull = true)] + private Timeline timeline { get; set; } + + protected class TimelineSelectionBlueprintContainer : Container + { + protected override Container Content { get; } + + public TimelineSelectionBlueprintContainer() + { + AddInternal(new SingerLyricPart(Content = new Container { RelativeSizeAxes = Axes.Both }) { RelativeSizeAxes = Axes.Both }); + } + } + + protected class SingerLyricPart : TimelinePart where T : Drawable + { + public SingerLyricPart(Container content = null) + : base(content) + { + } + } + } + } +} diff --git a/osu.Game.Rulesets.Karaoke/Edit/Singers/Components/SingerLyricPlacementColumn.cs b/osu.Game.Rulesets.Karaoke/Edit/Singers/Components/SingerLyricPlacementColumn.cs new file mode 100644 index 000000000..5c6ad0bf9 --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Edit/Singers/Components/SingerLyricPlacementColumn.cs @@ -0,0 +1,112 @@ +// Copyright (c) andy840119 . Licensed under the GPL Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Rulesets.Karaoke.Beatmaps.Metadatas; +using osu.Game.Rulesets.Karaoke.Graphics.Cursor; +using osu.Game.Rulesets.Karaoke.Graphics.Sprites; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Rulesets.Karaoke.Edit.Singers.Components +{ + public class SingerLyricPlacementColumn : LyricPlacementColumn + { + public SingerLyricPlacementColumn(Singer singer) + : base(singer) + { + } + + // todo : implement singer info here + protected override float SingerInfoSize => 178; + + protected override Drawable CreateSingerInfo(Singer singer) + { + return new DrawableSingerInfo(singer) + { + RelativeSizeAxes = Axes.Both, + }; + } + + internal class DrawableSingerInfo : CompositeDrawable, IHasCustomTooltip + { + private readonly Singer singer; + + public DrawableSingerInfo(Singer singer) + { + this.singer = singer; + + InternalChildren = new Drawable[] + { + new Box + { + Name = "Background", + RelativeSizeAxes = Axes.Both, + Colour = singer.Color ?? new Color4(), + Alpha = singer.Color != null ? 0.3f : 0 + }, + new GridContainer + { + Name = "Infos", + RelativeSizeAxes = Axes.Both, + Margin = new MarginPadding(10), + ColumnDimensions = new[] + { + new Dimension(GridSizeMode.AutoSize, 48), + new Dimension(), + }, + Content = new[] + { + new Drawable[] + { + new DrawableSingerAvatar + { + Name = "Avatar", + Size = new Vector2(48) + }, + new FillFlowContainer + { + Name = "Singer name", + RelativeSizeAxes = Axes.X, + Direction = FillDirection.Vertical, + Spacing = new Vector2(1), + Padding = new MarginPadding{ Left = 5 }, + Children = new[] + { + new OsuSpriteText + { + Name = "Singer name", + Text = singer.Name, + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 20), + }, + new OsuSpriteText + { + Name = "Romaji name", + Text = singer.RomajiName, + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 9), + }, + new OsuSpriteText + { + Name = "English name", + Text = singer.EnglishName != null ? $"({singer.EnglishName})" : "", + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 12), + } + } + }, + } + } + }, + }; + } + + public object TooltipContent => singer; + + public ITooltip GetCustomTooltip() => new SingerToolTip(); + } + } +} diff --git a/osu.Game.Rulesets.Karaoke/Edit/Singers/SingerEditSection.cs b/osu.Game.Rulesets.Karaoke/Edit/Singers/SingerEditSection.cs new file mode 100644 index 000000000..3132658e8 --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Edit/Singers/SingerEditSection.cs @@ -0,0 +1,56 @@ +// 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.Framework.Graphics.Containers; +using osu.Game.Rulesets.Karaoke.Edit.Singers.Components; +using System.Linq; + +namespace osu.Game.Rulesets.Karaoke.Edit.Singers +{ + public class SingerEditSection : CompositeDrawable + { + private SingerRearrangeableListContainer singerContainers; + + [BackgroundDependencyLoader] + private void load(SingerManager singerManager) + { + InternalChild = new GridContainer + { + RelativeSizeAxes = Axes.Both, + RowDimensions = new[] + { + new Dimension(GridSizeMode.Absolute, 100), + new Dimension() + }, + Content = new[] + { + new Drawable[] + { + new DefaultLyricPlacementColumn + { + Name = "Default", + RelativeSizeAxes = Axes.Both, + } + }, + new Drawable[] + { + singerContainers = new SingerRearrangeableListContainer + { + Name = "List of singer", + RelativeSizeAxes = Axes.Both, + } + } + } + }; + + singerManager.Singers.BindCollectionChanged((a, b) => + { + var newSingers = singerManager.Singers.ToList(); + singerContainers.Items.Clear(); + singerContainers.Items.AddRange(newSingers); + }, true); + } + } +} diff --git a/osu.Game.Rulesets.Karaoke/Edit/Singers/SingerManager.cs b/osu.Game.Rulesets.Karaoke/Edit/Singers/SingerManager.cs new file mode 100644 index 000000000..1d6797693 --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Edit/Singers/SingerManager.cs @@ -0,0 +1,29 @@ +// 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.Game.Rulesets.Karaoke.Beatmaps; +using osu.Game.Rulesets.Karaoke.Beatmaps.Metadatas; +using osu.Game.Screens.Edit; + +namespace osu.Game.Rulesets.Karaoke.Edit.Singers +{ + public class SingerManager : Component + { + public readonly BindableList Singers = new BindableList(); + + [Resolved] + private EditorBeatmap beatmap { get; set; } + + [BackgroundDependencyLoader] + private void load() + { + if (beatmap?.PlayableBeatmap is KaraokeBeatmap karaokeBeatmap) + { + Singers.AddRange(karaokeBeatmap.SingerMetadata.Singers); + } + } + } +} diff --git a/osu.Game.Rulesets.Karaoke/Edit/Singers/SingerRearrangeableListContainer.cs b/osu.Game.Rulesets.Karaoke/Edit/Singers/SingerRearrangeableListContainer.cs new file mode 100644 index 000000000..dc03e504a --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Edit/Singers/SingerRearrangeableListContainer.cs @@ -0,0 +1,76 @@ +// 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.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.Beatmaps.Metadatas; +using osu.Game.Rulesets.Karaoke.Edit.Singers.Components; + +namespace osu.Game.Rulesets.Karaoke.Edit.Singers +{ + public class SingerRearrangeableListContainer : OsuRearrangeableListContainer + { + protected override OsuRearrangeableListItem CreateOsuDrawable(Singer item) + => new SingerRearrangeableListItem(item); + + public class SingerRearrangeableListItem : OsuRearrangeableListItem + { + private Box dragAlert; + + public SingerRearrangeableListItem(Singer item) + : base(item) + { + } + + protected override Drawable CreateContent() + { + return new Container + { + Masking = true, + CornerRadius = 5, + RelativeSizeAxes = Axes.X, + Height = 90, + Margin = new MarginPadding { Top = 5 }, + Children = new Drawable[] + { + dragAlert = new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0 + }, + new SingerLyricPlacementColumn(Model) + { + RelativeSizeAxes = Axes.Both, + } + } + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + dragAlert.Colour = colours.YellowDarker; + } + + 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); + } + } + } +} diff --git a/osu.Game.Rulesets.Karaoke/Edit/Singers/SingerScreen.cs b/osu.Game.Rulesets.Karaoke/Edit/Singers/SingerScreen.cs new file mode 100644 index 000000000..9149314b6 --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Edit/Singers/SingerScreen.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.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; +using osu.Game.Graphics.Containers; +using osu.Game.Overlays; +using osu.Game.Screens.Edit; + +namespace osu.Game.Rulesets.Karaoke.Edit.Singers +{ + public class SingerScreen : EditorScreen + { + [Cached] + protected readonly OverlayColourProvider ColourProvider; + + [Cached] + protected readonly SingerManager SingerManager; + + public SingerScreen() + : base(EditorScreenMode.SongSetup) + { + ColourProvider = new OverlayColourProvider(OverlayColourScheme.Purple); + Content.Add(SingerManager = new SingerManager()); + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + Child = new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding(50), + Child = new Container + { + RelativeSizeAxes = Axes.Both, + Masking = true, + CornerRadius = 10, + Children = new Drawable[] + { + new Box + { + Colour = colours.GreySeafoamDark, + RelativeSizeAxes = Axes.Both, + }, + new FixedSectionsContainer + { + FixedHeader = new SingerScreenHeader(), + RelativeSizeAxes = Axes.Both, + Children = new[] + { + new SingerEditSection + { + RelativeSizeAxes = Axes.Both, + }, + } + }, + } + } + }; + } + + internal class FixedSectionsContainer : SectionsContainer where T : Drawable + { + private readonly Container content; + + protected override Container Content => content; + + public FixedSectionsContainer() + { + AddInternal(content = new Container + { + Masking = true, + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Top = 55 } + }); + } + } + + internal class SingerScreenHeader : OverlayHeader + { + protected override OverlayTitle CreateTitle() => new TranslateScreenTitle(); + + private class TranslateScreenTitle : OverlayTitle + { + public TranslateScreenTitle() + { + Title = "singer"; + Description = "create singer of your beatmap"; + IconTexture = "Icons/Hexacons/social"; + } + } + } + } +} diff --git a/osu.Game.Rulesets.Karaoke/Graphics/Cursor/SingerToolTip.cs b/osu.Game.Rulesets.Karaoke/Graphics/Cursor/SingerToolTip.cs index 371d66c37..11e357469 100644 --- a/osu.Game.Rulesets.Karaoke/Graphics/Cursor/SingerToolTip.cs +++ b/osu.Game.Rulesets.Karaoke/Graphics/Cursor/SingerToolTip.cs @@ -1,17 +1,14 @@ // Copyright (c) andy840119 . Licensed under the GPL Licence. // See the LICENCE file in the repository root for full licence text. -using System; -using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Sprites; -using osu.Framework.Graphics.Textures; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Karaoke.Beatmaps.Metadatas; +using osu.Game.Rulesets.Karaoke.Graphics.Sprites; using osuTK; using osuTK.Graphics; @@ -90,27 +87,5 @@ public override bool SetContent(object content) return true; } - - public class DrawableSingerAvatar : Container - { - [BackgroundDependencyLoader] - private void load(LargeTextureStore textures) - { - if (textures == null) - throw new ArgumentNullException(nameof(textures)); - - // todo : get real texture from beatmap - Texture texture = textures.Get(@"Online/avatar-guest"); - - Add(new Sprite - { - RelativeSizeAxes = Axes.Both, - Texture = texture, - FillMode = FillMode.Fit, - Anchor = Anchor.Centre, - Origin = Anchor.Centre - }); - } - } } } diff --git a/osu.Game.Rulesets.Karaoke/Graphics/Sprites/DrawableSingerAvatar.cs b/osu.Game.Rulesets.Karaoke/Graphics/Sprites/DrawableSingerAvatar.cs new file mode 100644 index 000000000..f505c39ec --- /dev/null +++ b/osu.Game.Rulesets.Karaoke/Graphics/Sprites/DrawableSingerAvatar.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 System; +using osu.Framework.Allocation; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; + +namespace osu.Game.Rulesets.Karaoke.Graphics.Sprites +{ + public class DrawableSingerAvatar : Container + { + [BackgroundDependencyLoader] + private void load(LargeTextureStore textures) + { + if (textures == null) + throw new ArgumentNullException(nameof(textures)); + + // todo : get real texture from beatmap + Texture texture = textures.Get(@"Online/avatar-guest"); + + Add(new Sprite + { + RelativeSizeAxes = Axes.Both, + Texture = texture, + FillMode = FillMode.Fit, + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }); + } + } +}