mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 21:07:18 +09:00
Merge remote-tracking branch 'refs/remotes/ppy/master' into vote-pill-fix
This commit is contained in:
commit
b35b3484ca
@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
editorClock = clock;
|
editorClock = clock;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void HandleMovement(MoveSelectionEvent moveEvent)
|
public override bool HandleMovement(MoveSelectionEvent moveEvent)
|
||||||
{
|
{
|
||||||
var maniaBlueprint = (ManiaSelectionBlueprint)moveEvent.Blueprint;
|
var maniaBlueprint = (ManiaSelectionBlueprint)moveEvent.Blueprint;
|
||||||
int lastColumn = maniaBlueprint.DrawableObject.HitObject.Column;
|
int lastColumn = maniaBlueprint.DrawableObject.HitObject.Column;
|
||||||
@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Mania.Edit
|
|||||||
performDragMovement(moveEvent);
|
performDragMovement(moveEvent);
|
||||||
performColumnMovement(lastColumn, moveEvent);
|
performColumnMovement(lastColumn, moveEvent);
|
||||||
|
|
||||||
base.HandleMovement(moveEvent);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -4,13 +4,34 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
using osu.Game.Screens.Edit.Compose.Components;
|
using osu.Game.Screens.Edit.Compose.Components;
|
||||||
|
using osuTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Edit
|
namespace osu.Game.Rulesets.Osu.Edit
|
||||||
{
|
{
|
||||||
public class OsuSelectionHandler : SelectionHandler
|
public class OsuSelectionHandler : SelectionHandler
|
||||||
{
|
{
|
||||||
public override void HandleMovement(MoveSelectionEvent moveEvent)
|
public override bool HandleMovement(MoveSelectionEvent moveEvent)
|
||||||
{
|
{
|
||||||
|
Vector2 minPosition = new Vector2(float.MaxValue, float.MaxValue);
|
||||||
|
Vector2 maxPosition = new Vector2(float.MinValue, float.MinValue);
|
||||||
|
|
||||||
|
// Go through all hitobjects to make sure they would remain in the bounds of the editor after movement, before any movement is attempted
|
||||||
|
foreach (var h in SelectedHitObjects.OfType<OsuHitObject>())
|
||||||
|
{
|
||||||
|
if (h is Spinner)
|
||||||
|
{
|
||||||
|
// Spinners don't support position adjustments
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stacking is not considered
|
||||||
|
minPosition = Vector2.ComponentMin(minPosition, Vector2.ComponentMin(h.EndPosition + moveEvent.InstantDelta, h.Position + moveEvent.InstantDelta));
|
||||||
|
maxPosition = Vector2.ComponentMax(maxPosition, Vector2.ComponentMax(h.EndPosition + moveEvent.InstantDelta, h.Position + moveEvent.InstantDelta));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (minPosition.X < 0 || minPosition.Y < 0 || maxPosition.X > DrawWidth || maxPosition.Y > DrawHeight)
|
||||||
|
return false;
|
||||||
|
|
||||||
foreach (var h in SelectedHitObjects.OfType<OsuHitObject>())
|
foreach (var h in SelectedHitObjects.OfType<OsuHitObject>())
|
||||||
{
|
{
|
||||||
if (h is Spinner)
|
if (h is Spinner)
|
||||||
@ -22,7 +43,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
|||||||
h.Position += moveEvent.InstantDelta;
|
h.Position += moveEvent.InstantDelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
base.HandleMovement(moveEvent);
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,11 +13,13 @@ namespace osu.Game.Audio
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when this <see cref="PreviewTrack"/> has stopped playing.
|
/// Invoked when this <see cref="PreviewTrack"/> has stopped playing.
|
||||||
|
/// Not invoked in a thread-safe context.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action Stopped;
|
public event Action Stopped;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when this <see cref="PreviewTrack"/> has started playing.
|
/// Invoked when this <see cref="PreviewTrack"/> has started playing.
|
||||||
|
/// Not invoked in a thread-safe context.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action Started;
|
public event Action Started;
|
||||||
|
|
||||||
@ -29,7 +31,7 @@ namespace osu.Game.Audio
|
|||||||
{
|
{
|
||||||
track = GetTrack();
|
track = GetTrack();
|
||||||
if (track != null)
|
if (track != null)
|
||||||
track.Completed += () => Schedule(Stop);
|
track.Completed += Stop;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -93,6 +95,7 @@ namespace osu.Game.Audio
|
|||||||
hasStarted = false;
|
hasStarted = false;
|
||||||
|
|
||||||
track.Stop();
|
track.Stop();
|
||||||
|
|
||||||
Stopped?.Invoke();
|
Stopped?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,18 +46,18 @@ namespace osu.Game.Audio
|
|||||||
{
|
{
|
||||||
var track = CreatePreviewTrack(beatmapSetInfo, trackStore);
|
var track = CreatePreviewTrack(beatmapSetInfo, trackStore);
|
||||||
|
|
||||||
track.Started += () =>
|
track.Started += () => Schedule(() =>
|
||||||
{
|
{
|
||||||
current?.Stop();
|
current?.Stop();
|
||||||
current = track;
|
current = track;
|
||||||
audio.Tracks.AddAdjustment(AdjustableProperty.Volume, muteBindable);
|
audio.Tracks.AddAdjustment(AdjustableProperty.Volume, muteBindable);
|
||||||
};
|
});
|
||||||
|
|
||||||
track.Stopped += () =>
|
track.Stopped += () => Schedule(() =>
|
||||||
{
|
{
|
||||||
current = null;
|
current = null;
|
||||||
audio.Tracks.RemoveAdjustment(AdjustableProperty.Volume, muteBindable);
|
audio.Tracks.RemoveAdjustment(AdjustableProperty.Volume, muteBindable);
|
||||||
};
|
});
|
||||||
|
|
||||||
return track;
|
return track;
|
||||||
}
|
}
|
||||||
|
@ -1,30 +1,16 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// 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;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Framework.IO.Stores;
|
||||||
using SharpCompress.Archives.Zip;
|
using SharpCompress.Archives.Zip;
|
||||||
using SharpCompress.Common;
|
|
||||||
|
|
||||||
namespace osu.Game.IO.Archives
|
namespace osu.Game.IO.Archives
|
||||||
{
|
{
|
||||||
public sealed class ZipArchiveReader : ArchiveReader
|
public sealed class ZipArchiveReader : ArchiveReader
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// List of substrings that indicate a file should be ignored during the import process
|
|
||||||
/// (usually due to representing no useful data and being autogenerated by the OS).
|
|
||||||
/// </summary>
|
|
||||||
private static readonly string[] filename_ignore_list =
|
|
||||||
{
|
|
||||||
// Mac-specific
|
|
||||||
"__MACOSX",
|
|
||||||
".DS_Store",
|
|
||||||
// Windows-specific
|
|
||||||
"Thumbs.db"
|
|
||||||
};
|
|
||||||
|
|
||||||
private readonly Stream archiveStream;
|
private readonly Stream archiveStream;
|
||||||
private readonly ZipArchive archive;
|
private readonly ZipArchive archive;
|
||||||
|
|
||||||
@ -58,9 +44,7 @@ namespace osu.Game.IO.Archives
|
|||||||
archiveStream.Dispose();
|
archiveStream.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool canBeIgnored(IEntry entry) => filename_ignore_list.Any(ignoredName => entry.Key.IndexOf(ignoredName, StringComparison.OrdinalIgnoreCase) >= 0);
|
public override IEnumerable<string> Filenames => archive.Entries.Select(e => e.Key).ExcludeSystemFileNames();
|
||||||
|
|
||||||
public override IEnumerable<string> Filenames => archive.Entries.Where(e => !canBeIgnored(e)).Select(e => e.Key).ToArray();
|
|
||||||
|
|
||||||
public override Stream GetUnderlyingStream() => archiveStream;
|
public override Stream GetUnderlyingStream() => archiveStream;
|
||||||
}
|
}
|
||||||
|
@ -367,7 +367,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
(Vector2 snappedPosition, double snappedTime) = composer.GetSnappedPosition(ToLocalSpace(movePosition), draggedObject.StartTime);
|
(Vector2 snappedPosition, double snappedTime) = composer.GetSnappedPosition(ToLocalSpace(movePosition), draggedObject.StartTime);
|
||||||
|
|
||||||
// Move the hitobjects
|
// Move the hitobjects
|
||||||
selectionHandler.HandleMovement(new MoveSelectionEvent(movementBlueprint, startPosition, ToScreenSpace(snappedPosition)));
|
if (!selectionHandler.HandleMovement(new MoveSelectionEvent(movementBlueprint, startPosition, ToScreenSpace(snappedPosition))))
|
||||||
|
return true;
|
||||||
|
|
||||||
// Apply the start time at the newly snapped-to position
|
// Apply the start time at the newly snapped-to position
|
||||||
double offset = snappedTime - draggedObject.StartTime;
|
double offset = snappedTime - draggedObject.StartTime;
|
||||||
|
@ -68,9 +68,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
|||||||
/// Handles the selected <see cref="DrawableHitObject"/>s being moved.
|
/// Handles the selected <see cref="DrawableHitObject"/>s being moved.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="moveEvent">The move event.</param>
|
/// <param name="moveEvent">The move event.</param>
|
||||||
public virtual void HandleMovement(MoveSelectionEvent moveEvent)
|
/// <returns>Whether any <see cref="DrawableHitObject"/>s were moved.</returns>
|
||||||
{
|
public virtual bool HandleMovement(MoveSelectionEvent moveEvent) => false;
|
||||||
}
|
|
||||||
|
|
||||||
public bool OnPressed(PlatformAction action)
|
public bool OnPressed(PlatformAction action)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user