mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 10:03:05 +08:00
Merge pull request #12030 from LeNitrous/editor-platform-clipboard-copy
This commit is contained in:
commit
690debe507
@ -119,5 +119,8 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
beatSnapGrid.SelectionTimeRange = null;
|
beatSnapGrid.SelectionTimeRange = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override string ConvertSelectionToString()
|
||||||
|
=> string.Join(',', EditorBeatmap.SelectedHitObjects.Cast<ManiaHitObject>().OrderBy(h => h.StartTime).Select(h => $"{h.StartTime}|{h.Column}"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,6 +82,9 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
protected override ComposeBlueprintContainer CreateBlueprintContainer()
|
protected override ComposeBlueprintContainer CreateBlueprintContainer()
|
||||||
=> new OsuBlueprintContainer(this);
|
=> new OsuBlueprintContainer(this);
|
||||||
|
|
||||||
|
public override string ConvertSelectionToString()
|
||||||
|
=> string.Join(',', selectedHitObjects.Cast<OsuHitObject>().OrderBy(h => h.StartTime).Select(h => (h.IndexInCurrentCombo + 1).ToString()));
|
||||||
|
|
||||||
private DistanceSnapGrid distanceSnapGrid;
|
private DistanceSnapGrid distanceSnapGrid;
|
||||||
private Container distanceSnapGridContainer;
|
private Container distanceSnapGridContainer;
|
||||||
|
|
||||||
|
@ -438,6 +438,8 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract bool CursorInPlacementArea { get; }
|
public abstract bool CursorInPlacementArea { get; }
|
||||||
|
|
||||||
|
public virtual string ConvertSelectionToString() => string.Empty;
|
||||||
|
|
||||||
#region IPositionSnapProvider
|
#region IPositionSnapProvider
|
||||||
|
|
||||||
public abstract SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition);
|
public abstract SnapResult SnapScreenSpacePositionToValidTime(Vector2 screenSpacePosition);
|
||||||
|
@ -2,11 +2,16 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using osu.Framework.Input.Bindings;
|
||||||
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Extensions;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Edit;
|
using osu.Game.Rulesets.Edit;
|
||||||
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
using osu.Game.Screens.Edit.Compose.Components.Timeline;
|
||||||
@ -14,11 +19,17 @@ using osu.Game.Skinning;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Edit.Compose
|
namespace osu.Game.Screens.Edit.Compose
|
||||||
{
|
{
|
||||||
public class ComposeScreen : EditorScreenWithTimeline
|
public class ComposeScreen : EditorScreenWithTimeline, IKeyBindingHandler<PlatformAction>
|
||||||
{
|
{
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IBindable<WorkingBeatmap> beatmap { get; set; }
|
private IBindable<WorkingBeatmap> beatmap { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private GameHost host { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private EditorClock clock { get; set; }
|
||||||
|
|
||||||
private HitObjectComposer composer;
|
private HitObjectComposer composer;
|
||||||
|
|
||||||
public ComposeScreen()
|
public ComposeScreen()
|
||||||
@ -72,5 +83,34 @@ 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.
|
// 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));
|
return beatmapSkinProvider.WithChild(rulesetSkinProvider.WithChild(content));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Input Handling
|
||||||
|
|
||||||
|
public bool OnPressed(PlatformAction action)
|
||||||
|
{
|
||||||
|
if (action.ActionType == PlatformActionType.Copy)
|
||||||
|
host.GetClipboard().SetText(formatSelectionAsString());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnReleased(PlatformAction action)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private string formatSelectionAsString()
|
||||||
|
{
|
||||||
|
if (composer == null)
|
||||||
|
return string.Empty;
|
||||||
|
|
||||||
|
double displayTime = EditorBeatmap.SelectedHitObjects.OrderBy(h => h.StartTime).FirstOrDefault()?.StartTime ?? clock.CurrentTime;
|
||||||
|
string selectionAsString = composer.ConvertSelectionToString();
|
||||||
|
|
||||||
|
return !string.IsNullOrEmpty(selectionAsString)
|
||||||
|
? $"{displayTime.ToEditorFormattedString()} ({selectionAsString}) - "
|
||||||
|
: $"{displayTime.ToEditorFormattedString()} - ";
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@ using osu.Framework.Input;
|
|||||||
using osu.Framework.Input.Bindings;
|
using osu.Framework.Input.Bindings;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Platform;
|
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
@ -103,7 +102,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
private MusicController music { get; set; }
|
private MusicController music { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, GameHost host, OsuConfigManager config)
|
private void load(OsuColour colours, OsuConfigManager config)
|
||||||
{
|
{
|
||||||
var loadableBeatmap = Beatmap.Value;
|
var loadableBeatmap = Beatmap.Value;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user