refactor logic to its own component and handle hit object to string conversion to its ruleset-specific composers

This commit is contained in:
Nathan Alo
2021-03-26 15:25:20 +08:00
parent 2bea69456e
commit b8b7eb4c4b
5 changed files with 76 additions and 1 deletions

View File

@ -6,6 +6,8 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input;
using osu.Framework.Input.Bindings;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Edit;
@ -14,16 +16,19 @@ using osu.Game.Skinning;
namespace osu.Game.Screens.Edit.Compose
{
public class ComposeScreen : EditorScreenWithTimeline
public class ComposeScreen : EditorScreenWithTimeline, IKeyBindingHandler<PlatformAction>
{
[Resolved]
private IBindable<WorkingBeatmap> beatmap { get; set; }
private HitObjectComposer composer;
private SelectionHelper helper;
public ComposeScreen()
: base(EditorScreenMode.Compose)
{
Add(helper = new SelectionHelper());
}
private Ruleset ruleset;
@ -72,5 +77,21 @@ namespace osu.Game.Screens.Edit.Compose
// this is intentionally done in two stages to ensure things are in a loaded state before exposing the ruleset to skin sources.
return beatmapSkinProvider.WithChild(rulesetSkinProvider.WithChild(content));
}
public bool OnPressed(PlatformAction action)
{
switch (action.ActionType)
{
case PlatformActionType.Copy:
helper.CopySelectionToClipboard();
return false;
default:
return false;
};
}
public void OnReleased(PlatformAction action)
{
}
}
}