1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-18 04:59:52 +08:00

Compare commits

...

8 Commits

8 changed files with 37 additions and 26 deletions
@@ -359,8 +359,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
}
// Update the cursor position.
var result = positionSnapProvider?.FindSnappedPositionAndTime(inputManager.CurrentState.Mouse.Position, state == SliderPlacementState.ControlPoints ? SnapType.GlobalGrids : SnapType.All);
cursor.Position = ToLocalSpace(result?.ScreenSpacePosition ?? inputManager.CurrentState.Mouse.Position) - HitObject.Position;
cursor.Position = getCursorPosition();
}
else if (cursor != null)
{
@@ -374,6 +373,12 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
}
}
private Vector2 getCursorPosition()
{
var result = positionSnapProvider?.FindSnappedPositionAndTime(inputManager.CurrentState.Mouse.Position, state == SliderPlacementState.ControlPoints ? SnapType.GlobalGrids : SnapType.All);
return ToLocalSpace(result?.ScreenSpacePosition ?? inputManager.CurrentState.Mouse.Position) - HitObject.Position;
}
/// <summary>
/// Whether a new control point can be placed at the current mouse position.
/// </summary>
@@ -386,7 +391,9 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
var lastPiece = controlPointVisualiser.Pieces.Single(p => p.ControlPoint == last);
lastPoint = last;
return lastPiece.IsHovered != true;
// We may only place a new control point if the cursor is not overlapping with the last control point.
// If snapping is enabled, the cursor may not hover the last piece while still placing the control point at the same position.
return !lastPiece.IsHovered && (last is null || Vector2.DistanceSquared(last.Position, getCursorPosition()) > 1f);
}
private void placeNewControlPoint()
@@ -276,8 +276,11 @@ namespace osu.Game.Tests.Visual.Navigation
AddStep("delete beatmap files", () =>
{
foreach (var file in Game.Beatmap.Value.BeatmapSetInfo.Files.Where(f => Path.GetExtension(f.Filename) == ".osu"))
Game.Storage.Delete(Path.Combine("files", file.File.GetStoragePath()));
FileUtils.AttemptOperation(() =>
{
foreach (var file in Game.Beatmap.Value.BeatmapSetInfo.Files.Where(f => Path.GetExtension(f.Filename) == ".osu"))
Game.Storage.Delete(Path.Combine("files", file.File.GetStoragePath()));
});
});
AddStep("invalidate cache", () =>
@@ -23,7 +23,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
protected override Drawable IdleContent => idleBottomContent;
protected override Drawable DownloadInProgressContent => downloadProgressBar;
private const float height = 100;
public const float HEIGHT = 100;
[Cached]
private readonly BeatmapCardContent content;
@@ -42,14 +42,14 @@ namespace osu.Game.Beatmaps.Drawables.Cards
public BeatmapCardNormal(APIBeatmapSet beatmapSet, bool allowExpansion = true)
: base(beatmapSet, allowExpansion)
{
content = new BeatmapCardContent(height);
content = new BeatmapCardContent(HEIGHT);
}
[BackgroundDependencyLoader]
private void load()
{
Width = WIDTH;
Height = height;
Height = HEIGHT;
FillFlowContainer leftIconArea = null!;
FillFlowContainer titleBadgeArea = null!;
@@ -65,7 +65,7 @@ namespace osu.Game.Beatmaps.Drawables.Cards
thumbnail = new BeatmapCardThumbnail(BeatmapSet, BeatmapSet)
{
Name = @"Left (icon) area",
Size = new Vector2(height),
Size = new Vector2(HEIGHT),
Padding = new MarginPadding { Right = CORNER_RADIUS },
Child = leftIconArea = new FillFlowContainer
{
@@ -77,8 +77,8 @@ namespace osu.Game.Beatmaps.Drawables.Cards
},
buttonContainer = new CollapsibleButtonContainer(BeatmapSet)
{
X = height - CORNER_RADIUS,
Width = WIDTH - height + CORNER_RADIUS,
X = HEIGHT - CORNER_RADIUS,
Width = WIDTH - HEIGHT + CORNER_RADIUS,
FavouriteState = { BindTarget = FavouriteState },
ButtonsCollapsedWidth = CORNER_RADIUS,
ButtonsExpandedWidth = 30,
@@ -90,10 +90,9 @@ namespace osu.Game.Beatmaps.Drawables.Cards
protected override void Update()
{
base.Update();
progress.Progress = playButton.Progress.Value;
playButton.Scale = new Vector2(DrawWidth / 100);
progress.Size = new Vector2(50 * DrawWidth / 100);
progress.Progress = playButton.Progress.Value;
progress.Size = new Vector2(50 * playButton.DrawWidth / (BeatmapCardNormal.HEIGHT - BeatmapCard.CORNER_RADIUS));
}
private void updateState()
@@ -79,6 +79,8 @@ namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
{
base.Update();
icon.Scale = new Vector2(DrawWidth / (BeatmapCardNormal.HEIGHT - BeatmapCard.CORNER_RADIUS));
if (Playing.Value && previewTrack != null && previewTrack.TrackLoaded)
progress.Value = previewTrack.CurrentTime / previewTrack.Length;
else
+4 -4
View File
@@ -94,13 +94,13 @@ namespace osu.Game.Skinning
// Temporary until default skin has a valid hit lighting.
if ((lookup as SkinnableSprite.SpriteComponentLookup)?.LookupName == @"lighting") return Drawable.Empty();
if (base.GetDrawableComponent(lookup) is UserConfiguredLayoutContainer c)
return c;
switch (lookup)
{
case SkinComponentsContainerLookup containerLookup:
if (base.GetDrawableComponent(lookup) is UserConfiguredLayoutContainer c)
return c;
switch (containerLookup.Target)
{
case SkinComponentsContainerLookup.TargetArea.SongSelect:
@@ -257,7 +257,7 @@ namespace osu.Game.Skinning
return null;
}
return null;
return base.GetDrawableComponent(lookup);
}
public override IBindable<TValue>? GetConfig<TLookup, TValue>(TLookup lookup)
+4 -4
View File
@@ -356,12 +356,12 @@ namespace osu.Game.Skinning
public override Drawable? GetDrawableComponent(ISkinComponentLookup lookup)
{
if (base.GetDrawableComponent(lookup) is UserConfiguredLayoutContainer c)
return c;
switch (lookup)
{
case SkinComponentsContainerLookup containerLookup:
if (base.GetDrawableComponent(lookup) is UserConfiguredLayoutContainer c)
return c;
switch (containerLookup.Target)
{
case SkinComponentsContainerLookup.TargetArea.MainHUDComponents:
@@ -445,7 +445,7 @@ namespace osu.Game.Skinning
return null;
}
return null;
return base.GetDrawableComponent(lookup);
}
private Texture? getParticleTexture(HitResult result)
+4 -4
View File
@@ -64,12 +64,12 @@ namespace osu.Game.Skinning
// Temporary until default skin has a valid hit lighting.
if ((lookup as SkinnableSprite.SpriteComponentLookup)?.LookupName == @"lighting") return Drawable.Empty();
if (base.GetDrawableComponent(lookup) is UserConfiguredLayoutContainer c)
return c;
switch (lookup)
{
case SkinComponentsContainerLookup containerLookup:
if (base.GetDrawableComponent(lookup) is UserConfiguredLayoutContainer c)
return c;
// Only handle global level defaults for now.
if (containerLookup.Ruleset != null)
return null;
@@ -178,7 +178,7 @@ namespace osu.Game.Skinning
return null;
}
return null;
return base.GetDrawableComponent(lookup);
}
public override IBindable<TValue>? GetConfig<TLookup, TValue>(TLookup lookup)