mirror of
https://github.com/ppy/osu.git
synced 2024-12-17 05:22:54 +08:00
Merge branch 'master' into edit-nodesample
This commit is contained in:
commit
4a81d068af
14
.github/workflows/ci.yml
vendored
14
.github/workflows/ci.yml
vendored
@ -121,12 +121,24 @@ jobs:
|
||||
|
||||
build-only-ios:
|
||||
name: Build only (iOS)
|
||||
runs-on: macos-latest
|
||||
# `macos-13` is required, because Xcode 14.3 is required (see below).
|
||||
# TODO: can be changed to `macos-latest` once `macos-13` becomes latest (currently in beta)
|
||||
runs-on: macos-13
|
||||
timeout-minutes: 60
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
# newest Microsoft.iOS.Sdk versions require Xcode 14.3.
|
||||
# 14.3 is currently not the default Xcode version (https://github.com/actions/runner-images/blob/main/images/macos/macos-13-Readme.md#xcode),
|
||||
# so set it manually.
|
||||
# TODO: remove when 14.3 becomes the default Xcode version.
|
||||
- name: Set Xcode version
|
||||
shell: bash
|
||||
run: |
|
||||
sudo xcode-select -s "/Applications/Xcode_14.3.app"
|
||||
echo "MD_APPLE_SDK_ROOT=/Applications/Xcode_14.3.app" >> $GITHUB_ENV
|
||||
|
||||
- name: Install .NET 6.0.x
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
|
53
.github/workflows/update-web-mod-definitions.yml
vendored
Normal file
53
.github/workflows/update-web-mod-definitions.yml
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
name: Update osu-web mod definitions
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
permissions:
|
||||
contents: read # to fetch code (actions/checkout)
|
||||
|
||||
jobs:
|
||||
update-mod-definitions:
|
||||
name: Update osu-web mod definitions
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install .NET 6.0.x
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: "6.0.x"
|
||||
|
||||
- name: Checkout ppy/osu
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
path: osu
|
||||
|
||||
- name: Checkout ppy/osu-tools
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ppy/osu-tools
|
||||
path: osu-tools
|
||||
|
||||
- name: Checkout ppy/osu-web
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
repository: ppy/osu-web
|
||||
path: osu-web
|
||||
|
||||
- name: Setup local game checkout for tools
|
||||
run: ./UseLocalOsu.sh
|
||||
working-directory: ./osu-tools
|
||||
|
||||
- name: Regenerate mod definitions
|
||||
run: dotnet run --project PerformanceCalculator -- mods > ../osu-web/database/mods.json
|
||||
working-directory: ./osu-tools
|
||||
|
||||
- name: Create pull request with changes
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
with:
|
||||
title: Update mod definitions
|
||||
body: "This PR has been auto-generated to update the mod definitions to match ppy/osu@${{ github.ref_name }}."
|
||||
branch: update-mod-definitions
|
||||
commit-message: Update mod definitions
|
||||
path: osu-web
|
||||
token: ${{ secrets.OSU_WEB_PULL_REQUEST_PAT }}
|
@ -8,7 +8,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osuTK;
|
||||
@ -44,7 +43,7 @@ namespace osu.Game.Rulesets.Pippidon.Objects.Drawables
|
||||
|
||||
public override IEnumerable<HitSampleInfo> GetSamples() => new[]
|
||||
{
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK)
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL)
|
||||
};
|
||||
|
||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||
|
@ -8,7 +8,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Pippidon.UI;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
@ -44,7 +43,7 @@ namespace osu.Game.Rulesets.Pippidon.Objects.Drawables
|
||||
|
||||
public override IEnumerable<HitSampleInfo> GetSamples() => new[]
|
||||
{
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK)
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL)
|
||||
};
|
||||
|
||||
protected override void CheckForResult(bool userTriggered, double timeOffset)
|
||||
|
7
global.json
Normal file
7
global.json
Normal file
@ -0,0 +1,7 @@
|
||||
{
|
||||
"sdk": {
|
||||
"version": "6.0.100",
|
||||
"rollForward": "latestFeature"
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
<AndroidManifestMerger>manifestmerger.jar</AndroidManifestMerger>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.506.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2023.521.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AndroidManifestOverlay Include="$(MSBuildThisFileDirectory)osu.Android\Properties\AndroidManifestOverlay.xml" />
|
||||
|
@ -9,6 +9,7 @@ using osu.Framework.Logging;
|
||||
using osu.Game;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Game.Screens.Play;
|
||||
using Squirrel;
|
||||
using Squirrel.SimpleSplat;
|
||||
using LogLevel = Squirrel.SimpleSplat.LogLevel;
|
||||
@ -36,6 +37,9 @@ namespace osu.Desktop.Updater
|
||||
[Resolved]
|
||||
private OsuGameBase game { get; set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private ILocalUserPlayInfo? localUserInfo { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(INotificationOverlay notifications)
|
||||
{
|
||||
@ -55,6 +59,10 @@ namespace osu.Desktop.Updater
|
||||
|
||||
try
|
||||
{
|
||||
// Avoid any kind of update checking while gameplay is running.
|
||||
if (localUserInfo?.IsPlaying.Value == true)
|
||||
return false;
|
||||
|
||||
updateManager ??= new GithubUpdateManager(@"https://github.com/ppy/osu", false, github_token, @"osulazer");
|
||||
|
||||
var info = await updateManager.CheckForUpdate(!useDeltaPatching).ConfigureAwait(false);
|
||||
|
@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
NewCombo = i % 8 == 0,
|
||||
Samples = new List<HitSampleInfo>(new[]
|
||||
{
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL, "normal", volume: 100)
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL)
|
||||
})
|
||||
});
|
||||
}
|
||||
|
@ -17,6 +17,8 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints
|
||||
private double placementStartTime;
|
||||
private double placementEndTime;
|
||||
|
||||
protected override bool IsValidForPlacement => HitObject.Duration > 0;
|
||||
|
||||
public BananaShowerPlacementBlueprint()
|
||||
{
|
||||
InternalChild = outline = new TimeSpanOutline();
|
||||
@ -49,7 +51,7 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints
|
||||
case PlacementState.Active:
|
||||
if (e.Button != MouseButton.Right) break;
|
||||
|
||||
EndPlacement(HitObject.Duration > 0);
|
||||
EndPlacement(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,8 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints
|
||||
|
||||
private InputManager inputManager = null!;
|
||||
|
||||
protected override bool IsValidForPlacement => HitObject.Duration > 0;
|
||||
|
||||
public JuiceStreamPlacementBlueprint()
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
@ -70,7 +72,7 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints
|
||||
return true;
|
||||
|
||||
case MouseButton.Right:
|
||||
EndPlacement(HitObject.Duration > 0);
|
||||
EndPlacement(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -132,7 +132,7 @@ namespace osu.Game.Rulesets.Catch.Edit
|
||||
|
||||
result.ScreenSpacePosition.X = screenSpacePosition.X;
|
||||
|
||||
if (snapType.HasFlagFast(SnapType.Grids))
|
||||
if (snapType.HasFlagFast(SnapType.RelativeGrids))
|
||||
{
|
||||
if (distanceSnapGrid.IsPresent && distanceSnapGrid.GetSnappedPosition(result.ScreenSpacePosition) is SnapResult snapResult &&
|
||||
Vector2.Distance(snapResult.ScreenSpacePosition, result.ScreenSpacePosition) < distance_snap_radius)
|
||||
|
@ -58,7 +58,7 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
{
|
||||
}
|
||||
|
||||
public sealed override HitSampleInfo With(Optional<string> newName = default, Optional<string?> newBank = default, Optional<string?> newSuffix = default, Optional<int> newVolume = default)
|
||||
public sealed override HitSampleInfo With(Optional<string> newName = default, Optional<string> newBank = default, Optional<string?> newSuffix = default, Optional<int> newVolume = default)
|
||||
=> new BananaHitSampleInfo(newVolume.GetOr(Volume));
|
||||
|
||||
public bool Equals(BananaHitSampleInfo? other)
|
||||
|
@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
{
|
||||
StartTime = time,
|
||||
BananaIndex = i,
|
||||
Samples = new List<HitSampleInfo> { new Banana.BananaHitSampleInfo(GetSampleInfo().Volume) }
|
||||
Samples = new List<HitSampleInfo> { new Banana.BananaHitSampleInfo(CreateHitSampleInfo().Volume) }
|
||||
});
|
||||
|
||||
time += spacing;
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
@ -40,7 +38,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
||||
private const double time_tail = 4000;
|
||||
private const double time_after_tail = 5250;
|
||||
|
||||
private List<JudgementResult> judgementResults;
|
||||
private List<JudgementResult> judgementResults = new List<JudgementResult>();
|
||||
|
||||
/// <summary>
|
||||
/// -----[ ]-----
|
||||
@ -61,6 +59,44 @@ namespace osu.Game.Rulesets.Mania.Tests
|
||||
assertNoteJudgement(HitResult.IgnoreMiss);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// -----[ ]-----
|
||||
/// x o
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestCorrectInput()
|
||||
{
|
||||
performTest(new List<ReplayFrame>
|
||||
{
|
||||
new ManiaReplayFrame(time_head, ManiaAction.Key1),
|
||||
new ManiaReplayFrame(time_tail),
|
||||
});
|
||||
|
||||
assertHeadJudgement(HitResult.Perfect);
|
||||
assertTickJudgement(HitResult.LargeTickHit);
|
||||
assertTailJudgement(HitResult.Perfect);
|
||||
assertNoteJudgement(HitResult.IgnoreHit);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// -----[ ]-----
|
||||
/// x o
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TestLateRelease()
|
||||
{
|
||||
performTest(new List<ReplayFrame>
|
||||
{
|
||||
new ManiaReplayFrame(time_head, ManiaAction.Key1),
|
||||
new ManiaReplayFrame(time_after_tail),
|
||||
});
|
||||
|
||||
assertHeadJudgement(HitResult.Perfect);
|
||||
assertTickJudgement(HitResult.LargeTickHit);
|
||||
assertTailJudgement(HitResult.Miss);
|
||||
assertNoteJudgement(HitResult.IgnoreMiss);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// -----[ ]-----
|
||||
/// x o
|
||||
@ -521,9 +557,9 @@ namespace osu.Game.Rulesets.Mania.Tests
|
||||
private void assertLastTickJudgement(HitResult result)
|
||||
=> AddAssert($"last tick judged as {result}", () => judgementResults.Last(j => j.HitObject is HoldNoteTick).Type, () => Is.EqualTo(result));
|
||||
|
||||
private ScoreAccessibleReplayPlayer currentPlayer;
|
||||
private ScoreAccessibleReplayPlayer currentPlayer = null!;
|
||||
|
||||
private void performTest(List<ReplayFrame> frames, Beatmap<ManiaHitObject> beatmap = null)
|
||||
private void performTest(List<ReplayFrame> frames, Beatmap<ManiaHitObject>? beatmap = null)
|
||||
{
|
||||
if (beatmap == null)
|
||||
{
|
||||
@ -569,15 +605,13 @@ namespace osu.Game.Rulesets.Mania.Tests
|
||||
AddUntilStep("Beatmap at 0", () => Beatmap.Value.Track.CurrentTime == 0);
|
||||
AddUntilStep("Wait until player is loaded", () => currentPlayer.IsCurrentScreen());
|
||||
|
||||
AddUntilStep("Wait for completion", () => currentPlayer.ScoreProcessor?.HasCompleted.Value == true);
|
||||
AddUntilStep("Wait for completion", () => currentPlayer.ScoreProcessor.HasCompleted.Value);
|
||||
}
|
||||
|
||||
private partial class ScoreAccessibleReplayPlayer : ReplayPlayer
|
||||
{
|
||||
public new ScoreProcessor ScoreProcessor => base.ScoreProcessor;
|
||||
|
||||
public new GameplayClockContainer GameplayClockContainer => base.GameplayClockContainer;
|
||||
|
||||
protected override bool PauseOnFocusLost => false;
|
||||
|
||||
public ScoreAccessibleReplayPlayer(Score score)
|
||||
|
@ -25,6 +25,8 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
||||
[Resolved]
|
||||
private IScrollingInfo scrollingInfo { get; set; }
|
||||
|
||||
protected override bool IsValidForPlacement => HitObject.Duration > 0;
|
||||
|
||||
public HoldNotePlacementBlueprint()
|
||||
: base(new HoldNote())
|
||||
{
|
||||
@ -75,7 +77,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Blueprints
|
||||
return;
|
||||
|
||||
base.OnMouseUp(e);
|
||||
EndPlacement(HitObject.Duration > 0);
|
||||
EndPlacement(true);
|
||||
}
|
||||
|
||||
private double originalStartTime;
|
||||
|
@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Mania.Edit.Setup
|
||||
specialStyle = new LabelledSwitchButton
|
||||
{
|
||||
Label = "Use special (N+1) style",
|
||||
Description = "Changes one column to act as a classic \"scratch\" or \"special\" column, which can be moved around by the user's skin (to the left/right/centre). Generally used in 5k (4+1) or 8key (7+1) configurations.",
|
||||
Description = "Changes one column to act as a classic \"scratch\" or \"special\" column, which can be moved around by the user's skin (to the left/right/centre). Generally used in 6K (5+1) or 8K (7+1) configurations.",
|
||||
Current = { Value = Beatmap.BeatmapInfo.SpecialStyle }
|
||||
}
|
||||
};
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
@ -219,6 +218,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
if (Time.Current < releaseTime)
|
||||
releaseTime = null;
|
||||
|
||||
if (Time.Current < HoldStartTime)
|
||||
endHold();
|
||||
|
||||
// Pad the full size container so its contents (i.e. the masking container) reach under the tail.
|
||||
// This is required for the tail to not be masked away, since it lies outside the bounds of the hold note.
|
||||
sizingContainer.Padding = new MarginPadding
|
||||
@ -245,9 +247,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
// 2. The head note will move along with the new "head position" in the container.
|
||||
if (Head.IsHit && releaseTime == null && DrawHeight > 0)
|
||||
{
|
||||
// How far past the hit target this hold note is. Always a positive value.
|
||||
float yOffset = Math.Max(0, Direction.Value == ScrollingDirection.Up ? -Y : Y);
|
||||
sizingContainer.Height = Math.Clamp(1 - yOffset / DrawHeight, 0, 1);
|
||||
// How far past the hit target this hold note is.
|
||||
float yOffset = Direction.Value == ScrollingDirection.Up ? -Y : Y;
|
||||
sizingContainer.Height = 1 - yOffset / DrawHeight;
|
||||
}
|
||||
}
|
||||
|
||||
@ -322,14 +324,14 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables
|
||||
if (e.Action != Action.Value)
|
||||
return;
|
||||
|
||||
// do not run any of this logic when rewinding, as it inverts order of presses/releases.
|
||||
if (Time.Elapsed < 0)
|
||||
return;
|
||||
|
||||
// Make sure a hold was started
|
||||
if (HoldStartTime == null)
|
||||
return;
|
||||
|
||||
// do not run any of this logic when rewinding, as it inverts order of presses/releases.
|
||||
if (Time.Elapsed < 0)
|
||||
return;
|
||||
|
||||
Tail.UpdateResult();
|
||||
endHold();
|
||||
|
||||
|
@ -181,7 +181,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
||||
{
|
||||
if (slider is null) return;
|
||||
|
||||
sample = new HitSampleInfo("hitwhistle", "soft", volume: 70);
|
||||
sample = new HitSampleInfo("hitwhistle", HitSampleInfo.BANK_SOFT, volume: 70);
|
||||
slider.Samples.Add(sample.With());
|
||||
});
|
||||
|
||||
|
@ -74,7 +74,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
EndTime = Time.Current + delay + length,
|
||||
Samples = new List<HitSampleInfo>
|
||||
{
|
||||
new HitSampleInfo("hitnormal")
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL)
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -309,7 +309,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
}
|
||||
else
|
||||
{
|
||||
var result = snapProvider?.FindSnappedPositionAndTime(Parent.ToScreenSpace(e.MousePosition));
|
||||
var result = snapProvider?.FindSnappedPositionAndTime(Parent.ToScreenSpace(e.MousePosition), SnapType.GlobalGrids);
|
||||
|
||||
Vector2 movementDelta = Parent.ToLocalSpace(result?.ScreenSpacePosition ?? Parent.ToScreenSpace(e.MousePosition)) - dragStartPositions[draggedControlPointIndex] - hitObject.Position;
|
||||
|
||||
|
@ -41,6 +41,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
[Resolved(CanBeNull = true)]
|
||||
private IDistanceSnapProvider snapProvider { get; set; }
|
||||
|
||||
protected override bool IsValidForPlacement => HitObject.Path.HasValidLength;
|
||||
|
||||
public SliderPlacementBlueprint()
|
||||
: base(new Slider())
|
||||
{
|
||||
@ -150,7 +152,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
private void endCurve()
|
||||
{
|
||||
updateSlider();
|
||||
EndPlacement(HitObject.Path.HasValidLength);
|
||||
EndPlacement(true);
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
@ -196,7 +198,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
}
|
||||
|
||||
// Update the cursor position.
|
||||
var result = snapProvider?.FindSnappedPositionAndTime(inputManager.CurrentState.Mouse.Position);
|
||||
var result = snapProvider?.FindSnappedPositionAndTime(inputManager.CurrentState.Mouse.Position, state == SliderPlacementState.Body ? SnapType.GlobalGrids : SnapType.All);
|
||||
cursor.Position = ToLocalSpace(result?.ScreenSpacePosition ?? inputManager.CurrentState.Mouse.Position) - HitObject.Position;
|
||||
}
|
||||
else if (cursor != null)
|
||||
|
@ -1,10 +1,7 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input.Events;
|
||||
@ -24,9 +21,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners
|
||||
|
||||
private bool isPlacingEnd;
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
[CanBeNull]
|
||||
private IBeatSnapProvider beatSnapProvider { get; set; }
|
||||
[Resolved]
|
||||
private IBeatSnapProvider? beatSnapProvider { get; set; }
|
||||
|
||||
public SpinnerPlacementBlueprint()
|
||||
: base(new Spinner { Position = OsuPlayfield.BASE_SIZE / 2 })
|
||||
|
@ -143,7 +143,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
// We want to ensure that in this particular case, the time-snapping component of distance snap is still applied.
|
||||
// The easiest way to ensure this is to attempt application of distance snap after a nearby object is found, and copy over
|
||||
// the time value if the proposed positions are roughly the same.
|
||||
if (snapType.HasFlagFast(SnapType.Grids) && DistanceSnapToggle.Value == TernaryState.True && distanceSnapGrid != null)
|
||||
if (snapType.HasFlagFast(SnapType.RelativeGrids) && DistanceSnapToggle.Value == TernaryState.True && distanceSnapGrid != null)
|
||||
{
|
||||
(Vector2 distanceSnappedPosition, double distanceSnappedTime) = distanceSnapGrid.GetSnappedPosition(distanceSnapGrid.ToLocalSpace(snapResult.ScreenSpacePosition));
|
||||
if (Precision.AlmostEquals(distanceSnapGrid.ToScreenSpace(distanceSnappedPosition), snapResult.ScreenSpacePosition, 1))
|
||||
@ -155,7 +155,7 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
|
||||
SnapResult result = base.FindSnappedPositionAndTime(screenSpacePosition, snapType);
|
||||
|
||||
if (snapType.HasFlagFast(SnapType.Grids))
|
||||
if (snapType.HasFlagFast(SnapType.RelativeGrids))
|
||||
{
|
||||
if (DistanceSnapToggle.Value == TernaryState.True && distanceSnapGrid != null)
|
||||
{
|
||||
@ -164,7 +164,10 @@ namespace osu.Game.Rulesets.Osu.Edit
|
||||
result.ScreenSpacePosition = distanceSnapGrid.ToScreenSpace(pos);
|
||||
result.Time = time;
|
||||
}
|
||||
}
|
||||
|
||||
if (snapType.HasFlagFast(SnapType.GlobalGrids))
|
||||
{
|
||||
if (rectangularGridSnapToggle.Value == TernaryState.True)
|
||||
{
|
||||
Vector2 pos = rectangularPositionSnapGrid.GetSnappedPosition(rectangularPositionSnapGrid.ToLocalSpace(result.ScreenSpacePosition));
|
||||
|
@ -9,7 +9,6 @@ using osu.Framework.Localisation;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Overlays.Settings;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Osu.Beatmaps;
|
||||
@ -28,7 +27,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
|
||||
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModTargetPractice)).ToArray();
|
||||
|
||||
[SettingSource("Angle sharpness", "How sharp angles should be", SettingControlType = typeof(SettingsSlider<float>))]
|
||||
[SettingSource("Angle sharpness", "How sharp angles should be")]
|
||||
public BindableFloat AngleSharpness { get; } = new BindableFloat(7)
|
||||
{
|
||||
MinValue = 1,
|
||||
|
@ -98,6 +98,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
ComboOffset = original.ComboOffset;
|
||||
LegacyLastTickOffset = original.LegacyLastTickOffset;
|
||||
TickDistanceMultiplier = original.TickDistanceMultiplier;
|
||||
SliderVelocity = original.SliderVelocity;
|
||||
}
|
||||
|
||||
protected override void CreateNestedHitObjects(CancellationToken cancellationToken)
|
||||
|
@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
|
||||
AddNested(i < SpinsRequired
|
||||
? new SpinnerTick { StartTime = startTime, SpinnerDuration = Duration }
|
||||
: new SpinnerBonusTick { StartTime = startTime, SpinnerDuration = Duration, Samples = new[] { GetSampleInfo("spinnerbonus") } });
|
||||
: new SpinnerBonusTick { StartTime = startTime, SpinnerDuration = Duration, Samples = new[] { CreateHitSampleInfo("spinnerbonus") } });
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
@ -13,6 +11,7 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Scoring;
|
||||
using osuTK;
|
||||
@ -36,8 +35,8 @@ namespace osu.Game.Rulesets.Osu.Statistics
|
||||
|
||||
private const float rotation = 45;
|
||||
|
||||
private BufferedContainer bufferedGrid;
|
||||
private GridContainer pointGrid;
|
||||
private BufferedContainer bufferedGrid = null!;
|
||||
private GridContainer pointGrid = null!;
|
||||
|
||||
private readonly ScoreInfo score;
|
||||
private readonly IBeatmap playableBeatmap;
|
||||
@ -58,6 +57,8 @@ namespace osu.Game.Rulesets.Osu.Statistics
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
const float line_extension = 0.2f;
|
||||
|
||||
InternalChild = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
@ -66,76 +67,99 @@ namespace osu.Game.Rulesets.Osu.Statistics
|
||||
FillMode = FillMode.Fit,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new CircularContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(inner_portion),
|
||||
Masking = true,
|
||||
BorderThickness = line_thickness,
|
||||
BorderColour = Color4.White,
|
||||
Child = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4Extensions.FromHex("#202624")
|
||||
}
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new CircularContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(inner_portion),
|
||||
Masking = true,
|
||||
BorderThickness = line_thickness,
|
||||
BorderColour = Color4.White,
|
||||
Child = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4Extensions.FromHex("#202624")
|
||||
}
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding(1),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Rotation = rotation,
|
||||
Child = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
new Circle
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
EdgeSmoothness = new Vector2(1),
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Height = 2, // We're rotating along a diagonal - we don't really care how big this is.
|
||||
Width = line_thickness / 2,
|
||||
Rotation = -rotation,
|
||||
Alpha = 0.3f,
|
||||
Width = line_thickness,
|
||||
Height = inner_portion + line_extension,
|
||||
Rotation = -rotation * 2,
|
||||
Alpha = 0.6f,
|
||||
},
|
||||
new Box
|
||||
new Circle
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
EdgeSmoothness = new Vector2(1),
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Height = 2, // We're rotating along a diagonal - we don't really care how big this is.
|
||||
Width = line_thickness / 2, // adjust for edgesmoothness
|
||||
Rotation = rotation
|
||||
Width = line_thickness,
|
||||
Height = inner_portion + line_extension,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "Overshoot",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Padding = new MarginPadding(3),
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Y = -(inner_portion + line_extension) / 2,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "Undershoot",
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Padding = new MarginPadding(3),
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Y = (inner_portion + line_extension) / 2,
|
||||
},
|
||||
new Circle
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Y = -(inner_portion + line_extension) / 2,
|
||||
Margin = new MarginPadding(-line_thickness / 2),
|
||||
Width = line_thickness,
|
||||
Height = 10,
|
||||
Rotation = 45,
|
||||
},
|
||||
new Circle
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Y = -(inner_portion + line_extension) / 2,
|
||||
Margin = new MarginPadding(-line_thickness / 2),
|
||||
Width = line_thickness,
|
||||
Height = 10,
|
||||
Rotation = -45,
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
new Box
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Width = 10,
|
||||
EdgeSmoothness = new Vector2(1),
|
||||
Height = line_thickness / 2, // adjust for edgesmoothness
|
||||
},
|
||||
new Box
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
EdgeSmoothness = new Vector2(1),
|
||||
Width = line_thickness / 2, // adjust for edgesmoothness
|
||||
Height = 10,
|
||||
}
|
||||
}
|
||||
},
|
||||
bufferedGrid = new BufferedContainer(cachedFrameBuffer: true)
|
||||
|
@ -0,0 +1,337 @@
|
||||
// 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.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
using osu.Game.Rulesets.Taiko.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Taiko.UI;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Rulesets.UI.Scrolling;
|
||||
using osu.Game.Tests.Visual;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Tests
|
||||
{
|
||||
public partial class TestSceneDrumSampleTriggerSource : OsuTestScene
|
||||
{
|
||||
private readonly ManualClock manualClock = new ManualClock();
|
||||
|
||||
[Cached(typeof(IScrollingInfo))]
|
||||
private ScrollingTestContainer.TestScrollingInfo info = new ScrollingTestContainer.TestScrollingInfo
|
||||
{
|
||||
Direction = { Value = ScrollingDirection.Left },
|
||||
TimeRange = { Value = 200 },
|
||||
};
|
||||
|
||||
private ScrollingHitObjectContainer hitObjectContainer = null!;
|
||||
private TestDrumSampleTriggerSource triggerSource = null!;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp() => Schedule(() =>
|
||||
{
|
||||
hitObjectContainer = new ScrollingHitObjectContainer();
|
||||
manualClock.CurrentTime = 0;
|
||||
|
||||
Child = new Container
|
||||
{
|
||||
Clock = new FramedClock(manualClock),
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
hitObjectContainer,
|
||||
triggerSource = new TestDrumSampleTriggerSource(hitObjectContainer)
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
[Test]
|
||||
public void TestNormalHit()
|
||||
{
|
||||
AddStep("add hit with normal samples", () =>
|
||||
{
|
||||
var hit = new Hit
|
||||
{
|
||||
StartTime = 100,
|
||||
Samples = new List<HitSampleInfo>
|
||||
{
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL)
|
||||
}
|
||||
};
|
||||
hit.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
||||
var drawableHit = new DrawableHit(hit);
|
||||
hitObjectContainer.Add(drawableHit);
|
||||
});
|
||||
|
||||
AddAssert("most valid object is hit", () => triggerSource.GetMostValidObject(), Is.InstanceOf<Hit>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
|
||||
AddStep("seek past hit", () => manualClock.CurrentTime = 200);
|
||||
AddAssert("most valid object is hit", () => triggerSource.GetMostValidObject(), Is.InstanceOf<Hit>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSoftHit()
|
||||
{
|
||||
AddStep("add hit with soft samples", () =>
|
||||
{
|
||||
var hit = new Hit
|
||||
{
|
||||
StartTime = 100,
|
||||
Samples = new List<HitSampleInfo>
|
||||
{
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_SOFT)
|
||||
}
|
||||
};
|
||||
hit.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
||||
var drawableHit = new DrawableHit(hit);
|
||||
hitObjectContainer.Add(drawableHit);
|
||||
});
|
||||
|
||||
AddAssert("most valid object is hit", () => triggerSource.GetMostValidObject(), Is.InstanceOf<Hit>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_SOFT);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_SOFT);
|
||||
|
||||
AddStep("seek past hit", () => manualClock.CurrentTime = 200);
|
||||
AddAssert("most valid object is hit", () => triggerSource.GetMostValidObject(), Is.InstanceOf<Hit>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_SOFT);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_SOFT);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDrumStrongHit()
|
||||
{
|
||||
AddStep("add strong hit with drum samples", () =>
|
||||
{
|
||||
var hit = new Hit
|
||||
{
|
||||
StartTime = 100,
|
||||
Samples = new List<HitSampleInfo>
|
||||
{
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL, "drum"),
|
||||
new HitSampleInfo(HitSampleInfo.HIT_FINISH, "drum") // implies strong
|
||||
}
|
||||
};
|
||||
hit.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
||||
var drawableHit = new DrawableHit(hit);
|
||||
hitObjectContainer.Add(drawableHit);
|
||||
});
|
||||
|
||||
AddAssert("most valid object is strong nested hit", () => triggerSource.GetMostValidObject(), Is.InstanceOf<Hit.StrongNestedHit>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, "drum");
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, "drum");
|
||||
|
||||
AddStep("seek past hit", () => manualClock.CurrentTime = 200);
|
||||
AddAssert("most valid object is hit", () => triggerSource.GetMostValidObject(), Is.InstanceOf<Hit>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, "drum");
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, "drum");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNormalDrumRoll()
|
||||
{
|
||||
AddStep("add drum roll with normal samples", () =>
|
||||
{
|
||||
var drumRoll = new DrumRoll
|
||||
{
|
||||
StartTime = 100,
|
||||
EndTime = 1100,
|
||||
Samples = new List<HitSampleInfo>
|
||||
{
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL)
|
||||
}
|
||||
};
|
||||
drumRoll.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
||||
var drawableDrumRoll = new DrawableDrumRoll(drumRoll);
|
||||
hitObjectContainer.Add(drawableDrumRoll);
|
||||
});
|
||||
|
||||
AddAssert("most valid object is drum roll tick", () => triggerSource.GetMostValidObject(), Is.InstanceOf<DrumRollTick>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
|
||||
AddStep("seek to middle of drum roll", () => manualClock.CurrentTime = 600);
|
||||
AddAssert("most valid object is drum roll tick", () => triggerSource.GetMostValidObject(), Is.InstanceOf<DrumRollTick>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
|
||||
AddStep("seek past drum roll", () => manualClock.CurrentTime = 1200);
|
||||
AddAssert("most valid object is drum roll", () => triggerSource.GetMostValidObject(), Is.InstanceOf<DrumRoll>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSoftDrumRoll()
|
||||
{
|
||||
AddStep("add drum roll with soft samples", () =>
|
||||
{
|
||||
var drumRoll = new DrumRoll
|
||||
{
|
||||
StartTime = 100,
|
||||
EndTime = 1100,
|
||||
Samples = new List<HitSampleInfo>
|
||||
{
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_SOFT)
|
||||
}
|
||||
};
|
||||
drumRoll.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
||||
var drawableDrumRoll = new DrawableDrumRoll(drumRoll);
|
||||
hitObjectContainer.Add(drawableDrumRoll);
|
||||
});
|
||||
|
||||
AddAssert("most valid object is drum roll tick", () => triggerSource.GetMostValidObject(), Is.InstanceOf<DrumRollTick>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_SOFT);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_SOFT);
|
||||
|
||||
AddStep("seek to middle of drum roll", () => manualClock.CurrentTime = 600);
|
||||
AddAssert("most valid object is drum roll tick", () => triggerSource.GetMostValidObject(), Is.InstanceOf<DrumRollTick>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_SOFT);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_SOFT);
|
||||
|
||||
AddStep("seek past drum roll", () => manualClock.CurrentTime = 1200);
|
||||
AddAssert("most valid object is drum roll", () => triggerSource.GetMostValidObject(), Is.InstanceOf<DrumRoll>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_SOFT);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, HitSampleInfo.BANK_SOFT);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDrumStrongDrumRoll()
|
||||
{
|
||||
AddStep("add strong drum roll with drum samples", () =>
|
||||
{
|
||||
var drumRoll = new DrumRoll
|
||||
{
|
||||
StartTime = 100,
|
||||
EndTime = 1100,
|
||||
Samples = new List<HitSampleInfo>
|
||||
{
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL, "drum"),
|
||||
new HitSampleInfo(HitSampleInfo.HIT_FINISH, "drum") // implies strong
|
||||
}
|
||||
};
|
||||
drumRoll.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
||||
var drawableDrumRoll = new DrawableDrumRoll(drumRoll);
|
||||
hitObjectContainer.Add(drawableDrumRoll);
|
||||
});
|
||||
|
||||
AddAssert("most valid object is drum roll tick's nested strong hit", () => triggerSource.GetMostValidObject(), Is.InstanceOf<DrumRollTick.StrongNestedHit>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, "drum");
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, "drum");
|
||||
|
||||
AddStep("seek to middle of drum roll", () => manualClock.CurrentTime = 600);
|
||||
AddAssert("most valid object is drum roll tick's nested strong hit", () => triggerSource.GetMostValidObject(), Is.InstanceOf<DrumRollTick.StrongNestedHit>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, "drum");
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, "drum");
|
||||
|
||||
AddStep("seek past drum roll", () => manualClock.CurrentTime = 1200);
|
||||
AddAssert("most valid object is drum roll", () => triggerSource.GetMostValidObject(), Is.InstanceOf<DrumRoll>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, "drum");
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, "drum");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestNormalSwell()
|
||||
{
|
||||
AddStep("add swell with normal samples", () =>
|
||||
{
|
||||
var swell = new Swell
|
||||
{
|
||||
StartTime = 100,
|
||||
EndTime = 1100,
|
||||
Samples = new List<HitSampleInfo>
|
||||
{
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL)
|
||||
}
|
||||
};
|
||||
swell.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
||||
var drawableSwell = new DrawableSwell(swell);
|
||||
hitObjectContainer.Add(drawableSwell);
|
||||
});
|
||||
|
||||
AddAssert("most valid object is swell tick", () => triggerSource.GetMostValidObject(), Is.InstanceOf<SwellTick>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
|
||||
AddStep("seek to middle of swell", () => manualClock.CurrentTime = 600);
|
||||
AddAssert("most valid object is swell tick", () => triggerSource.GetMostValidObject(), Is.InstanceOf<SwellTick>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
|
||||
AddStep("seek past swell", () => manualClock.CurrentTime = 1200);
|
||||
AddAssert("most valid object is swell", () => triggerSource.GetMostValidObject(), Is.InstanceOf<Swell>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK);
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, SampleControlPoint.DEFAULT_BANK);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDrumSwell()
|
||||
{
|
||||
AddStep("add swell with drum samples", () =>
|
||||
{
|
||||
var swell = new Swell
|
||||
{
|
||||
StartTime = 100,
|
||||
EndTime = 1100,
|
||||
Samples = new List<HitSampleInfo>
|
||||
{
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL, "drum")
|
||||
}
|
||||
};
|
||||
swell.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
|
||||
var drawableSwell = new DrawableSwell(swell);
|
||||
hitObjectContainer.Add(drawableSwell);
|
||||
});
|
||||
|
||||
AddAssert("most valid object is swell tick", () => triggerSource.GetMostValidObject(), Is.InstanceOf<SwellTick>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, "drum");
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, "drum");
|
||||
|
||||
AddStep("seek to middle of swell", () => manualClock.CurrentTime = 600);
|
||||
AddAssert("most valid object is swell tick", () => triggerSource.GetMostValidObject(), Is.InstanceOf<SwellTick>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, "drum");
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, "drum");
|
||||
|
||||
AddStep("seek past swell", () => manualClock.CurrentTime = 1200);
|
||||
AddAssert("most valid object is swell", () => triggerSource.GetMostValidObject(), Is.InstanceOf<Swell>);
|
||||
checkSound(HitType.Centre, HitSampleInfo.HIT_NORMAL, "drum");
|
||||
checkSound(HitType.Rim, HitSampleInfo.HIT_CLAP, "drum");
|
||||
}
|
||||
|
||||
private void checkSound(HitType hitType, string expectedName, string expectedBank)
|
||||
{
|
||||
AddStep($"hit {hitType}", () => triggerSource.Play(hitType));
|
||||
AddAssert($"last played sample is {expectedName}", () => triggerSource.LastPlayedSamples!.OfType<HitSampleInfo>().Single().Name, () => Is.EqualTo(expectedName));
|
||||
AddAssert($"last played sample has {expectedBank} bank", () => triggerSource.LastPlayedSamples!.OfType<HitSampleInfo>().Single().Bank, () => Is.EqualTo(expectedBank));
|
||||
}
|
||||
|
||||
private partial class TestDrumSampleTriggerSource : DrumSampleTriggerSource
|
||||
{
|
||||
public ISampleInfo[]? LastPlayedSamples { get; private set; }
|
||||
|
||||
public TestDrumSampleTriggerSource(HitObjectContainer hitObjectContainer)
|
||||
: base(hitObjectContainer)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void PlaySamples(ISampleInfo[] samples)
|
||||
{
|
||||
base.PlaySamples(samples);
|
||||
LastPlayedSamples = samples;
|
||||
}
|
||||
|
||||
public new HitObject GetMostValidObject() => base.GetMostValidObject();
|
||||
}
|
||||
}
|
||||
}
|
@ -25,6 +25,8 @@ namespace osu.Game.Rulesets.Taiko.Edit.Blueprints
|
||||
|
||||
private readonly IHasDuration spanPlacementObject;
|
||||
|
||||
protected override bool IsValidForPlacement => spanPlacementObject.Duration > 0;
|
||||
|
||||
public TaikoSpanPlacementBlueprint(HitObject hitObject)
|
||||
: base(hitObject)
|
||||
{
|
||||
@ -73,7 +75,7 @@ namespace osu.Game.Rulesets.Taiko.Edit.Blueprints
|
||||
return;
|
||||
|
||||
base.OnMouseUp(e);
|
||||
EndPlacement(spanPlacementObject.Duration > 0);
|
||||
EndPlacement(true);
|
||||
}
|
||||
|
||||
public override void UpdateTimeAndPosition(SnapResult result)
|
||||
|
@ -118,6 +118,9 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
{
|
||||
public override bool RemoveWhenNotAlive => false;
|
||||
}
|
||||
|
||||
// Most osu!taiko hitsounds are managed by the drum (see DrumSampleTriggerSource).
|
||||
public override IEnumerable<HitSampleInfo> GetSamples() => Enumerable.Empty<HitSampleInfo>();
|
||||
}
|
||||
|
||||
public abstract partial class DrawableTaikoHitObject<TObject> : DrawableTaikoHitObject
|
||||
@ -157,9 +160,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
||||
Content.Add(MainPiece = CreateMainPiece());
|
||||
}
|
||||
|
||||
// Most osu!taiko hitsounds are managed by the drum (see DrumSampleMapping).
|
||||
public override IEnumerable<HitSampleInfo> GetSamples() => Enumerable.Empty<HitSampleInfo>();
|
||||
|
||||
protected abstract SkinnableDrawable CreateMainPiece();
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,9 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Linq;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using System.Threading;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
@ -98,7 +96,7 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
||||
TickSpacing = tickSpacing,
|
||||
StartTime = t,
|
||||
IsStrong = IsStrong,
|
||||
Samples = Samples.Where(s => s.Name == HitSampleInfo.HIT_FINISH).ToList()
|
||||
Samples = Samples
|
||||
});
|
||||
|
||||
first = false;
|
||||
@ -109,7 +107,11 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
||||
|
||||
protected override HitWindows CreateHitWindows() => HitWindows.Empty;
|
||||
|
||||
protected override StrongNestedHitObject CreateStrongNestedHit(double startTime) => new StrongNestedHit { StartTime = startTime };
|
||||
protected override StrongNestedHitObject CreateStrongNestedHit(double startTime) => new StrongNestedHit
|
||||
{
|
||||
StartTime = startTime,
|
||||
Samples = Samples
|
||||
};
|
||||
|
||||
public class StrongNestedHit : StrongNestedHitObject
|
||||
{
|
||||
|
@ -33,7 +33,11 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
||||
|
||||
public override double MaximumJudgementOffset => HitWindow;
|
||||
|
||||
protected override StrongNestedHitObject CreateStrongNestedHit(double startTime) => new StrongNestedHit { StartTime = startTime };
|
||||
protected override StrongNestedHitObject CreateStrongNestedHit(double startTime) => new StrongNestedHit
|
||||
{
|
||||
StartTime = startTime,
|
||||
Samples = Samples
|
||||
};
|
||||
|
||||
public class StrongNestedHit : StrongNestedHitObject
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
||||
if (isRimType != rimSamples.Any())
|
||||
{
|
||||
if (isRimType)
|
||||
Samples.Add(new HitSampleInfo(HitSampleInfo.HIT_CLAP));
|
||||
Samples.Add(CreateHitSampleInfo(HitSampleInfo.HIT_CLAP));
|
||||
else
|
||||
{
|
||||
foreach (var sample in rimSamples)
|
||||
@ -72,7 +72,11 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
||||
}
|
||||
}
|
||||
|
||||
protected override StrongNestedHitObject CreateStrongNestedHit(double startTime) => new StrongNestedHit { StartTime = startTime };
|
||||
protected override StrongNestedHitObject CreateStrongNestedHit(double startTime) => new StrongNestedHit
|
||||
{
|
||||
StartTime = startTime,
|
||||
Samples = Samples
|
||||
};
|
||||
|
||||
public class StrongNestedHit : StrongNestedHitObject
|
||||
{
|
||||
|
@ -33,7 +33,10 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
||||
for (int i = 0; i < RequiredHits; i++)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
AddNested(new SwellTick());
|
||||
AddNested(new SwellTick
|
||||
{
|
||||
Samples = Samples
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
||||
if (IsStrongBindable.Value != strongSamples.Any())
|
||||
{
|
||||
if (IsStrongBindable.Value)
|
||||
Samples.Add(GetSampleInfo(HitSampleInfo.HIT_FINISH));
|
||||
Samples.Add(CreateHitSampleInfo(HitSampleInfo.HIT_FINISH));
|
||||
else
|
||||
{
|
||||
foreach (var sample in strongSamples)
|
||||
|
@ -253,17 +253,17 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
|
||||
var soundPoint = controlPoints.SamplePointAt(0);
|
||||
Assert.AreEqual(956, soundPoint.Time);
|
||||
Assert.AreEqual("soft", soundPoint.SampleBank);
|
||||
Assert.AreEqual(HitSampleInfo.BANK_SOFT, soundPoint.SampleBank);
|
||||
Assert.AreEqual(60, soundPoint.SampleVolume);
|
||||
|
||||
soundPoint = controlPoints.SamplePointAt(53373);
|
||||
Assert.AreEqual(53373, soundPoint.Time);
|
||||
Assert.AreEqual("soft", soundPoint.SampleBank);
|
||||
Assert.AreEqual(HitSampleInfo.BANK_SOFT, soundPoint.SampleBank);
|
||||
Assert.AreEqual(60, soundPoint.SampleVolume);
|
||||
|
||||
soundPoint = controlPoints.SamplePointAt(119637);
|
||||
Assert.AreEqual(119637, soundPoint.Time);
|
||||
Assert.AreEqual("soft", soundPoint.SampleBank);
|
||||
Assert.AreEqual(HitSampleInfo.BANK_SOFT, soundPoint.SampleBank);
|
||||
Assert.AreEqual(80, soundPoint.SampleVolume);
|
||||
|
||||
var effectPoint = controlPoints.EffectPointAt(0);
|
||||
@ -305,10 +305,10 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
Assert.That(controlPoints.EffectPointAt(2500).KiaiMode, Is.False);
|
||||
Assert.That(controlPoints.EffectPointAt(3500).KiaiMode, Is.True);
|
||||
|
||||
Assert.That(controlPoints.SamplePointAt(500).SampleBank, Is.EqualTo("drum"));
|
||||
Assert.That(controlPoints.SamplePointAt(1500).SampleBank, Is.EqualTo("drum"));
|
||||
Assert.That(controlPoints.SamplePointAt(2500).SampleBank, Is.EqualTo("normal"));
|
||||
Assert.That(controlPoints.SamplePointAt(3500).SampleBank, Is.EqualTo("drum"));
|
||||
Assert.That(controlPoints.SamplePointAt(500).SampleBank, Is.EqualTo(HitSampleInfo.BANK_DRUM));
|
||||
Assert.That(controlPoints.SamplePointAt(1500).SampleBank, Is.EqualTo(HitSampleInfo.BANK_DRUM));
|
||||
Assert.That(controlPoints.SamplePointAt(2500).SampleBank, Is.EqualTo(HitSampleInfo.BANK_NORMAL));
|
||||
Assert.That(controlPoints.SamplePointAt(3500).SampleBank, Is.EqualTo(HitSampleInfo.BANK_DRUM));
|
||||
|
||||
Assert.That(controlPoints.TimingPointAt(500).BeatLength, Is.EqualTo(500).Within(0.1));
|
||||
Assert.That(controlPoints.TimingPointAt(1500).BeatLength, Is.EqualTo(500).Within(0.1));
|
||||
|
31
osu.Game.Tests/Resources/storyboard_only_video.osu
Normal file
31
osu.Game.Tests/Resources/storyboard_only_video.osu
Normal file
@ -0,0 +1,31 @@
|
||||
osu file format v14
|
||||
|
||||
[Events]
|
||||
//Background and Video events
|
||||
0,0,"BG.jpg",0,0
|
||||
Video,0,"video.avi"
|
||||
//Break Periods
|
||||
//Storyboard Layer 0 (Background)
|
||||
//Storyboard Layer 1 (Fail)
|
||||
//Storyboard Layer 2 (Pass)
|
||||
//Storyboard Layer 3 (Foreground)
|
||||
//Storyboard Layer 4 (Overlay)
|
||||
//Storyboard Sound Samples
|
||||
|
||||
[TimingPoints]
|
||||
1674,333.333333333333,4,2,1,70,1,0
|
||||
1674,-100,4,2,1,70,0,0
|
||||
3340,-100,4,2,1,70,0,0
|
||||
3507,-100,4,2,1,70,0,0
|
||||
3673,-100,4,2,1,70,0,0
|
||||
|
||||
[Colours]
|
||||
Combo1 : 240,80,80
|
||||
Combo2 : 171,252,203
|
||||
Combo3 : 128,128,255
|
||||
Combo4 : 249,254,186
|
||||
|
||||
[HitObjects]
|
||||
148,303,1674,5,6,3:2:0:0:
|
||||
378,252,1840,1,0,0:0:0:0:
|
||||
389,270,2340,5,2,0:1:0:0:
|
@ -42,7 +42,8 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(90, 90)
|
||||
Size = new Vector2(90, 90),
|
||||
Scale = new Vector2(3),
|
||||
}
|
||||
};
|
||||
});
|
||||
@ -64,17 +65,24 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
InputManager.MoveMouseTo(tickMarkerHead.ScreenSpaceDrawQuad.Centre);
|
||||
InputManager.PressButton(MouseButton.Left);
|
||||
});
|
||||
AddStep("move to 8 and release", () =>
|
||||
AddStep("move to 1", () => InputManager.MoveMouseTo(getPositionForDivisor(1)));
|
||||
AddStep("move to 16 and release", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(tickSliderBar.ScreenSpaceDrawQuad.Centre);
|
||||
InputManager.MoveMouseTo(getPositionForDivisor(16));
|
||||
InputManager.ReleaseButton(MouseButton.Left);
|
||||
});
|
||||
AddAssert("divisor is 8", () => bindableBeatDivisor.Value == 8);
|
||||
AddAssert("divisor is 16", () => bindableBeatDivisor.Value == 16);
|
||||
AddStep("hold marker", () => InputManager.PressButton(MouseButton.Left));
|
||||
AddStep("move to 16", () => InputManager.MoveMouseTo(getPositionForDivisor(16)));
|
||||
AddStep("move to ~10 and release", () =>
|
||||
AddStep("move to ~6 and release", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(getPositionForDivisor(6));
|
||||
InputManager.ReleaseButton(MouseButton.Left);
|
||||
});
|
||||
AddAssert("divisor clamped to 8", () => bindableBeatDivisor.Value == 8);
|
||||
AddStep("move to ~10 and click", () =>
|
||||
{
|
||||
InputManager.MoveMouseTo(getPositionForDivisor(10));
|
||||
InputManager.PressButton(MouseButton.Left);
|
||||
InputManager.ReleaseButton(MouseButton.Left);
|
||||
});
|
||||
AddAssert("divisor clamped to 8", () => bindableBeatDivisor.Value == 8);
|
||||
@ -82,12 +90,11 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
|
||||
private Vector2 getPositionForDivisor(int divisor)
|
||||
{
|
||||
float relativePosition = (float)Math.Clamp(divisor, 0, 16) / 16;
|
||||
var sliderDrawQuad = tickSliderBar.ScreenSpaceDrawQuad;
|
||||
return new Vector2(
|
||||
sliderDrawQuad.TopLeft.X + sliderDrawQuad.Width * relativePosition,
|
||||
sliderDrawQuad.Centre.Y
|
||||
);
|
||||
float localX = (1 - 1 / (float)divisor) * tickSliderBar.UsableWidth + tickSliderBar.RangePadding;
|
||||
return tickSliderBar.ToScreenSpace(new Vector2(
|
||||
localX,
|
||||
tickSliderBar.DrawHeight / 2
|
||||
));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -187,7 +187,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
|
||||
private class SnapProvider : IDistanceSnapProvider
|
||||
{
|
||||
public SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition, SnapType snapType = SnapType.Grids) => new SnapResult(screenSpacePosition, 0);
|
||||
public SnapResult FindSnappedPositionAndTime(Vector2 screenSpacePosition, SnapType snapType = SnapType.AllGrids) => new SnapResult(screenSpacePosition, 0);
|
||||
|
||||
public Bindable<double> DistanceSpacingMultiplier { get; } = new BindableDouble(1);
|
||||
|
||||
|
@ -1,57 +0,0 @@
|
||||
// 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.
|
||||
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Rulesets.Mania;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Edit.GameplayTest;
|
||||
using osu.Game.Screens.Select;
|
||||
using osu.Game.Tests.Resources;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
public partial class TestSceneEditorNavigation : OsuGameTestScene
|
||||
{
|
||||
[Test]
|
||||
public void TestEditorGameplayTestAlwaysUsesOriginalRuleset()
|
||||
{
|
||||
BeatmapSetInfo beatmapSet = null!;
|
||||
|
||||
AddStep("import test beatmap", () => Game.BeatmapManager.Import(TestResources.GetTestBeatmapForImport()).WaitSafely());
|
||||
AddStep("retrieve beatmap", () => beatmapSet = Game.BeatmapManager.QueryBeatmapSet(set => !set.Protected).AsNonNull().Value.Detach());
|
||||
|
||||
AddStep("present beatmap", () => Game.PresentBeatmap(beatmapSet));
|
||||
AddUntilStep("wait for song select",
|
||||
() => Game.Beatmap.Value.BeatmapSetInfo.Equals(beatmapSet)
|
||||
&& Game.ScreenStack.CurrentScreen is PlaySongSelect songSelect
|
||||
&& songSelect.IsLoaded);
|
||||
AddStep("switch ruleset", () => Game.Ruleset.Value = new ManiaRuleset().RulesetInfo);
|
||||
|
||||
AddStep("open editor", () => ((PlaySongSelect)Game.ScreenStack.CurrentScreen).Edit(beatmapSet.Beatmaps.First(beatmap => beatmap.Ruleset.OnlineID == 0)));
|
||||
AddUntilStep("wait for editor open", () => Game.ScreenStack.CurrentScreen is Editor editor && editor.ReadyForUse);
|
||||
AddStep("test gameplay", () => ((Editor)Game.ScreenStack.CurrentScreen).TestGameplay());
|
||||
|
||||
AddUntilStep("wait for player", () =>
|
||||
{
|
||||
// notifications may fire at almost any inopportune time and cause annoying test failures.
|
||||
// relentlessly attempt to dismiss any and all interfering overlays, which includes notifications.
|
||||
// this is theoretically not foolproof, but it's the best that can be done here.
|
||||
Game.CloseAllOverlays();
|
||||
return Game.ScreenStack.CurrentScreen is EditorPlayer editorPlayer && editorPlayer.IsLoaded;
|
||||
});
|
||||
|
||||
AddAssert("current ruleset is osu!", () => Game.Ruleset.Value.Equals(new OsuRuleset().RulesetInfo));
|
||||
|
||||
AddStep("exit to song select", () => Game.PerformFromScreen(_ => { }, typeof(PlaySongSelect).Yield()));
|
||||
AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is PlaySongSelect);
|
||||
AddAssert("previous ruleset restored", () => Game.Ruleset.Value.Equals(new ManiaRuleset().RulesetInfo));
|
||||
}
|
||||
}
|
||||
}
|
@ -92,6 +92,20 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
hitObjectHasVelocity(1, 5);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUndo()
|
||||
{
|
||||
clickDifficultyPiece(1);
|
||||
velocityPopoverHasSingleValue(2);
|
||||
|
||||
setVelocityViaPopover(5);
|
||||
hitObjectHasVelocity(1, 5);
|
||||
dismissPopover();
|
||||
|
||||
AddStep("undo", () => Editor.Undo());
|
||||
hitObjectHasVelocity(1, 2);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMultipleSelectionWithSameSliderVelocity()
|
||||
{
|
||||
|
@ -13,6 +13,7 @@ using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Graphics.UserInterfaceV2;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.UI;
|
||||
@ -24,7 +25,7 @@ using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
public partial class TestSceneHitObjectSamplePointAdjustments : EditorTestScene
|
||||
public partial class TestSceneHitObjectSampleAdjustments : EditorTestScene
|
||||
{
|
||||
protected override Ruleset CreateEditorRuleset() => new OsuRuleset();
|
||||
|
||||
@ -42,7 +43,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
Position = (OsuPlayfield.BASE_SIZE - new Vector2(100, 0)) / 2,
|
||||
Samples = new List<HitSampleInfo>
|
||||
{
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL, "normal", volume: 80)
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL, volume: 80)
|
||||
}
|
||||
});
|
||||
|
||||
@ -52,12 +53,32 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
Position = (OsuPlayfield.BASE_SIZE + new Vector2(100, 0)) / 2,
|
||||
Samples = new List<HitSampleInfo>
|
||||
{
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL, "soft", volume: 60)
|
||||
new HitSampleInfo(HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_SOFT, volume: 60)
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAddSampleAddition()
|
||||
{
|
||||
AddStep("select both objects", () => EditorBeatmap.SelectedHitObjects.AddRange(EditorBeatmap.HitObjects));
|
||||
|
||||
AddStep("add clap addition", () => InputManager.Key(Key.R));
|
||||
|
||||
hitObjectHasSampleBank(0, "normal");
|
||||
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL, HitSampleInfo.HIT_CLAP);
|
||||
hitObjectHasSampleBank(1, HitSampleInfo.BANK_SOFT);
|
||||
hitObjectHasSamples(1, HitSampleInfo.HIT_NORMAL, HitSampleInfo.HIT_CLAP);
|
||||
|
||||
AddStep("remove clap addition", () => InputManager.Key(Key.R));
|
||||
|
||||
hitObjectHasSampleBank(0, "normal");
|
||||
hitObjectHasSamples(0, HitSampleInfo.HIT_NORMAL);
|
||||
hitObjectHasSampleBank(1, HitSampleInfo.BANK_SOFT);
|
||||
hitObjectHasSamples(1, HitSampleInfo.HIT_NORMAL);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestPopoverHasFocus()
|
||||
{
|
||||
@ -69,7 +90,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
public void TestSingleSelection()
|
||||
{
|
||||
clickSamplePiece(0);
|
||||
samplePopoverHasSingleBank("normal");
|
||||
samplePopoverHasSingleBank(HitSampleInfo.BANK_NORMAL);
|
||||
samplePopoverHasSingleVolume(80);
|
||||
|
||||
dismissPopover();
|
||||
@ -79,14 +100,29 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
AddStep("select first object", () => EditorBeatmap.SelectedHitObjects.Add(EditorBeatmap.HitObjects.First()));
|
||||
|
||||
clickSamplePiece(1);
|
||||
samplePopoverHasSingleBank("soft");
|
||||
samplePopoverHasSingleBank(HitSampleInfo.BANK_SOFT);
|
||||
samplePopoverHasSingleVolume(60);
|
||||
|
||||
setVolumeViaPopover(90);
|
||||
hitObjectHasSampleVolume(1, 90);
|
||||
|
||||
setBankViaPopover("drum");
|
||||
hitObjectHasSampleBank(1, "drum");
|
||||
setBankViaPopover(HitSampleInfo.BANK_DRUM);
|
||||
hitObjectHasSampleBank(1, HitSampleInfo.BANK_DRUM);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUndo()
|
||||
{
|
||||
clickSamplePiece(1);
|
||||
samplePopoverHasSingleBank(HitSampleInfo.BANK_SOFT);
|
||||
samplePopoverHasSingleVolume(60);
|
||||
|
||||
setVolumeViaPopover(90);
|
||||
hitObjectHasSampleVolume(1, 90);
|
||||
dismissPopover();
|
||||
|
||||
AddStep("undo", () => Editor.Undo());
|
||||
hitObjectHasSampleVolume(1, 60);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -135,7 +171,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMultipleSelectionWithSameSampleBank()
|
||||
public void TestPopoverMultipleSelectionWithSameSampleBank()
|
||||
{
|
||||
AddStep("unify sample bank", () =>
|
||||
{
|
||||
@ -143,33 +179,33 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
for (int i = 0; i < h.Samples.Count; i++)
|
||||
{
|
||||
h.Samples[i] = h.Samples[i].With(newBank: "soft");
|
||||
h.Samples[i] = h.Samples[i].With(newBank: HitSampleInfo.BANK_SOFT);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
AddStep("select both objects", () => EditorBeatmap.SelectedHitObjects.AddRange(EditorBeatmap.HitObjects));
|
||||
clickSamplePiece(0);
|
||||
samplePopoverHasSingleBank("soft");
|
||||
samplePopoverHasSingleBank(HitSampleInfo.BANK_SOFT);
|
||||
|
||||
dismissPopover();
|
||||
|
||||
clickSamplePiece(1);
|
||||
samplePopoverHasSingleBank("soft");
|
||||
samplePopoverHasSingleBank(HitSampleInfo.BANK_SOFT);
|
||||
|
||||
setBankViaPopover(string.Empty);
|
||||
hitObjectHasSampleBank(0, "soft");
|
||||
hitObjectHasSampleBank(1, "soft");
|
||||
samplePopoverHasSingleBank("soft");
|
||||
hitObjectHasSampleBank(0, HitSampleInfo.BANK_SOFT);
|
||||
hitObjectHasSampleBank(1, HitSampleInfo.BANK_SOFT);
|
||||
samplePopoverHasSingleBank(HitSampleInfo.BANK_SOFT);
|
||||
|
||||
setBankViaPopover("drum");
|
||||
hitObjectHasSampleBank(0, "drum");
|
||||
hitObjectHasSampleBank(1, "drum");
|
||||
samplePopoverHasSingleBank("drum");
|
||||
setBankViaPopover(HitSampleInfo.BANK_DRUM);
|
||||
hitObjectHasSampleBank(0, HitSampleInfo.BANK_DRUM);
|
||||
hitObjectHasSampleBank(1, HitSampleInfo.BANK_DRUM);
|
||||
samplePopoverHasSingleBank(HitSampleInfo.BANK_DRUM);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestMultipleSelectionWithDifferentSampleBank()
|
||||
public void TestPopoverMultipleSelectionWithDifferentSampleBank()
|
||||
{
|
||||
AddStep("select both objects", () => EditorBeatmap.SelectedHitObjects.AddRange(EditorBeatmap.HitObjects));
|
||||
clickSamplePiece(0);
|
||||
@ -181,14 +217,109 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
samplePopoverHasIndeterminateBank();
|
||||
|
||||
setBankViaPopover(string.Empty);
|
||||
hitObjectHasSampleBank(0, "normal");
|
||||
hitObjectHasSampleBank(1, "soft");
|
||||
hitObjectHasSampleBank(0, HitSampleInfo.BANK_NORMAL);
|
||||
hitObjectHasSampleBank(1, HitSampleInfo.BANK_SOFT);
|
||||
samplePopoverHasIndeterminateBank();
|
||||
|
||||
setBankViaPopover("normal");
|
||||
hitObjectHasSampleBank(0, "normal");
|
||||
hitObjectHasSampleBank(1, "normal");
|
||||
samplePopoverHasSingleBank("normal");
|
||||
setBankViaPopover(HitSampleInfo.BANK_NORMAL);
|
||||
hitObjectHasSampleBank(0, HitSampleInfo.BANK_NORMAL);
|
||||
hitObjectHasSampleBank(1, HitSampleInfo.BANK_NORMAL);
|
||||
samplePopoverHasSingleBank(HitSampleInfo.BANK_NORMAL);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHotkeysMultipleSelectionWithSameSampleBank()
|
||||
{
|
||||
AddStep("unify sample bank", () =>
|
||||
{
|
||||
foreach (var h in EditorBeatmap.HitObjects)
|
||||
{
|
||||
for (int i = 0; i < h.Samples.Count; i++)
|
||||
{
|
||||
h.Samples[i] = h.Samples[i].With(newBank: HitSampleInfo.BANK_SOFT);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
AddStep("select both objects", () => EditorBeatmap.SelectedHitObjects.AddRange(EditorBeatmap.HitObjects));
|
||||
|
||||
hitObjectHasSampleBank(0, HitSampleInfo.BANK_SOFT);
|
||||
hitObjectHasSampleBank(1, HitSampleInfo.BANK_SOFT);
|
||||
|
||||
AddStep("Press normal bank shortcut", () =>
|
||||
{
|
||||
InputManager.PressKey(Key.ShiftLeft);
|
||||
InputManager.Key(Key.W);
|
||||
InputManager.ReleaseKey(Key.ShiftLeft);
|
||||
});
|
||||
|
||||
hitObjectHasSampleBank(0, HitSampleInfo.BANK_NORMAL);
|
||||
hitObjectHasSampleBank(1, HitSampleInfo.BANK_NORMAL);
|
||||
|
||||
AddStep("Press drum bank shortcut", () =>
|
||||
{
|
||||
InputManager.PressKey(Key.ShiftLeft);
|
||||
InputManager.Key(Key.R);
|
||||
InputManager.ReleaseKey(Key.ShiftLeft);
|
||||
});
|
||||
|
||||
hitObjectHasSampleBank(0, HitSampleInfo.BANK_DRUM);
|
||||
hitObjectHasSampleBank(1, HitSampleInfo.BANK_DRUM);
|
||||
|
||||
AddStep("Press auto bank shortcut", () =>
|
||||
{
|
||||
InputManager.PressKey(Key.ShiftLeft);
|
||||
InputManager.Key(Key.Q);
|
||||
InputManager.ReleaseKey(Key.ShiftLeft);
|
||||
});
|
||||
|
||||
// Should be a noop.
|
||||
hitObjectHasSampleBank(0, HitSampleInfo.BANK_DRUM);
|
||||
hitObjectHasSampleBank(1, HitSampleInfo.BANK_DRUM);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestHotkeysDuringPlacement()
|
||||
{
|
||||
AddStep("Enter placement mode", () => InputManager.Key(Key.Number2));
|
||||
AddStep("Move mouse to centre", () => InputManager.MoveMouseTo(Editor.ChildrenOfType<HitObjectComposer>().First().ScreenSpaceDrawQuad.Centre));
|
||||
|
||||
AddStep("Move between two objects", () => EditorClock.Seek(250));
|
||||
|
||||
AddStep("Press normal bank shortcut", () =>
|
||||
{
|
||||
InputManager.PressKey(Key.ShiftLeft);
|
||||
InputManager.Key(Key.W);
|
||||
InputManager.ReleaseKey(Key.ShiftLeft);
|
||||
});
|
||||
|
||||
checkPlacementSample(HitSampleInfo.BANK_NORMAL);
|
||||
|
||||
AddStep("Press drum bank shortcut", () =>
|
||||
{
|
||||
InputManager.PressKey(Key.ShiftLeft);
|
||||
InputManager.Key(Key.R);
|
||||
InputManager.ReleaseKey(Key.ShiftLeft);
|
||||
});
|
||||
|
||||
checkPlacementSample(HitSampleInfo.BANK_DRUM);
|
||||
|
||||
AddStep("Press auto bank shortcut", () =>
|
||||
{
|
||||
InputManager.PressKey(Key.ShiftLeft);
|
||||
InputManager.Key(Key.Q);
|
||||
InputManager.ReleaseKey(Key.ShiftLeft);
|
||||
});
|
||||
|
||||
checkPlacementSample(HitSampleInfo.BANK_NORMAL);
|
||||
|
||||
AddStep("Move after second object", () => EditorClock.Seek(750));
|
||||
checkPlacementSample(HitSampleInfo.BANK_SOFT);
|
||||
|
||||
AddStep("Move to first object", () => EditorClock.Seek(0));
|
||||
checkPlacementSample(HitSampleInfo.BANK_NORMAL);
|
||||
|
||||
void checkPlacementSample(string expected) => AddAssert($"Placement sample is {expected}", () => EditorBeatmap.PlacementObject.Value.Samples.First().Bank, () => Is.EqualTo(expected));
|
||||
}
|
||||
|
||||
private void clickSamplePiece(int objectIndex) => AddStep($"click {objectIndex.ToOrdinalWords()} sample piece", () =>
|
||||
@ -271,6 +402,12 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
InputManager.Key(Key.Enter);
|
||||
});
|
||||
|
||||
private void hitObjectHasSamples(int objectIndex, params string[] samples) => AddAssert($"{objectIndex.ToOrdinalWords()} has samples {string.Join(',', samples)}", () =>
|
||||
{
|
||||
var h = EditorBeatmap.HitObjects.ElementAt(objectIndex);
|
||||
return h.Samples.Select(s => s.Name).SequenceEqual(samples);
|
||||
});
|
||||
|
||||
private void hitObjectHasSampleBank(int objectIndex, string bank) => AddAssert($"{objectIndex.ToOrdinalWords()} has bank {bank}", () =>
|
||||
{
|
||||
var h = EditorBeatmap.HitObjects.ElementAt(objectIndex);
|
106
osu.Game.Tests/Visual/Editing/TestScenePlacementBlueprint.cs
Normal file
106
osu.Game.Tests/Visual/Editing/TestScenePlacementBlueprint.cs
Normal file
@ -0,0 +1,106 @@
|
||||
// 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.
|
||||
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.Edit.Compose.Components;
|
||||
using osu.Game.Tests.Beatmaps;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Editing
|
||||
{
|
||||
public partial class TestScenePlacementBlueprint : EditorTestScene
|
||||
{
|
||||
protected override Ruleset CreateEditorRuleset() => new OsuRuleset();
|
||||
|
||||
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) => new TestBeatmap(ruleset, false);
|
||||
|
||||
private GlobalActionContainer globalActionContainer => this.ChildrenOfType<GlobalActionContainer>().Single();
|
||||
|
||||
[Test]
|
||||
public void TestCommitPlacementViaGlobalAction()
|
||||
{
|
||||
Playfield playfield = null!;
|
||||
|
||||
AddStep("select slider placement tool", () => InputManager.Key(Key.Number3));
|
||||
AddStep("move mouse to top left of playfield", () =>
|
||||
{
|
||||
playfield = this.ChildrenOfType<Playfield>().Single();
|
||||
var location = (3 * playfield.ScreenSpaceDrawQuad.TopLeft + playfield.ScreenSpaceDrawQuad.BottomRight) / 4;
|
||||
InputManager.MoveMouseTo(location);
|
||||
});
|
||||
AddStep("begin placement", () => InputManager.Click(MouseButton.Left));
|
||||
AddStep("move mouse to bottom right of playfield", () =>
|
||||
{
|
||||
var location = (playfield.ScreenSpaceDrawQuad.TopLeft + 3 * playfield.ScreenSpaceDrawQuad.BottomRight) / 4;
|
||||
InputManager.MoveMouseTo(location);
|
||||
});
|
||||
AddStep("confirm via global action", () =>
|
||||
{
|
||||
globalActionContainer.TriggerPressed(GlobalAction.Select);
|
||||
globalActionContainer.TriggerReleased(GlobalAction.Select);
|
||||
});
|
||||
AddAssert("slider placed", () => EditorBeatmap.HitObjects.Count, () => Is.EqualTo(1));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestAbortPlacementViaGlobalAction()
|
||||
{
|
||||
Playfield playfield = null!;
|
||||
|
||||
AddStep("select slider placement tool", () => InputManager.Key(Key.Number3));
|
||||
AddStep("move mouse to top left of playfield", () =>
|
||||
{
|
||||
playfield = this.ChildrenOfType<Playfield>().Single();
|
||||
var location = (3 * playfield.ScreenSpaceDrawQuad.TopLeft + playfield.ScreenSpaceDrawQuad.BottomRight) / 4;
|
||||
InputManager.MoveMouseTo(location);
|
||||
});
|
||||
AddStep("begin placement", () => InputManager.Click(MouseButton.Left));
|
||||
AddStep("move mouse to bottom right of playfield", () =>
|
||||
{
|
||||
var location = (playfield.ScreenSpaceDrawQuad.TopLeft + 3 * playfield.ScreenSpaceDrawQuad.BottomRight) / 4;
|
||||
InputManager.MoveMouseTo(location);
|
||||
});
|
||||
AddStep("abort via global action", () =>
|
||||
{
|
||||
globalActionContainer.TriggerPressed(GlobalAction.Back);
|
||||
globalActionContainer.TriggerReleased(GlobalAction.Back);
|
||||
});
|
||||
AddAssert("editor is still current", () => Editor.IsCurrentScreen());
|
||||
AddAssert("slider not placed", () => EditorBeatmap.HitObjects.Count, () => Is.EqualTo(0));
|
||||
AddAssert("no active placement", () => this.ChildrenOfType<ComposeBlueprintContainer>().Single().CurrentPlacement.PlacementActive,
|
||||
() => Is.EqualTo(PlacementBlueprint.PlacementState.Waiting));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCommitPlacementViaToolChange()
|
||||
{
|
||||
Playfield playfield = null!;
|
||||
|
||||
AddStep("select slider placement tool", () => InputManager.Key(Key.Number3));
|
||||
AddStep("move mouse to top left of playfield", () =>
|
||||
{
|
||||
playfield = this.ChildrenOfType<Playfield>().Single();
|
||||
var location = (3 * playfield.ScreenSpaceDrawQuad.TopLeft + playfield.ScreenSpaceDrawQuad.BottomRight) / 4;
|
||||
InputManager.MoveMouseTo(location);
|
||||
});
|
||||
AddStep("begin placement", () => InputManager.Click(MouseButton.Left));
|
||||
AddStep("move mouse to bottom right of playfield", () =>
|
||||
{
|
||||
var location = (playfield.ScreenSpaceDrawQuad.TopLeft + 3 * playfield.ScreenSpaceDrawQuad.BottomRight) / 4;
|
||||
InputManager.MoveMouseTo(location);
|
||||
});
|
||||
|
||||
AddStep("change tool to circle", () => InputManager.Key(Key.Number2));
|
||||
AddAssert("slider placed", () => EditorBeatmap.HitObjects.Count, () => Is.EqualTo(1));
|
||||
}
|
||||
}
|
||||
}
|
@ -73,7 +73,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
new HitCircle
|
||||
{
|
||||
StartTime = t += spacing,
|
||||
Samples = new[] { new HitSampleInfo(HitSampleInfo.HIT_NORMAL, "soft") },
|
||||
Samples = new[] { new HitSampleInfo(HitSampleInfo.HIT_NORMAL, HitSampleInfo.BANK_SOFT) },
|
||||
},
|
||||
new HitCircle
|
||||
{
|
||||
@ -83,7 +83,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
StartTime = t += spacing,
|
||||
Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, Vector2.UnitY * 200 }),
|
||||
Samples = new[] { new HitSampleInfo(HitSampleInfo.HIT_WHISTLE, "soft") },
|
||||
Samples = new[] { new HitSampleInfo(HitSampleInfo.HIT_WHISTLE, HitSampleInfo.BANK_SOFT) },
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
@ -8,6 +9,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
using osu.Game.IO;
|
||||
@ -42,6 +44,18 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
AddStep("Load storyboard with missing video", () => loadStoryboard("storyboard_no_video.osu"));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestVideoSize()
|
||||
{
|
||||
AddStep("load storyboard with only video", () =>
|
||||
{
|
||||
// LegacyStoryboardDecoder doesn't parse WidescreenStoryboard, so it is set manually
|
||||
loadStoryboard("storyboard_only_video.osu", s => s.BeatmapInfo.WidescreenStoryboard = false);
|
||||
});
|
||||
|
||||
AddAssert("storyboard is correct width", () => Precision.AlmostEquals(storyboard?.Width ?? 0f, 480 * 16 / 9f));
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
@ -102,7 +116,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
decoupledClock.ChangeSource(Beatmap.Value.Track);
|
||||
}
|
||||
|
||||
private void loadStoryboard(string filename)
|
||||
private void loadStoryboard(string filename, Action<Storyboard>? setUpStoryboard = null)
|
||||
{
|
||||
Storyboard loaded;
|
||||
|
||||
@ -113,6 +127,8 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
loaded = decoder.Decode(bfr);
|
||||
}
|
||||
|
||||
setUpStoryboard?.Invoke(loaded);
|
||||
|
||||
loadStoryboard(loaded);
|
||||
}
|
||||
}
|
||||
|
69
osu.Game.Tests/Visual/Mods/TestSceneModAccuracyChallenge.cs
Normal file
69
osu.Game.Tests/Visual/Mods/TestSceneModAccuracyChallenge.cs
Normal file
@ -0,0 +1,69 @@
|
||||
// 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.
|
||||
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Mods
|
||||
{
|
||||
public partial class TestSceneModAccuracyChallenge : ModTestScene
|
||||
{
|
||||
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();
|
||||
|
||||
protected override TestPlayer CreateModPlayer(Ruleset ruleset)
|
||||
{
|
||||
var player = base.CreateModPlayer(ruleset);
|
||||
return player;
|
||||
}
|
||||
|
||||
protected override bool AllowFail => true;
|
||||
|
||||
[Test]
|
||||
public void TestMaximumAchievableAccuracy() =>
|
||||
CreateModTest(new ModTestData
|
||||
{
|
||||
Mod = new ModAccuracyChallenge
|
||||
{
|
||||
MinimumAccuracy = { Value = 0.6 }
|
||||
},
|
||||
Autoplay = false,
|
||||
Beatmap = new Beatmap
|
||||
{
|
||||
HitObjects = Enumerable.Range(0, 5).Select(i => new HitCircle
|
||||
{
|
||||
StartTime = i * 250,
|
||||
Position = new Vector2(i * 50)
|
||||
}).Cast<HitObject>().ToList()
|
||||
},
|
||||
PassCondition = () => Player.GameplayState.HasFailed && Player.ScoreProcessor.JudgedHits >= 3
|
||||
});
|
||||
|
||||
[Test]
|
||||
public void TestStandardAccuracy() =>
|
||||
CreateModTest(new ModTestData
|
||||
{
|
||||
Mod = new ModAccuracyChallenge
|
||||
{
|
||||
MinimumAccuracy = { Value = 0.6 },
|
||||
AccuracyJudgeMode = { Value = ModAccuracyChallenge.AccuracyMode.Standard }
|
||||
},
|
||||
Autoplay = false,
|
||||
Beatmap = new Beatmap
|
||||
{
|
||||
HitObjects = Enumerable.Range(0, 5).Select(i => new HitCircle
|
||||
{
|
||||
StartTime = i * 250,
|
||||
Position = new Vector2(i * 50)
|
||||
}).Cast<HitObject>().ToList()
|
||||
},
|
||||
PassCondition = () => Player.GameplayState.HasFailed && Player.ScoreProcessor.JudgedHits >= 1
|
||||
});
|
||||
}
|
||||
}
|
@ -3,15 +3,61 @@
|
||||
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Rulesets.Mania;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Edit.GameplayTest;
|
||||
using osu.Game.Screens.Menu;
|
||||
using osu.Game.Screens.Select;
|
||||
using osu.Game.Tests.Resources;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.Navigation
|
||||
{
|
||||
public partial class TestSceneBeatmapEditorNavigation : OsuGameTestScene
|
||||
{
|
||||
[Test]
|
||||
public void TestEditorGameplayTestAlwaysUsesOriginalRuleset()
|
||||
{
|
||||
BeatmapSetInfo beatmapSet = null!;
|
||||
|
||||
AddStep("import test beatmap", () => Game.BeatmapManager.Import(TestResources.GetTestBeatmapForImport()).WaitSafely());
|
||||
AddStep("retrieve beatmap", () => beatmapSet = Game.BeatmapManager.QueryBeatmapSet(set => !set.Protected).AsNonNull().Value.Detach());
|
||||
|
||||
AddStep("present beatmap", () => Game.PresentBeatmap(beatmapSet));
|
||||
AddUntilStep("wait for song select",
|
||||
() => Game.Beatmap.Value.BeatmapSetInfo.Equals(beatmapSet)
|
||||
&& Game.ScreenStack.CurrentScreen is PlaySongSelect songSelect
|
||||
&& songSelect.IsLoaded);
|
||||
AddStep("switch ruleset", () => Game.Ruleset.Value = new ManiaRuleset().RulesetInfo);
|
||||
|
||||
AddStep("open editor", () => ((PlaySongSelect)Game.ScreenStack.CurrentScreen).Edit(beatmapSet.Beatmaps.First(beatmap => beatmap.Ruleset.OnlineID == 0)));
|
||||
AddUntilStep("wait for editor open", () => Game.ScreenStack.CurrentScreen is Editor editor && editor.ReadyForUse);
|
||||
AddStep("test gameplay", () => ((Editor)Game.ScreenStack.CurrentScreen).TestGameplay());
|
||||
|
||||
AddUntilStep("wait for player", () =>
|
||||
{
|
||||
// notifications may fire at almost any inopportune time and cause annoying test failures.
|
||||
// relentlessly attempt to dismiss any and all interfering overlays, which includes notifications.
|
||||
// this is theoretically not foolproof, but it's the best that can be done here.
|
||||
Game.CloseAllOverlays();
|
||||
return Game.ScreenStack.CurrentScreen is EditorPlayer editorPlayer && editorPlayer.IsLoaded;
|
||||
});
|
||||
|
||||
AddAssert("current ruleset is osu!", () => Game.Ruleset.Value.Equals(new OsuRuleset().RulesetInfo));
|
||||
|
||||
AddStep("exit to song select", () => Game.PerformFromScreen(_ => { }, typeof(PlaySongSelect).Yield()));
|
||||
AddUntilStep("wait for song select", () => Game.ScreenStack.CurrentScreen is PlaySongSelect);
|
||||
AddAssert("previous ruleset restored", () => Game.Ruleset.Value.Equals(new ManiaRuleset().RulesetInfo));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When entering the editor, a new beatmap is created as part of the asynchronous load process.
|
||||
/// This test ensures that in the case of an early exit from the editor (ie. while it's still loading)
|
||||
@ -38,5 +84,63 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
|
||||
BeatmapSetInfo[] allBeatmapSets() => Game.Realm.Run(realm => realm.All<BeatmapSetInfo>().Where(x => !x.DeletePending).ToArray());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestExitEditorWithoutSelection()
|
||||
{
|
||||
BeatmapSetInfo beatmapSet = null!;
|
||||
|
||||
AddStep("import test beatmap", () => Game.BeatmapManager.Import(TestResources.GetTestBeatmapForImport()).WaitSafely());
|
||||
AddStep("retrieve beatmap", () => beatmapSet = Game.BeatmapManager.QueryBeatmapSet(set => !set.Protected).AsNonNull().Value.Detach());
|
||||
|
||||
AddStep("present beatmap", () => Game.PresentBeatmap(beatmapSet));
|
||||
AddUntilStep("wait for song select",
|
||||
() => Game.Beatmap.Value.BeatmapSetInfo.Equals(beatmapSet)
|
||||
&& Game.ScreenStack.CurrentScreen is PlaySongSelect songSelect
|
||||
&& songSelect.IsLoaded);
|
||||
|
||||
AddStep("open editor", () => ((PlaySongSelect)Game.ScreenStack.CurrentScreen).Edit(beatmapSet.Beatmaps.First(beatmap => beatmap.Ruleset.OnlineID == 0)));
|
||||
AddUntilStep("wait for editor open", () => Game.ScreenStack.CurrentScreen is Editor editor && editor.ReadyForUse);
|
||||
|
||||
AddStep("escape once", () => InputManager.Key(Key.Escape));
|
||||
|
||||
AddUntilStep("wait for editor exit", () => Game.ScreenStack.CurrentScreen is not Editor);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestExitEditorWithSelection()
|
||||
{
|
||||
BeatmapSetInfo beatmapSet = null!;
|
||||
|
||||
AddStep("import test beatmap", () => Game.BeatmapManager.Import(TestResources.GetTestBeatmapForImport()).WaitSafely());
|
||||
AddStep("retrieve beatmap", () => beatmapSet = Game.BeatmapManager.QueryBeatmapSet(set => !set.Protected).AsNonNull().Value.Detach());
|
||||
|
||||
AddStep("present beatmap", () => Game.PresentBeatmap(beatmapSet));
|
||||
AddUntilStep("wait for song select",
|
||||
() => Game.Beatmap.Value.BeatmapSetInfo.Equals(beatmapSet)
|
||||
&& Game.ScreenStack.CurrentScreen is PlaySongSelect songSelect
|
||||
&& songSelect.IsLoaded);
|
||||
|
||||
AddStep("open editor", () => ((PlaySongSelect)Game.ScreenStack.CurrentScreen).Edit(beatmapSet.Beatmaps.First(beatmap => beatmap.Ruleset.OnlineID == 0)));
|
||||
AddUntilStep("wait for editor open", () => Game.ScreenStack.CurrentScreen is Editor editor && editor.ReadyForUse);
|
||||
|
||||
AddStep("make selection", () =>
|
||||
{
|
||||
var beatmap = getEditorBeatmap();
|
||||
beatmap.SelectedHitObjects.AddRange(beatmap.HitObjects.Take(5));
|
||||
});
|
||||
|
||||
AddAssert("selection exists", () => getEditorBeatmap().SelectedHitObjects, () => Has.Count.GreaterThan(0));
|
||||
|
||||
AddStep("escape once", () => InputManager.Key(Key.Escape));
|
||||
|
||||
AddAssert("selection empty", () => getEditorBeatmap().SelectedHitObjects, () => Has.Count.Zero);
|
||||
|
||||
AddStep("escape again", () => InputManager.Key(Key.Escape));
|
||||
|
||||
AddUntilStep("wait for editor exit", () => Game.ScreenStack.CurrentScreen is not Editor);
|
||||
}
|
||||
|
||||
private EditorBeatmap getEditorBeatmap() => ((Editor)Game.ScreenStack.CurrentScreen).ChildrenOfType<EditorBeatmap>().Single();
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
@ -20,7 +18,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
private DummyAPIAccess dummyAPI => (DummyAPIAccess)API;
|
||||
|
||||
private WikiOverlay wiki;
|
||||
private WikiOverlay wiki = null!;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp() => Schedule(() => Child = wiki = new WikiOverlay());
|
||||
@ -29,13 +27,13 @@ namespace osu.Game.Tests.Visual.Online
|
||||
public void TestMainPage()
|
||||
{
|
||||
setUpWikiResponse(responseMainPage);
|
||||
AddStep("Show main page", () => wiki.Show());
|
||||
AddStep("Show main page", () => wiki.ShowPage());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestCancellationDoesntShowError()
|
||||
{
|
||||
AddStep("Show main page", () => wiki.Show());
|
||||
AddStep("Show main page", () => wiki.ShowPage());
|
||||
AddStep("Show another page", () => wiki.ShowPage("Article_styling_criteria/Formatting"));
|
||||
|
||||
AddUntilStep("Current path is not error", () => wiki.CurrentPath != "error");
|
||||
@ -73,7 +71,23 @@ namespace osu.Game.Tests.Visual.Online
|
||||
AddUntilStep("Error message correct", () => wiki.ChildrenOfType<SpriteText>().Any(text => text.Text == "\"This_page_will_error_out\"."));
|
||||
}
|
||||
|
||||
private void setUpWikiResponse(APIWikiPage r, string redirectionPath = null)
|
||||
[Test]
|
||||
public void TestReturnAfterErrorPage()
|
||||
{
|
||||
setUpWikiResponse(responseArticlePage);
|
||||
|
||||
AddStep("Show article page", () => wiki.ShowPage("Article_styling_criteria/Formatting"));
|
||||
AddUntilStep("Wait for non-error page", () => wiki.CurrentPath == "Article_styling_criteria/Formatting");
|
||||
|
||||
AddStep("Show nonexistent page", () => wiki.ShowPage("This_page_will_error_out"));
|
||||
AddUntilStep("Wait for error page", () => wiki.CurrentPath == "error");
|
||||
|
||||
AddStep("Show article page", () => wiki.ShowPage("Article_styling_criteria/Formatting"));
|
||||
AddUntilStep("Wait for non-error page", () => wiki.CurrentPath == "Article_styling_criteria/Formatting");
|
||||
AddUntilStep("Error message not displayed", () => wiki.ChildrenOfType<SpriteText>().All(text => text.Text != "\"This_page_will_error_out\"."));
|
||||
}
|
||||
|
||||
private void setUpWikiResponse(APIWikiPage r, string? redirectionPath = null)
|
||||
=> AddStep("set up response", () =>
|
||||
{
|
||||
dummyAPI.HandleRequest = request =>
|
||||
|
@ -7,6 +7,7 @@ using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
@ -137,8 +138,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
if (!objects.Any())
|
||||
return;
|
||||
|
||||
double firstHit = objects.First().StartTime;
|
||||
double lastHit = objects.Max(o => o.GetEndTime());
|
||||
(double firstHit, double lastHit) = BeatmapExtensions.CalculatePlayableBounds(objects);
|
||||
|
||||
if (lastHit == 0)
|
||||
lastHit = objects.Last().StartTime;
|
||||
|
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Utils;
|
||||
|
||||
namespace osu.Game.Audio
|
||||
@ -19,11 +20,20 @@ namespace osu.Game.Audio
|
||||
public const string HIT_FINISH = @"hitfinish";
|
||||
public const string HIT_CLAP = @"hitclap";
|
||||
|
||||
public const string BANK_NORMAL = @"normal";
|
||||
public const string BANK_SOFT = @"soft";
|
||||
public const string BANK_DRUM = @"drum";
|
||||
|
||||
/// <summary>
|
||||
/// All valid sample addition constants.
|
||||
/// </summary>
|
||||
public static IEnumerable<string> AllAdditions => new[] { HIT_WHISTLE, HIT_FINISH, HIT_CLAP };
|
||||
|
||||
/// <summary>
|
||||
/// All valid bank constants.
|
||||
/// </summary>
|
||||
public static IEnumerable<string> AllBanks => new[] { BANK_NORMAL, BANK_SOFT, BANK_DRUM };
|
||||
|
||||
/// <summary>
|
||||
/// The name of the sample to load.
|
||||
/// </summary>
|
||||
@ -32,7 +42,7 @@ namespace osu.Game.Audio
|
||||
/// <summary>
|
||||
/// The bank to load the sample from.
|
||||
/// </summary>
|
||||
public readonly string? Bank;
|
||||
public readonly string Bank;
|
||||
|
||||
/// <summary>
|
||||
/// An optional suffix to provide priority lookup. Falls back to non-suffixed <see cref="Name"/>.
|
||||
@ -44,7 +54,7 @@ namespace osu.Game.Audio
|
||||
/// </summary>
|
||||
public int Volume { get; }
|
||||
|
||||
public HitSampleInfo(string name, string? bank = null, string? suffix = null, int volume = 0)
|
||||
public HitSampleInfo(string name, string bank = SampleControlPoint.DEFAULT_BANK, string? suffix = null, int volume = 100)
|
||||
{
|
||||
Name = name;
|
||||
Bank = bank;
|
||||
@ -75,7 +85,7 @@ namespace osu.Game.Audio
|
||||
/// <param name="newSuffix">An optional new lookup suffix.</param>
|
||||
/// <param name="newVolume">An optional new volume.</param>
|
||||
/// <returns>The new <see cref="HitSampleInfo"/>.</returns>
|
||||
public virtual HitSampleInfo With(Optional<string> newName = default, Optional<string?> newBank = default, Optional<string?> newSuffix = default, Optional<int> newVolume = default)
|
||||
public virtual HitSampleInfo With(Optional<string> newName = default, Optional<string> newBank = default, Optional<string?> newSuffix = default, Optional<int> newVolume = default)
|
||||
=> new HitSampleInfo(newName.GetOr(Name), newBank.GetOr(Bank), newSuffix.GetOr(Suffix), newVolume.GetOr(Volume));
|
||||
|
||||
public bool Equals(HitSampleInfo? other)
|
||||
|
@ -107,9 +107,12 @@ namespace osu.Game.Beatmaps
|
||||
// Aggregate durations into a set of (beatLength, duration) tuples for each beat length
|
||||
.GroupBy(t => Math.Round(t.beatLength * 1000) / 1000)
|
||||
.Select(g => (beatLength: g.Key, duration: g.Sum(t => t.duration)))
|
||||
// Get the most common one, or 0 as a suitable default
|
||||
// Get the most common one, or 0 as a suitable default (see handling below)
|
||||
.OrderByDescending(i => i.duration).FirstOrDefault();
|
||||
|
||||
if (mostCommon.beatLength == 0)
|
||||
return TimingControlPoint.DEFAULT_BEAT_LENGTH;
|
||||
|
||||
return mostCommon.beatLength;
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Linq;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
|
||||
@ -22,34 +20,17 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
public virtual void PreProcess()
|
||||
{
|
||||
IHasComboInformation lastObj = null;
|
||||
|
||||
bool isFirst = true;
|
||||
IHasComboInformation? lastObj = null;
|
||||
|
||||
foreach (var obj in Beatmap.HitObjects.OfType<IHasComboInformation>())
|
||||
{
|
||||
if (isFirst)
|
||||
if (lastObj == null)
|
||||
{
|
||||
obj.NewCombo = true;
|
||||
|
||||
// first hitobject should always be marked as a new combo for sanity.
|
||||
isFirst = false;
|
||||
}
|
||||
|
||||
obj.ComboIndex = lastObj?.ComboIndex ?? 0;
|
||||
obj.ComboIndexWithOffsets = lastObj?.ComboIndexWithOffsets ?? 0;
|
||||
obj.IndexInCurrentCombo = (lastObj?.IndexInCurrentCombo + 1) ?? 0;
|
||||
|
||||
if (obj.NewCombo)
|
||||
{
|
||||
obj.IndexInCurrentCombo = 0;
|
||||
obj.ComboIndex++;
|
||||
obj.ComboIndexWithOffsets += obj.ComboOffset + 1;
|
||||
|
||||
if (lastObj != null)
|
||||
lastObj.LastInCombo = true;
|
||||
obj.NewCombo = true;
|
||||
}
|
||||
|
||||
obj.UpdateComboInformation(lastObj);
|
||||
lastObj = obj;
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Logging;
|
||||
@ -11,7 +10,6 @@ using osu.Framework.Platform;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
|
||||
namespace osu.Game.Beatmaps
|
||||
{
|
||||
@ -74,7 +72,7 @@ namespace osu.Game.Beatmaps
|
||||
var calculator = ruleset.CreateDifficultyCalculator(working);
|
||||
|
||||
beatmap.StarRating = calculator.Calculate().StarRating;
|
||||
beatmap.Length = calculateLength(working.Beatmap);
|
||||
beatmap.Length = working.Beatmap.CalculatePlayableLength();
|
||||
beatmap.BPM = 60000 / working.Beatmap.GetMostCommonBeatLength();
|
||||
}
|
||||
|
||||
@ -82,20 +80,6 @@ namespace osu.Game.Beatmaps
|
||||
workingBeatmapCache.Invalidate(beatmapSet);
|
||||
});
|
||||
|
||||
private double calculateLength(IBeatmap b)
|
||||
{
|
||||
if (!b.HitObjects.Any())
|
||||
return 0;
|
||||
|
||||
var lastObject = b.HitObjects.Last();
|
||||
|
||||
//TODO: this isn't always correct (consider mania where a non-last object may last for longer than the last in the list).
|
||||
double endTime = lastObject.GetEndTime();
|
||||
double startTime = b.HitObjects.First().StartTime;
|
||||
|
||||
return endTime - startTime;
|
||||
}
|
||||
|
||||
#region Implementation of IDisposable
|
||||
|
||||
public void Dispose()
|
||||
|
@ -14,7 +14,7 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
/// </remarks>
|
||||
public class SampleControlPoint : ControlPoint, IEquatable<SampleControlPoint>
|
||||
{
|
||||
public const string DEFAULT_BANK = "normal";
|
||||
public const string DEFAULT_BANK = HitSampleInfo.BANK_NORMAL;
|
||||
|
||||
public static readonly SampleControlPoint DEFAULT = new SampleControlPoint
|
||||
{
|
||||
@ -69,7 +69,7 @@ namespace osu.Game.Beatmaps.ControlPoints
|
||||
/// <param name="hitSampleInfo">The <see cref="HitSampleInfo"/>. This will not be modified.</param>
|
||||
/// <returns>The modified <see cref="HitSampleInfo"/>. This does not share a reference with <paramref name="hitSampleInfo"/>.</returns>
|
||||
public virtual HitSampleInfo ApplyTo(HitSampleInfo hitSampleInfo)
|
||||
=> hitSampleInfo.With(newBank: hitSampleInfo.Bank ?? SampleBank, newVolume: hitSampleInfo.Volume > 0 ? hitSampleInfo.Volume : SampleVolume);
|
||||
=> hitSampleInfo.With(newBank: hitSampleInfo.Bank, newVolume: hitSampleInfo.Volume > 0 ? hitSampleInfo.Volume : SampleVolume);
|
||||
|
||||
public override bool IsRedundant(ControlPoint? existing)
|
||||
=> existing is SampleControlPoint existingSample
|
||||
|
@ -12,6 +12,7 @@ using System.Linq;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Beatmaps.Legacy;
|
||||
using osu.Game.Beatmaps.Timing;
|
||||
@ -384,11 +385,11 @@ namespace osu.Game.Beatmaps.Formats
|
||||
break;
|
||||
|
||||
case @"SliderMultiplier":
|
||||
difficulty.SliderMultiplier = Parsing.ParseDouble(pair.Value);
|
||||
difficulty.SliderMultiplier = Math.Clamp(Parsing.ParseDouble(pair.Value), 0.4, 3.6);
|
||||
break;
|
||||
|
||||
case @"SliderTickRate":
|
||||
difficulty.SliderTickRate = Parsing.ParseDouble(pair.Value);
|
||||
difficulty.SliderTickRate = Math.Clamp(Parsing.ParseDouble(pair.Value), 0.5, 8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -480,7 +481,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
|
||||
string stringSampleSet = sampleSet.ToString().ToLowerInvariant();
|
||||
if (stringSampleSet == @"none")
|
||||
stringSampleSet = @"normal";
|
||||
stringSampleSet = HitSampleInfo.BANK_NORMAL;
|
||||
|
||||
if (timingChange)
|
||||
{
|
||||
|
@ -589,13 +589,13 @@ namespace osu.Game.Beatmaps.Formats
|
||||
{
|
||||
switch (sampleBank?.ToLowerInvariant())
|
||||
{
|
||||
case "normal":
|
||||
case HitSampleInfo.BANK_NORMAL:
|
||||
return LegacySampleBank.Normal;
|
||||
|
||||
case "soft":
|
||||
case HitSampleInfo.BANK_SOFT:
|
||||
return LegacySampleBank.Soft;
|
||||
|
||||
case "drum":
|
||||
case HitSampleInfo.BANK_DRUM:
|
||||
return LegacySampleBank.Drum;
|
||||
|
||||
default:
|
||||
|
@ -226,12 +226,16 @@ namespace osu.Game.Beatmaps.Formats
|
||||
|
||||
public override HitSampleInfo ApplyTo(HitSampleInfo hitSampleInfo)
|
||||
{
|
||||
var baseInfo = base.ApplyTo(hitSampleInfo);
|
||||
if (hitSampleInfo is ConvertHitObjectParser.LegacyHitSampleInfo legacy)
|
||||
{
|
||||
return legacy.With(
|
||||
newCustomSampleBank: legacy.CustomSampleBank > 0 ? legacy.CustomSampleBank : CustomSampleBank,
|
||||
newVolume: hitSampleInfo.Volume > 0 ? hitSampleInfo.Volume : SampleVolume,
|
||||
newBank: legacy.BankSpecified ? legacy.Bank : SampleBank
|
||||
);
|
||||
}
|
||||
|
||||
if (baseInfo is ConvertHitObjectParser.LegacyHitSampleInfo legacy && legacy.CustomSampleBank == 0)
|
||||
return legacy.With(newCustomSampleBank: CustomSampleBank);
|
||||
|
||||
return baseInfo;
|
||||
return base.ApplyTo(hitSampleInfo);
|
||||
}
|
||||
|
||||
public override bool IsRedundant(ControlPoint? existing)
|
||||
|
@ -104,6 +104,19 @@ namespace osu.Game.Beatmaps
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find the total milliseconds between the first and last hittable objects.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is cached to <see cref="BeatmapInfo.Length"/>, so using that is preferable when available.
|
||||
/// </remarks>
|
||||
public static double CalculatePlayableLength(this IBeatmap beatmap) => CalculatePlayableLength(beatmap.HitObjects);
|
||||
|
||||
/// <summary>
|
||||
/// Find the timestamps in milliseconds of the start and end of the playable region.
|
||||
/// </summary>
|
||||
public static (double start, double end) CalculatePlayableBounds(this IBeatmap beatmap) => CalculatePlayableBounds(beatmap.HitObjects);
|
||||
|
||||
/// <summary>
|
||||
/// Find the absolute end time of the latest <see cref="HitObject"/> in a beatmap. Will throw if beatmap contains no objects.
|
||||
/// </summary>
|
||||
@ -114,5 +127,36 @@ namespace osu.Game.Beatmaps
|
||||
/// It's not super efficient so calls should be kept to a minimum.
|
||||
/// </remarks>
|
||||
public static double GetLastObjectTime(this IBeatmap beatmap) => beatmap.HitObjects.Max(h => h.GetEndTime());
|
||||
|
||||
#region Helper methods
|
||||
|
||||
/// <summary>
|
||||
/// Find the total milliseconds between the first and last hittable objects.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is cached to <see cref="BeatmapInfo.Length"/>, so using that is preferable when available.
|
||||
/// </remarks>
|
||||
public static double CalculatePlayableLength(IEnumerable<HitObject> objects)
|
||||
{
|
||||
(double start, double end) = CalculatePlayableBounds(objects);
|
||||
|
||||
return end - start;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Find the timestamps in milliseconds of the start and end of the playable region.
|
||||
/// </summary>
|
||||
public static (double start, double end) CalculatePlayableBounds(IEnumerable<HitObject> objects)
|
||||
{
|
||||
if (!objects.Any())
|
||||
return (0, 0);
|
||||
|
||||
double lastObjectTime = objects.Max(o => o.GetEndTime());
|
||||
double firstObjectTime = objects.First().StartTime;
|
||||
|
||||
return (firstObjectTime, lastObjectTime);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,8 @@ namespace osu.Game.Beatmaps
|
||||
float ApproachRate { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The slider multiplier of the associated beatmap.
|
||||
/// The base slider velocity of the associated beatmap.
|
||||
/// This was known as "SliderMultiplier" in the .osu format and stable editor.
|
||||
/// </summary>
|
||||
double SliderMultiplier { get; }
|
||||
|
||||
|
@ -17,6 +17,7 @@ namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
public const float APPEAR_DURATION = 800;
|
||||
public const float DISAPPEAR_DURATION = 500;
|
||||
public const float SHADOW_OPACITY = 0.2f;
|
||||
|
||||
private const Easing easing_show = Easing.OutSine;
|
||||
private const Easing easing_hide = Easing.InSine;
|
||||
|
@ -77,10 +77,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
private void updateState()
|
||||
{
|
||||
hoverClickSounds.Enabled.Value = !Item.Action.Disabled;
|
||||
Alpha = Item.Action.Disabled ? 0.2f : 1;
|
||||
hoverClickSounds.Enabled.Value = IsActionable;
|
||||
Alpha = IsActionable ? 1 : 0.2f;
|
||||
|
||||
if (IsHovered && !Item.Action.Disabled)
|
||||
if (IsHovered && IsActionable)
|
||||
{
|
||||
text.BoldText.FadeIn(transition_length, Easing.OutQuint);
|
||||
text.NormalText.FadeOut(transition_length, Easing.OutQuint);
|
||||
|
@ -89,14 +89,16 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
double floatValue = value.ToDouble(NumberFormatInfo.InvariantInfo);
|
||||
|
||||
if (DisplayAsPercentage)
|
||||
return floatValue.ToString("0%");
|
||||
|
||||
decimal decimalPrecision = normalise(CurrentNumber.Precision.ToDecimal(NumberFormatInfo.InvariantInfo), max_decimal_digits);
|
||||
|
||||
// Find the number of significant digits (we could have less than 5 after normalize())
|
||||
int significantDigits = FormatUtils.FindPrecision(decimalPrecision);
|
||||
|
||||
if (DisplayAsPercentage)
|
||||
{
|
||||
return floatValue.ToString($@"P{Math.Max(0, significantDigits - 2)}");
|
||||
}
|
||||
|
||||
string negativeSign = Math.Round(floatValue, significantDigits) < 0 ? "-" : string.Empty;
|
||||
|
||||
return $"{negativeSign}{Math.Abs(floatValue).ToString($"N{significantDigits}")}";
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Input;
|
||||
using osuTK.Input;
|
||||
|
||||
@ -10,6 +11,10 @@ namespace osu.Game.Input
|
||||
{
|
||||
public partial class OsuUserInputManager : UserInputManager
|
||||
{
|
||||
protected override bool AllowRightClickFromLongTouch => !LocalUserPlaying.Value;
|
||||
|
||||
public readonly BindableBool LocalUserPlaying = new BindableBool();
|
||||
|
||||
internal OsuUserInputManager()
|
||||
{
|
||||
}
|
||||
|
@ -42,8 +42,7 @@ namespace osu.Game.Localisation
|
||||
/// <summary>
|
||||
/// "If enabled, an "Are you ready? 3, 2, 1, GO!" countdown will be inserted at the beginning of the beatmap, assuming there is enough time to do so."
|
||||
/// </summary>
|
||||
public static LocalisableString CountdownDescription => new TranslatableString(getKey(@"countdown_description"),
|
||||
@"If enabled, an ""Are you ready? 3, 2, 1, GO!"" countdown will be inserted at the beginning of the beatmap, assuming there is enough time to do so.");
|
||||
public static LocalisableString CountdownDescription => new TranslatableString(getKey(@"countdown_description"), @"If enabled, an ""Are you ready? 3, 2, 1, GO!"" countdown will be inserted at the beginning of the beatmap, assuming there is enough time to do so.");
|
||||
|
||||
/// <summary>
|
||||
/// "Countdown speed"
|
||||
@ -53,8 +52,7 @@ namespace osu.Game.Localisation
|
||||
/// <summary>
|
||||
/// "If the countdown sounds off-time, use this to make it appear one or more beats early."
|
||||
/// </summary>
|
||||
public static LocalisableString CountdownOffsetDescription =>
|
||||
new TranslatableString(getKey(@"countdown_offset_description"), @"If the countdown sounds off-time, use this to make it appear one or more beats early.");
|
||||
public static LocalisableString CountdownOffsetDescription => new TranslatableString(getKey(@"countdown_offset_description"), @"If the countdown sounds off-time, use this to make it appear one or more beats early.");
|
||||
|
||||
/// <summary>
|
||||
/// "Countdown offset"
|
||||
@ -69,8 +67,7 @@ namespace osu.Game.Localisation
|
||||
/// <summary>
|
||||
/// "Allows storyboards to use the full screen space, rather than be confined to a 4:3 area."
|
||||
/// </summary>
|
||||
public static LocalisableString WidescreenSupportDescription =>
|
||||
new TranslatableString(getKey(@"widescreen_support_description"), @"Allows storyboards to use the full screen space, rather than be confined to a 4:3 area.");
|
||||
public static LocalisableString WidescreenSupportDescription => new TranslatableString(getKey(@"widescreen_support_description"), @"Allows storyboards to use the full screen space, rather than be confined to a 4:3 area.");
|
||||
|
||||
/// <summary>
|
||||
/// "Epilepsy warning"
|
||||
@ -80,8 +77,7 @@ namespace osu.Game.Localisation
|
||||
/// <summary>
|
||||
/// "Recommended if the storyboard or video contain scenes with rapidly flashing colours."
|
||||
/// </summary>
|
||||
public static LocalisableString EpilepsyWarningDescription =>
|
||||
new TranslatableString(getKey(@"epilepsy_warning_description"), @"Recommended if the storyboard or video contain scenes with rapidly flashing colours.");
|
||||
public static LocalisableString EpilepsyWarningDescription => new TranslatableString(getKey(@"epilepsy_warning_description"), @"Recommended if the storyboard or video contain scenes with rapidly flashing colours.");
|
||||
|
||||
/// <summary>
|
||||
/// "Letterbox during breaks"
|
||||
@ -91,8 +87,7 @@ namespace osu.Game.Localisation
|
||||
/// <summary>
|
||||
/// "Adds horizontal letterboxing to give a cinematic look during breaks."
|
||||
/// </summary>
|
||||
public static LocalisableString LetterboxDuringBreaksDescription =>
|
||||
new TranslatableString(getKey(@"letterbox_during_breaks_description"), @"Adds horizontal letterboxing to give a cinematic look during breaks.");
|
||||
public static LocalisableString LetterboxDuringBreaksDescription => new TranslatableString(getKey(@"letterbox_during_breaks_description"), @"Adds horizontal letterboxing to give a cinematic look during breaks.");
|
||||
|
||||
/// <summary>
|
||||
/// "Samples match playback rate"
|
||||
@ -102,8 +97,7 @@ namespace osu.Game.Localisation
|
||||
/// <summary>
|
||||
/// "When enabled, all samples will speed up or slow down when rate-changing mods are enabled."
|
||||
/// </summary>
|
||||
public static LocalisableString SamplesMatchPlaybackRateDescription => new TranslatableString(getKey(@"samples_match_playback_rate_description"),
|
||||
@"When enabled, all samples will speed up or slow down when rate-changing mods are enabled.");
|
||||
public static LocalisableString SamplesMatchPlaybackRateDescription => new TranslatableString(getKey(@"samples_match_playback_rate_description"), @"When enabled, all samples will speed up or slow down when rate-changing mods are enabled.");
|
||||
|
||||
/// <summary>
|
||||
/// "The size of all hit objects"
|
||||
@ -123,8 +117,27 @@ namespace osu.Game.Localisation
|
||||
/// <summary>
|
||||
/// "The harshness of hit windows and difficulty of special objects (ie. spinners)"
|
||||
/// </summary>
|
||||
public static LocalisableString OverallDifficultyDescription =>
|
||||
new TranslatableString(getKey(@"overall_difficulty_description"), @"The harshness of hit windows and difficulty of special objects (ie. spinners)");
|
||||
public static LocalisableString OverallDifficultyDescription => new TranslatableString(getKey(@"overall_difficulty_description"), @"The harshness of hit windows and difficulty of special objects (ie. spinners)");
|
||||
|
||||
/// <summary>
|
||||
/// "Tick Rate"
|
||||
/// </summary>
|
||||
public static LocalisableString TickRate => new TranslatableString(getKey(@"tick_rate"), @"Tick Rate");
|
||||
|
||||
/// <summary>
|
||||
/// "Determines how many "ticks" are generated within long hit objects. A tick rate of 1 will generate ticks on each beat, 2 would be twice per beat, etc."
|
||||
/// </summary>
|
||||
public static LocalisableString TickRateDescription => new TranslatableString(getKey(@"tick_rate_description"), @"Determines how many ""ticks"" are generated within long hit objects. A tick rate of 1 will generate ticks on each beat, 2 would be twice per beat, etc.");
|
||||
|
||||
/// <summary>
|
||||
/// "Base Velocity"
|
||||
/// </summary>
|
||||
public static LocalisableString BaseVelocity => new TranslatableString(getKey(@"base_velocity"), @"Base Velocity");
|
||||
|
||||
/// <summary>
|
||||
/// "The base velocity of the beatmap, affecting things like slider velocity and scroll speed in some rulesets."
|
||||
/// </summary>
|
||||
public static LocalisableString BaseVelocityDescription => new TranslatableString(getKey(@"base_velocity_description"), @"The base velocity of the beatmap, affecting things like slider velocity and scroll speed in some rulesets.");
|
||||
|
||||
/// <summary>
|
||||
/// "Metadata"
|
||||
|
49
osu.Game/Localisation/GameplayMenuOverlayStrings.cs
Normal file
49
osu.Game/Localisation/GameplayMenuOverlayStrings.cs
Normal file
@ -0,0 +1,49 @@
|
||||
// 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.
|
||||
|
||||
using osu.Framework.Localisation;
|
||||
|
||||
namespace osu.Game.Localisation
|
||||
{
|
||||
public static class GameplayMenuOverlayStrings
|
||||
{
|
||||
private const string prefix = @"osu.Game.Resources.Localisation.GameplayMenuOverlay";
|
||||
|
||||
/// <summary>
|
||||
/// "Continue"
|
||||
/// </summary>
|
||||
public static LocalisableString Continue => new TranslatableString(getKey(@"continue"), @"Continue");
|
||||
|
||||
/// <summary>
|
||||
/// "Retry"
|
||||
/// </summary>
|
||||
public static LocalisableString Retry => new TranslatableString(getKey(@"retry"), @"Retry");
|
||||
|
||||
/// <summary>
|
||||
/// "Quit"
|
||||
/// </summary>
|
||||
public static LocalisableString Quit => new TranslatableString(getKey(@"quit"), @"Quit");
|
||||
|
||||
/// <summary>
|
||||
/// "failed"
|
||||
/// </summary>
|
||||
public static LocalisableString FailedHeader => new TranslatableString(getKey(@"failed_header"), @"failed");
|
||||
|
||||
/// <summary>
|
||||
/// "paused"
|
||||
/// </summary>
|
||||
public static LocalisableString PausedHeader => new TranslatableString(getKey(@"paused_header"), @"paused");
|
||||
|
||||
/// <summary>
|
||||
/// "Retry count: "
|
||||
/// </summary>
|
||||
public static LocalisableString RetryCount => new TranslatableString(getKey(@"retry_count"), @"Retry count: ");
|
||||
|
||||
/// <summary>
|
||||
/// "Song progress: "
|
||||
/// </summary>
|
||||
public static LocalisableString SongProgress => new TranslatableString(getKey(@"song_progress"), @"Song progress: ");
|
||||
|
||||
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Online.API;
|
||||
@ -35,6 +36,9 @@ namespace osu.Game.Online.Chat
|
||||
[Resolved]
|
||||
private ChannelManager channelManager { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private GameHost host { get; set; }
|
||||
|
||||
private Bindable<bool> notifyOnUsername;
|
||||
private Bindable<bool> notifyOnPrivateMessage;
|
||||
|
||||
@ -89,8 +93,8 @@ namespace osu.Game.Online.Chat
|
||||
if (channel == null)
|
||||
return;
|
||||
|
||||
// Only send notifications, if ChatOverlay and the target channel aren't visible.
|
||||
if (chatOverlay.IsPresent && channelManager.CurrentChannel.Value == channel)
|
||||
// Only send notifications if ChatOverlay or the target channel aren't visible, or if the window is unfocused
|
||||
if (chatOverlay.IsPresent && channelManager.CurrentChannel.Value == channel && host.IsActive.Value)
|
||||
return;
|
||||
|
||||
foreach (var message in messages.OrderByDescending(m => m.Id))
|
||||
@ -99,6 +103,7 @@ namespace osu.Game.Online.Chat
|
||||
if (message.Id <= channel.LastReadId)
|
||||
return;
|
||||
|
||||
// ignore notifications triggered by local user's own chat messages
|
||||
if (message.Sender.Id == localUser.Value.Id)
|
||||
continue;
|
||||
|
||||
|
@ -269,6 +269,13 @@ namespace osu.Game
|
||||
if (hideToolbar) Toolbar.Hide();
|
||||
}
|
||||
|
||||
protected override UserInputManager CreateUserInputManager()
|
||||
{
|
||||
var userInputManager = base.CreateUserInputManager();
|
||||
(userInputManager as OsuUserInputManager)?.LocalUserPlaying.BindTo(LocalUserPlaying);
|
||||
return userInputManager;
|
||||
}
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
|
||||
|
@ -56,6 +56,7 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
Colour = Color4.Black.Opacity(0),
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Hollow = true,
|
||||
Radius = 10
|
||||
};
|
||||
|
||||
@ -101,7 +102,7 @@ namespace osu.Game.Overlays
|
||||
protected override void PopIn()
|
||||
{
|
||||
base.PopIn();
|
||||
FadeEdgeEffectTo(0.4f, WaveContainer.APPEAR_DURATION, Easing.Out);
|
||||
FadeEdgeEffectTo(WaveContainer.SHADOW_OPACITY, WaveContainer.APPEAR_DURATION, Easing.Out);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
@ -13,7 +11,6 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
@ -27,8 +24,8 @@ namespace osu.Game.Overlays.News
|
||||
|
||||
private readonly APINewsPost post;
|
||||
|
||||
private Box background;
|
||||
private TextFlowContainer main;
|
||||
private Box background = null!;
|
||||
private TextFlowContainer main = null!;
|
||||
|
||||
public NewsCard(APINewsPost post)
|
||||
{
|
||||
@ -41,12 +38,12 @@ namespace osu.Game.Overlays.News
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OverlayColourProvider colourProvider, GameHost host)
|
||||
private void load(OverlayColourProvider colourProvider, OsuGame? game)
|
||||
{
|
||||
if (post.Slug != null)
|
||||
{
|
||||
TooltipText = "view in browser";
|
||||
Action = () => host.OpenUrlExternally("https://osu.ppy.sh/home/news/" + post.Slug);
|
||||
Action = () => game?.OpenUrlExternally(@"/home/news/" + post.Slug);
|
||||
}
|
||||
|
||||
AddRange(new Drawable[]
|
||||
|
@ -20,7 +20,7 @@ using System.Diagnostics;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Online.Chat;
|
||||
|
||||
namespace osu.Game.Overlays.News.Sidebar
|
||||
{
|
||||
@ -59,7 +59,7 @@ namespace osu.Game.Overlays.News.Sidebar
|
||||
new PostsContainer
|
||||
{
|
||||
Expanded = { BindTarget = Expanded },
|
||||
Children = posts.Select(p => new PostButton(p)).ToArray()
|
||||
Children = posts.Select(p => new PostLink(p)).ToArray()
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -123,35 +123,14 @@ namespace osu.Game.Overlays.News.Sidebar
|
||||
}
|
||||
}
|
||||
|
||||
private partial class PostButton : OsuHoverContainer
|
||||
private partial class PostLink : LinkFlowContainer
|
||||
{
|
||||
protected override IEnumerable<Drawable> EffectTargets => new[] { text };
|
||||
|
||||
private readonly TextFlowContainer text;
|
||||
private readonly APINewsPost post;
|
||||
|
||||
public PostButton(APINewsPost post)
|
||||
public PostLink(APINewsPost post)
|
||||
: base(t => t.Font = OsuFont.GetFont(size: 12))
|
||||
{
|
||||
this.post = post;
|
||||
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
Child = text = new TextFlowContainer(t => t.Font = OsuFont.GetFont(size: 12))
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Text = post.Title
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OverlayColourProvider overlayColours, GameHost host)
|
||||
{
|
||||
IdleColour = overlayColours.Light2;
|
||||
HoverColour = overlayColours.Light1;
|
||||
|
||||
TooltipText = "view in browser";
|
||||
Action = () => host.OpenUrlExternally("https://osu.ppy.sh/home/news/" + post.Slug);
|
||||
AddLink(post.Title, LinkAction.External, @"/home/news/" + post.Slug, "view in browser");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,9 +5,11 @@ using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Effects;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Framework.Logging;
|
||||
@ -16,6 +18,7 @@ using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Game.Resources.Localisation.Web;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using NotificationsStrings = osu.Game.Localisation.NotificationsStrings;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
@ -72,6 +75,14 @@ namespace osu.Game.Overlays
|
||||
mainContent = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
EdgeEffect = new EdgeEffectParameters
|
||||
{
|
||||
Colour = Color4.Black.Opacity(0),
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Radius = 10,
|
||||
Hollow = true,
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
@ -199,6 +210,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
this.MoveToX(0, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
mainContent.FadeTo(1, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
mainContent.FadeEdgeEffectTo(WaveContainer.SHADOW_OPACITY, WaveContainer.APPEAR_DURATION, Easing.Out);
|
||||
|
||||
toastTray.FlushAllToasts();
|
||||
}
|
||||
@ -211,6 +223,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
this.MoveToX(WIDTH, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
mainContent.FadeTo(0, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
mainContent.FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.In);
|
||||
}
|
||||
|
||||
private void notificationClosed() => Schedule(() =>
|
||||
|
@ -77,6 +77,14 @@ namespace osu.Game.Overlays
|
||||
base.Content.Add(mainContent);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
// Ensure the scroll-to-top button is displayed above the fixed header.
|
||||
AddInternal(ScrollFlow.Button.CreateProxy());
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Overlays
|
||||
/// </summary>
|
||||
private const int button_scroll_position = 200;
|
||||
|
||||
protected ScrollBackButton Button;
|
||||
public ScrollBackButton Button { get; private set; }
|
||||
|
||||
private readonly Bindable<float?> lastScrollTarget = new Bindable<float?>();
|
||||
|
||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Settings.Sections
|
||||
new SettingsButton
|
||||
{
|
||||
Text = GeneralSettingsStrings.RunSetupWizard,
|
||||
Keywords = new[] { @"first run", @"initial", @"getting started" },
|
||||
Keywords = new[] { @"first run", @"initial", @"getting started", @"import", @"tutorial", @"recommended beatmaps" },
|
||||
TooltipText = FirstRunSetupOverlayStrings.FirstRunSetupDescription,
|
||||
Action = () => firstRunSetupOverlay?.Show(),
|
||||
},
|
||||
|
@ -193,17 +193,18 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
|
||||
currentDisplay.BindValueChanged(display => Schedule(() =>
|
||||
{
|
||||
resolutions.RemoveRange(1, resolutions.Count - 1);
|
||||
|
||||
if (display.NewValue != null)
|
||||
if (display.NewValue == null)
|
||||
{
|
||||
resolutions.AddRange(display.NewValue.DisplayModes
|
||||
.Where(m => m.Size.Width >= 800 && m.Size.Height >= 600)
|
||||
.OrderByDescending(m => Math.Max(m.Size.Height, m.Size.Width))
|
||||
.Select(m => m.Size)
|
||||
.Distinct());
|
||||
resolutions.Clear();
|
||||
return;
|
||||
}
|
||||
|
||||
resolutions.ReplaceRange(1, resolutions.Count - 1, display.NewValue.DisplayModes
|
||||
.Where(m => m.Size.Width >= 800 && m.Size.Height >= 600)
|
||||
.OrderByDescending(m => Math.Max(m.Size.Height, m.Size.Width))
|
||||
.Select(m => m.Size)
|
||||
.Distinct());
|
||||
|
||||
updateDisplaySettingsVisibility();
|
||||
}), true);
|
||||
|
||||
@ -244,7 +245,8 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
{
|
||||
Scheduler.AddOnce(d =>
|
||||
{
|
||||
displayDropdown.Items = d;
|
||||
if (!displayDropdown.Items.SequenceEqual(d, DisplayListComparer.DEFAULT))
|
||||
displayDropdown.Items = d;
|
||||
updateDisplaySettingsVisibility();
|
||||
}, displays);
|
||||
}
|
||||
@ -376,5 +378,43 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Contrary to <see cref="Display.Equals(osu.Framework.Platform.Display?)"/>, this comparer disregards the value of <see cref="Display.Bounds"/>.
|
||||
/// We want to just show a list of displays, and for the purposes of settings we don't care about their bounds when it comes to the list.
|
||||
/// However, <see cref="IWindow.DisplaysChanged"/> fires even if only the resolution of the current display was changed
|
||||
/// (because it causes the bounds of all displays to also change).
|
||||
/// We're not interested in those changes, so compare only the rest that we actually care about.
|
||||
/// This helps to avoid a bindable/event feedback loop, in which a resolution change
|
||||
/// would trigger a display "change", which would in turn reset resolution again.
|
||||
/// </summary>
|
||||
private class DisplayListComparer : IEqualityComparer<Display>
|
||||
{
|
||||
public static readonly DisplayListComparer DEFAULT = new DisplayListComparer();
|
||||
|
||||
public bool Equals(Display? x, Display? y)
|
||||
{
|
||||
if (ReferenceEquals(x, y)) return true;
|
||||
if (ReferenceEquals(x, null)) return false;
|
||||
if (ReferenceEquals(y, null)) return false;
|
||||
|
||||
return x.Index == y.Index
|
||||
&& x.Name == y.Name
|
||||
&& x.DisplayModes.SequenceEqual(y.DisplayModes);
|
||||
}
|
||||
|
||||
public int GetHashCode(Display obj)
|
||||
{
|
||||
var hashCode = new HashCode();
|
||||
|
||||
hashCode.Add(obj.Index);
|
||||
hashCode.Add(obj.Name);
|
||||
hashCode.Add(obj.DisplayModes.Length);
|
||||
foreach (var displayMode in obj.DisplayModes)
|
||||
hashCode.Add(displayMode);
|
||||
|
||||
return hashCode.ToHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,8 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
@ -23,6 +25,8 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
{
|
||||
public partial class TabletSettings : SettingsSubsection
|
||||
{
|
||||
public override IEnumerable<LocalisableString> FilterTerms => base.FilterTerms.Concat(new LocalisableString[] { "area" });
|
||||
|
||||
public TabletAreaSelection AreaSelection { get; private set; }
|
||||
|
||||
private readonly ITabletHandler tabletHandler;
|
||||
|
@ -10,15 +10,18 @@ using System.Threading.Tasks;
|
||||
using osuTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Effects;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Overlays.Settings;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
@ -105,6 +108,14 @@ namespace osu.Game.Overlays
|
||||
Add(SectionsContainer = new SettingsSectionsContainer
|
||||
{
|
||||
Masking = true,
|
||||
EdgeEffect = new EdgeEffectParameters
|
||||
{
|
||||
Colour = Color4.Black.Opacity(0),
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Hollow = true,
|
||||
Radius = 10
|
||||
},
|
||||
MaskingSmoothness = 0,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ExpandableHeader = CreateHeader(),
|
||||
SelectedSection = { BindTarget = CurrentSection },
|
||||
@ -156,6 +167,8 @@ namespace osu.Game.Overlays
|
||||
|
||||
ContentContainer.MoveToX(ExpandedPosition, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
|
||||
SectionsContainer.FadeEdgeEffectTo(WaveContainer.SHADOW_OPACITY, WaveContainer.APPEAR_DURATION, Easing.Out);
|
||||
|
||||
// delay load enough to ensure it doesn't overlap with the initial animation.
|
||||
// this is done as there is still a brief stutter during load completion which is more visible if the transition is in progress.
|
||||
// the eventual goal would be to remove the need for this by splitting up load into smaller work pieces, or fixing the remaining
|
||||
@ -175,6 +188,7 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
base.PopOut();
|
||||
|
||||
SectionsContainer.FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.In);
|
||||
ContentContainer.MoveToX(-WIDTH + ExpandedPosition, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
|
||||
Sidebar?.MoveToX(-sidebar_width, TRANSITION_LENGTH, Easing.OutQuint);
|
||||
|
@ -113,7 +113,7 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
|
||||
if (replayGeneratingMod != null)
|
||||
screen.Push(new PlayerLoader(() => new ReplayPlayer((beatmap, mods) => replayGeneratingMod.CreateScoreFromReplayData(beatmap, mods))));
|
||||
}, new[] { typeof(Player), typeof(SongSelect) })
|
||||
}, new[] { typeof(Player), typeof(PlaySongSelect) })
|
||||
},
|
||||
}
|
||||
},
|
||||
|
@ -249,12 +249,14 @@ namespace osu.Game.Overlays
|
||||
|
||||
private partial class ProfileSectionsContainer : SectionsContainer<ProfileSection>
|
||||
{
|
||||
private OverlayScrollContainer scroll = null!;
|
||||
|
||||
public ProfileSectionsContainer()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
protected override UserTrackingScrollContainer CreateScrollContainer() => new OverlayScrollContainer();
|
||||
protected override UserTrackingScrollContainer CreateScrollContainer() => scroll = new OverlayScrollContainer();
|
||||
|
||||
// Reverse child ID is required so expanding beatmap panels can appear above sections below them.
|
||||
// This can also be done by setting Depth when adding new sections above if using ReverseChildID turns out to have any issues.
|
||||
@ -267,6 +269,14 @@ namespace osu.Game.Overlays
|
||||
Padding = new MarginPadding { Horizontal = 10 },
|
||||
Margin = new MarginPadding { Bottom = 10 },
|
||||
};
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
// Ensure the scroll-to-top button is displayed above the fixed header.
|
||||
AddInternal(scroll.Button.CreateProxy());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -157,7 +157,9 @@ namespace osu.Game.Overlays
|
||||
|
||||
private void onFail(string originalPath)
|
||||
{
|
||||
wikiData.Value = null;
|
||||
path.Value = "error";
|
||||
|
||||
LoadDisplay(articlePage = new WikiArticlePage($@"{api.WebsiteRootUrl}/wiki/",
|
||||
$"Something went wrong when trying to fetch page \"{originalPath}\".\n\n[Return to the main page](Main_Page)."));
|
||||
}
|
||||
|
@ -77,6 +77,8 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
private FillFlowContainer togglesCollection;
|
||||
|
||||
private FillFlowContainer sampleBankTogglesCollection;
|
||||
|
||||
private IBindable<bool> hasTiming;
|
||||
private Bindable<bool> autoSeekOnPlacement;
|
||||
|
||||
@ -160,6 +162,16 @@ namespace osu.Game.Rulesets.Edit
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(0, 5),
|
||||
},
|
||||
},
|
||||
new EditorToolboxGroup("bank (Shift-Q~R)")
|
||||
{
|
||||
Child = sampleBankTogglesCollection = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(0, 5),
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -197,6 +209,8 @@ namespace osu.Game.Rulesets.Edit
|
||||
TernaryStates = CreateTernaryButtons().ToArray();
|
||||
togglesCollection.AddRange(TernaryStates.Select(b => new DrawableTernaryButton(b)));
|
||||
|
||||
sampleBankTogglesCollection.AddRange(BlueprintContainer.SampleBankTernaryStates.Select(b => new DrawableTernaryButton(b)));
|
||||
|
||||
setSelectTool();
|
||||
|
||||
EditorBeatmap.SelectedHitObjects.CollectionChanged += selectionChanged;
|
||||
@ -249,7 +263,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
/// <summary>
|
||||
/// Create all ternary states required to be displayed to the user.
|
||||
/// </summary>
|
||||
protected virtual IEnumerable<TernaryButton> CreateTernaryButtons() => BlueprintContainer.TernaryStates;
|
||||
protected virtual IEnumerable<TernaryButton> CreateTernaryButtons() => BlueprintContainer.MainTernaryStates;
|
||||
|
||||
/// <summary>
|
||||
/// Construct a relevant blueprint container. This will manage hitobject selection/placement input handling and display logic.
|
||||
@ -274,7 +288,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
{
|
||||
if (e.ControlPressed || e.AltPressed || e.SuperPressed || e.ShiftPressed)
|
||||
if (e.ControlPressed || e.AltPressed || e.SuperPressed)
|
||||
return false;
|
||||
|
||||
if (checkLeftToggleFromKey(e.Key, out int leftIndex))
|
||||
@ -291,7 +305,9 @@ namespace osu.Game.Rulesets.Edit
|
||||
|
||||
if (checkRightToggleFromKey(e.Key, out int rightIndex))
|
||||
{
|
||||
var item = togglesCollection.ElementAtOrDefault(rightIndex);
|
||||
var item = e.ShiftPressed
|
||||
? sampleBankTogglesCollection.ElementAtOrDefault(rightIndex)
|
||||
: togglesCollection.ElementAtOrDefault(rightIndex);
|
||||
|
||||
if (item is DrawableTernaryButton button)
|
||||
{
|
||||
@ -428,7 +444,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
var playfield = PlayfieldAtScreenSpacePosition(screenSpacePosition);
|
||||
double? targetTime = null;
|
||||
|
||||
if (snapType.HasFlagFast(SnapType.Grids))
|
||||
if (snapType.HasFlagFast(SnapType.GlobalGrids))
|
||||
{
|
||||
if (playfield is ScrollingPlayfield scrollingPlayfield)
|
||||
{
|
||||
|
@ -1,19 +1,20 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Edit.Compose;
|
||||
using osuTK;
|
||||
@ -24,35 +25,51 @@ namespace osu.Game.Rulesets.Edit
|
||||
/// <summary>
|
||||
/// A blueprint which governs the creation of a new <see cref="HitObject"/> to actualisation.
|
||||
/// </summary>
|
||||
public abstract partial class PlacementBlueprint : CompositeDrawable
|
||||
public abstract partial class PlacementBlueprint : CompositeDrawable, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
/// <summary>
|
||||
/// Whether the <see cref="HitObject"/> is currently mid-placement, but has not necessarily finished being placed.
|
||||
/// </summary>
|
||||
public PlacementState PlacementActive { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the sample bank should be taken from the previous hit object.
|
||||
/// </summary>
|
||||
public bool AutomaticBankAssignment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The <see cref="HitObject"/> that is being placed.
|
||||
/// </summary>
|
||||
public readonly HitObject HitObject;
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
protected EditorClock EditorClock { get; private set; }
|
||||
[Resolved]
|
||||
protected EditorClock EditorClock { get; private set; } = null!;
|
||||
|
||||
[Resolved]
|
||||
private EditorBeatmap beatmap { get; set; }
|
||||
private EditorBeatmap beatmap { get; set; } = null!;
|
||||
|
||||
private Bindable<double> startTimeBindable;
|
||||
private Bindable<double> startTimeBindable = null!;
|
||||
|
||||
private HitObject? getPreviousHitObject() => beatmap.HitObjects.TakeWhile(h => h.StartTime <= startTimeBindable.Value).LastOrDefault();
|
||||
|
||||
[Resolved]
|
||||
private IPlacementHandler placementHandler { get; set; }
|
||||
private IPlacementHandler placementHandler { get; set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this blueprint is currently in a state that can be committed.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Override this with any preconditions that should be double-checked on committing.
|
||||
/// If <c>false</c> is returned and a commit is attempted, the blueprint will be destroyed instead.
|
||||
/// </remarks>
|
||||
protected virtual bool IsValidForPlacement => true;
|
||||
|
||||
protected PlacementBlueprint(HitObject hitObject)
|
||||
{
|
||||
HitObject = hitObject;
|
||||
|
||||
// adding the default hit sample should be the case regardless of the ruleset.
|
||||
HitObject.Samples.Add(new HitSampleInfo(HitSampleInfo.HIT_NORMAL, SampleControlPoint.DEFAULT_BANK, volume: 100));
|
||||
HitObject.Samples.Add(new HitSampleInfo(HitSampleInfo.HIT_NORMAL));
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
@ -74,11 +91,6 @@ namespace osu.Game.Rulesets.Edit
|
||||
/// <param name="commitStart">Whether this call is committing a value for HitObject.StartTime and continuing with further adjustments.</param>
|
||||
protected void BeginPlacement(bool commitStart = false)
|
||||
{
|
||||
// Take the hitnormal sample of the last hit object
|
||||
var lastHitNormal = beatmap.HitObjects.LastOrDefault(h => h.GetEndTime() < HitObject.StartTime)?.Samples?.FirstOrDefault(o => o.Name == HitSampleInfo.HIT_NORMAL);
|
||||
if (lastHitNormal != null)
|
||||
HitObject.Samples[0] = lastHitNormal;
|
||||
|
||||
placementHandler.BeginPlacement(HitObject);
|
||||
if (commitStart)
|
||||
PlacementActive = PlacementState.Active;
|
||||
@ -88,7 +100,7 @@ namespace osu.Game.Rulesets.Edit
|
||||
/// Signals that the placement of <see cref="HitObject"/> has finished.
|
||||
/// This will destroy this <see cref="PlacementBlueprint"/>, and add the HitObject.StartTime to the <see cref="Beatmap"/>.
|
||||
/// </summary>
|
||||
/// <param name="commit">Whether the object should be committed.</param>
|
||||
/// <param name="commit">Whether the object should be committed. Note that a commit may fail if <see cref="IsValidForPlacement"/> is <c>false</c>.</param>
|
||||
public void EndPlacement(bool commit)
|
||||
{
|
||||
switch (PlacementActive)
|
||||
@ -102,10 +114,34 @@ namespace osu.Game.Rulesets.Edit
|
||||
break;
|
||||
}
|
||||
|
||||
placementHandler.EndPlacement(HitObject, commit);
|
||||
placementHandler.EndPlacement(HitObject, IsValidForPlacement && commit);
|
||||
PlacementActive = PlacementState.Finished;
|
||||
}
|
||||
|
||||
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||
{
|
||||
if (PlacementActive == PlacementState.Waiting)
|
||||
return false;
|
||||
|
||||
switch (e.Action)
|
||||
{
|
||||
case GlobalAction.Select:
|
||||
EndPlacement(true);
|
||||
return true;
|
||||
|
||||
case GlobalAction.Back:
|
||||
EndPlacement(false);
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the time and position of this <see cref="PlacementBlueprint"/> based on the provided snap information.
|
||||
/// </summary>
|
||||
@ -113,7 +149,20 @@ namespace osu.Game.Rulesets.Edit
|
||||
public virtual void UpdateTimeAndPosition(SnapResult result)
|
||||
{
|
||||
if (PlacementActive == PlacementState.Waiting)
|
||||
HitObject.StartTime = result.Time ?? EditorClock?.CurrentTime ?? Time.Current;
|
||||
{
|
||||
HitObject.StartTime = result.Time ?? EditorClock.CurrentTime;
|
||||
|
||||
if (HitObject is IHasComboInformation comboInformation)
|
||||
comboInformation.UpdateComboInformation(getPreviousHitObject() as IHasComboInformation);
|
||||
}
|
||||
|
||||
if (AutomaticBankAssignment)
|
||||
{
|
||||
// Take the hitnormal sample of the last hit object
|
||||
var lastHitNormal = getPreviousHitObject()?.Samples?.FirstOrDefault(o => o.Name == HitSampleInfo.HIT_NORMAL);
|
||||
if (lastHitNormal != null)
|
||||
HitObject.Samples[0] = lastHitNormal;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -11,8 +11,24 @@ namespace osu.Game.Rulesets.Edit
|
||||
public enum SnapType
|
||||
{
|
||||
None = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Snapping to visible nearby objects.
|
||||
/// </summary>
|
||||
NearbyObjects = 1 << 0,
|
||||
Grids = 1 << 1,
|
||||
All = NearbyObjects | Grids,
|
||||
|
||||
/// <summary>
|
||||
/// Grids which are global to the playfield.
|
||||
/// </summary>
|
||||
GlobalGrids = 1 << 1,
|
||||
|
||||
/// <summary>
|
||||
/// Grids which are relative to other nearby hit objects.
|
||||
/// </summary>
|
||||
RelativeGrids = 1 << 2,
|
||||
|
||||
AllGrids = RelativeGrids | GlobalGrids,
|
||||
|
||||
All = NearbyObjects | GlobalGrids | RelativeGrids,
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ using System.Linq;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Localisation.HUD;
|
||||
using osu.Game.Overlays.Settings;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
@ -42,30 +43,44 @@ namespace osu.Game.Rulesets.Mods
|
||||
Value = 0.9,
|
||||
};
|
||||
|
||||
private ScoreProcessor scoreProcessor = null!;
|
||||
[SettingSource("Accuracy mode", "The mode of accuracy that will trigger failure.")]
|
||||
public Bindable<AccuracyMode> AccuracyJudgeMode { get; } = new Bindable<AccuracyMode>();
|
||||
|
||||
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) => this.scoreProcessor = scoreProcessor;
|
||||
private readonly Bindable<double> currentAccuracy = new Bindable<double>();
|
||||
|
||||
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
|
||||
{
|
||||
switch (AccuracyJudgeMode.Value)
|
||||
{
|
||||
case AccuracyMode.Standard:
|
||||
currentAccuracy.BindTo(scoreProcessor.Accuracy);
|
||||
break;
|
||||
|
||||
case AccuracyMode.MaximumAchievable:
|
||||
currentAccuracy.BindTo(scoreProcessor.MaximumAccuracy);
|
||||
break;
|
||||
}
|
||||
|
||||
currentAccuracy.BindValueChanged(s =>
|
||||
{
|
||||
if (s.NewValue < MinimumAccuracy.Value)
|
||||
{
|
||||
TriggerFailure();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public ScoreRank AdjustRank(ScoreRank rank, double accuracy) => rank;
|
||||
|
||||
protected override bool FailCondition(HealthProcessor healthProcessor, JudgementResult result)
|
||||
protected override bool FailCondition(HealthProcessor healthProcessor, JudgementResult result) => false;
|
||||
|
||||
public enum AccuracyMode
|
||||
{
|
||||
if (!result.Type.AffectsAccuracy())
|
||||
return false;
|
||||
[LocalisableDescription(typeof(GameplayAccuracyCounterStrings), nameof(GameplayAccuracyCounterStrings.AccuracyDisplayModeMax))]
|
||||
MaximumAchievable,
|
||||
|
||||
return getAccuracyWithImminentResultAdded(result) < MinimumAccuracy.Value;
|
||||
}
|
||||
|
||||
private double getAccuracyWithImminentResultAdded(JudgementResult result)
|
||||
{
|
||||
var score = new ScoreInfo { Ruleset = scoreProcessor.Ruleset.RulesetInfo };
|
||||
|
||||
// This is super ugly, but if we don't do it this way we will not have the most recent result added to the accuracy value.
|
||||
// Hopefully we can improve this in the future.
|
||||
scoreProcessor.PopulateScore(score);
|
||||
score.Statistics[result.Type]++;
|
||||
|
||||
return scoreProcessor.ComputeAccuracy(score);
|
||||
[LocalisableDescription(typeof(GameplayAccuracyCounterStrings), nameof(GameplayAccuracyCounterStrings.AccuracyDisplayModeStandard))]
|
||||
Standard,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ using osuTK.Graphics;
|
||||
namespace osu.Game.Rulesets.Objects.Drawables
|
||||
{
|
||||
[Cached(typeof(DrawableHitObject))]
|
||||
public abstract partial class DrawableHitObject : PoolableDrawableWithLifetime<HitObjectLifetimeEntry>
|
||||
public abstract partial class DrawableHitObject : PoolableDrawableWithLifetime<HitObjectLifetimeEntry>, IAnimationTimeReference
|
||||
{
|
||||
/// <summary>
|
||||
/// Invoked after this <see cref="DrawableHitObject"/>'s applied <see cref="HitObject"/> has had its defaults applied.
|
||||
@ -425,11 +425,13 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
|
||||
LifetimeEnd = double.MaxValue;
|
||||
|
||||
double transformTime = HitObject.StartTime - InitialLifetimeOffset;
|
||||
|
||||
clearExistingStateTransforms();
|
||||
|
||||
using (BeginAbsoluteSequence(transformTime))
|
||||
double initialTransformsTime = HitObject.StartTime - InitialLifetimeOffset;
|
||||
|
||||
AnimationStartTime.Value = initialTransformsTime;
|
||||
|
||||
using (BeginAbsoluteSequence(initialTransformsTime))
|
||||
UpdateInitialTransforms();
|
||||
|
||||
using (BeginAbsoluteSequence(StateUpdateTime))
|
||||
@ -721,6 +723,8 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
if (CurrentSkin != null)
|
||||
CurrentSkin.SourceChanged -= skinSourceChanged;
|
||||
}
|
||||
|
||||
public Bindable<double> AnimationStartTime { get; } = new BindableDouble();
|
||||
}
|
||||
|
||||
public abstract partial class DrawableHitObject<TObject> : DrawableHitObject
|
||||
|
@ -206,14 +206,20 @@ namespace osu.Game.Rulesets.Objects
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a SampleInfo based on the sample settings of the hit normal sample in <see cref="Samples"/>.
|
||||
/// Create a <see cref="HitSampleInfo"/> based on the sample settings of the first <see cref="HitSampleInfo.HIT_NORMAL"/> sample in <see cref="Samples"/>.
|
||||
/// If no sample is available, sane default settings will be used instead.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// In the case an existing sample exists, all settings apart from the sample name will be inherited. This includes volume, bank and suffix.
|
||||
/// </remarks>
|
||||
/// <param name="sampleName">The name of the sample.</param>
|
||||
/// <returns>A populated <see cref="HitSampleInfo"/>.</returns>
|
||||
public HitSampleInfo GetSampleInfo(string sampleName = HitSampleInfo.HIT_NORMAL)
|
||||
public HitSampleInfo CreateHitSampleInfo(string sampleName = HitSampleInfo.HIT_NORMAL)
|
||||
{
|
||||
var hitnormalSample = Samples.FirstOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL);
|
||||
return hitnormalSample == null ? new HitSampleInfo(sampleName, SampleControlPoint.DEFAULT_BANK, volume: 100) : hitnormalSample.With(newName: sampleName);
|
||||
if (Samples.FirstOrDefault(s => s.Name == HitSampleInfo.HIT_NORMAL) is HitSampleInfo existingSample)
|
||||
return existingSample.With(newName: sampleName);
|
||||
|
||||
return new HitSampleInfo(sampleName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@ using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Beatmaps.Legacy;
|
||||
using osu.Game.Skinning;
|
||||
using osu.Game.Utils;
|
||||
@ -446,9 +447,9 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
if (string.IsNullOrEmpty(bankInfo.Filename))
|
||||
{
|
||||
soundTypes.Add(new LegacyHitSampleInfo(HitSampleInfo.HIT_NORMAL, bankInfo.BankForNormal, bankInfo.Volume, bankInfo.CustomSampleBank,
|
||||
// if the sound type doesn't have the Normal flag set, attach it anyway as a layered sample.
|
||||
// None also counts as a normal non-layered sample: https://osu.ppy.sh/help/wiki/osu!_File_Formats/Osu_(file_format)#hitsounds
|
||||
type != LegacyHitSoundType.None && !type.HasFlagFast(LegacyHitSoundType.Normal)));
|
||||
// if the sound type doesn't have the Normal flag set, attach it anyway as a layered sample.
|
||||
// None also counts as a normal non-layered sample: https://osu.ppy.sh/help/wiki/osu!_File_Formats/Osu_(file_format)#hitsounds
|
||||
type != LegacyHitSoundType.None && !type.HasFlagFast(LegacyHitSoundType.Normal)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -479,12 +480,14 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
/// The bank identifier to use for the base ("hitnormal") sample.
|
||||
/// Transferred to <see cref="HitSampleInfo.Bank"/> when appropriate.
|
||||
/// </summary>
|
||||
[CanBeNull]
|
||||
public string BankForNormal;
|
||||
|
||||
/// <summary>
|
||||
/// The bank identifier to use for additions ("hitwhistle", "hitfinish", "hitclap").
|
||||
/// Transferred to <see cref="HitSampleInfo.Bank"/> when appropriate.
|
||||
/// </summary>
|
||||
[CanBeNull]
|
||||
public string BankForAdditions;
|
||||
|
||||
/// <summary>
|
||||
@ -518,17 +521,24 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
/// </remarks>
|
||||
public readonly bool IsLayered;
|
||||
|
||||
/// <summary>
|
||||
/// Whether a bank was specified locally to the relevant hitobject.
|
||||
/// If <c>false</c>, a bank will be retrieved from the closest control point.
|
||||
/// </summary>
|
||||
public bool BankSpecified;
|
||||
|
||||
public LegacyHitSampleInfo(string name, string? bank = null, int volume = 0, int customSampleBank = 0, bool isLayered = false)
|
||||
: base(name, bank, customSampleBank >= 2 ? customSampleBank.ToString() : null, volume)
|
||||
: base(name, bank ?? SampleControlPoint.DEFAULT_BANK, customSampleBank >= 2 ? customSampleBank.ToString() : null, volume)
|
||||
{
|
||||
CustomSampleBank = customSampleBank;
|
||||
BankSpecified = !string.IsNullOrEmpty(bank);
|
||||
IsLayered = isLayered;
|
||||
}
|
||||
|
||||
public sealed override HitSampleInfo With(Optional<string> newName = default, Optional<string?> newBank = default, Optional<string?> newSuffix = default, Optional<int> newVolume = default)
|
||||
public sealed override HitSampleInfo With(Optional<string> newName = default, Optional<string> newBank = default, Optional<string?> newSuffix = default, Optional<int> newVolume = default)
|
||||
=> With(newName, newBank, newVolume);
|
||||
|
||||
public virtual LegacyHitSampleInfo With(Optional<string> newName = default, Optional<string?> newBank = default, Optional<int> newVolume = default,
|
||||
public virtual LegacyHitSampleInfo With(Optional<string> newName = default, Optional<string> newBank = default, Optional<int> newVolume = default,
|
||||
Optional<int> newCustomSampleBank = default,
|
||||
Optional<bool> newIsLayered = default)
|
||||
=> new LegacyHitSampleInfo(newName.GetOr(Name), newBank.GetOr(Bank), newVolume.GetOr(Volume), newCustomSampleBank.GetOr(CustomSampleBank), newIsLayered.GetOr(IsLayered));
|
||||
@ -563,7 +573,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
Path.ChangeExtension(Filename, null)
|
||||
};
|
||||
|
||||
public sealed override LegacyHitSampleInfo With(Optional<string> newName = default, Optional<string?> newBank = default, Optional<int> newVolume = default,
|
||||
public sealed override LegacyHitSampleInfo With(Optional<string> newName = default, Optional<string> newBank = default, Optional<int> newVolume = default,
|
||||
Optional<int> newCustomSampleBank = default,
|
||||
Optional<bool> newIsLayered = default)
|
||||
=> new FileHitSampleInfo(Filename, newVolume.GetOr(Volume));
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK.Graphics;
|
||||
@ -65,5 +63,26 @@ namespace osu.Game.Rulesets.Objects.Types
|
||||
{
|
||||
return skin.GetConfig<SkinComboColourLookup, Color4>(new SkinComboColourLookup(comboIndex, combo))?.Value ?? Color4.White;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Given the previous object in the beatmap, update relevant combo information.
|
||||
/// </summary>
|
||||
/// <param name="lastObj">The previous hitobject, or null if this is the first object in the beatmap.</param>
|
||||
void UpdateComboInformation(IHasComboInformation? lastObj)
|
||||
{
|
||||
ComboIndex = lastObj?.ComboIndex ?? 0;
|
||||
ComboIndexWithOffsets = lastObj?.ComboIndexWithOffsets ?? 0;
|
||||
IndexInCurrentCombo = (lastObj?.IndexInCurrentCombo + 1) ?? 0;
|
||||
|
||||
if (NewCombo || lastObj == null)
|
||||
{
|
||||
IndexInCurrentCombo = 0;
|
||||
ComboIndex++;
|
||||
ComboIndexWithOffsets += ComboOffset + 1;
|
||||
|
||||
if (lastObj != null)
|
||||
lastObj.LastInCombo = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ namespace osu.Game.Rulesets.UI
|
||||
PlaySamples(samples);
|
||||
}
|
||||
|
||||
protected void PlaySamples(ISampleInfo[] samples) => Schedule(() =>
|
||||
protected virtual void PlaySamples(ISampleInfo[] samples) => Schedule(() =>
|
||||
{
|
||||
var hitSound = getNextSample();
|
||||
hitSound.Samples = samples;
|
||||
|
@ -28,6 +28,8 @@ namespace osu.Game.Rulesets.UI
|
||||
public abstract partial class RulesetInputManager<T> : PassThroughInputManager, ICanAttachHUDPieces, IHasReplayHandler, IHasRecordingHandler
|
||||
where T : struct
|
||||
{
|
||||
protected override bool AllowRightClickFromLongTouch => false;
|
||||
|
||||
public readonly KeyBindingContainer<T> KeyBindingContainer;
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace osu.Game.Rulesets.UI.Scrolling.Algorithms
|
||||
{
|
||||
public interface IScrollAlgorithm
|
||||
|
@ -1,9 +1,7 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Framework.Lists;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
@ -40,29 +38,16 @@ namespace osu.Game.Rulesets.UI.Scrolling.Algorithms
|
||||
|
||||
public double TimeAt(float position, double currentTime, double timeRange, float scrollLength)
|
||||
{
|
||||
// Find the control point relating to the position.
|
||||
Debug.Assert(controlPoints.Count > 0);
|
||||
|
||||
// Iterate over control points and find the most relevant for the provided position.
|
||||
// Note: Due to velocity adjustments, overlapping control points will provide multiple valid time values for a single position
|
||||
// As such, this operation provides unexpected results by using the latter of the control points.
|
||||
var relevantControlPoint = controlPoints.LastOrDefault(cp => PositionAt(cp.Time, currentTime, timeRange, scrollLength) <= position) ?? controlPoints.First();
|
||||
|
||||
int i = 0;
|
||||
float pos = 0;
|
||||
float positionAtControlPoint = PositionAt(relevantControlPoint.Time, currentTime, timeRange, scrollLength);
|
||||
|
||||
for (; i < controlPoints.Count; i++)
|
||||
{
|
||||
float lastPos = pos;
|
||||
pos = PositionAt(controlPoints[i].Time, currentTime, timeRange, scrollLength);
|
||||
|
||||
if (pos > position)
|
||||
{
|
||||
i--;
|
||||
pos = lastPos;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
i = Math.Clamp(i, 0, controlPoints.Count - 1);
|
||||
|
||||
return controlPoints[i].Time + (position - pos) * timeRange / controlPoints[i].Multiplier / scrollLength;
|
||||
return relevantControlPoint.Time + (position - positionAtControlPoint) * timeRange / relevantControlPoint.Multiplier / scrollLength;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
|
@ -154,12 +154,15 @@ namespace osu.Game.Screens.Edit
|
||||
/// </summary>
|
||||
/// <param name="index">The 0-based beat index.</param>
|
||||
/// <param name="beatDivisor">The beat divisor.</param>
|
||||
/// <param name="validDivisors">The list of valid divisors which can be chosen from. Assumes ordered from low to high. Defaults to <see cref="PREDEFINED_DIVISORS"/> if omitted.</param>
|
||||
/// <returns>The applicable divisor.</returns>
|
||||
public static int GetDivisorForBeatIndex(int index, int beatDivisor)
|
||||
public static int GetDivisorForBeatIndex(int index, int beatDivisor, int[] validDivisors = null)
|
||||
{
|
||||
validDivisors ??= PREDEFINED_DIVISORS;
|
||||
|
||||
int beat = index % beatDivisor;
|
||||
|
||||
foreach (int divisor in PREDEFINED_DIVISORS)
|
||||
foreach (int divisor in validDivisors)
|
||||
{
|
||||
if ((beat * divisor) % beatDivisor == 0)
|
||||
return divisor;
|
||||
|
@ -383,7 +383,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
{
|
||||
CurrentNumber.BindTo(this.beatDivisor = beatDivisor);
|
||||
|
||||
Padding = new MarginPadding { Horizontal = 5 };
|
||||
RangePadding = 5;
|
||||
Padding = new MarginPadding { Horizontal = RangePadding };
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -398,15 +399,20 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
ClearInternal();
|
||||
CurrentNumber.ValueChanged -= moveMarker;
|
||||
|
||||
foreach (int divisor in beatDivisor.ValidDivisors.Value.Presets)
|
||||
int largestDivisor = beatDivisor.ValidDivisors.Value.Presets.Last();
|
||||
|
||||
for (int tickIndex = 0; tickIndex <= largestDivisor; tickIndex++)
|
||||
{
|
||||
AddInternal(new Tick(divisor)
|
||||
int divisor = BindableBeatDivisor.GetDivisorForBeatIndex(tickIndex, largestDivisor, (int[])beatDivisor.ValidDivisors.Value.Presets);
|
||||
bool isSolidTick = divisor * (largestDivisor - tickIndex) == largestDivisor;
|
||||
|
||||
AddInternal(new Tick(divisor, isSolidTick)
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.Centre,
|
||||
RelativePositionAxes = Axes.Both,
|
||||
Colour = BindableBeatDivisor.GetColourFor(divisor, colours),
|
||||
X = getMappedPosition(divisor),
|
||||
X = tickIndex / (float)largestDivisor,
|
||||
});
|
||||
}
|
||||
|
||||
@ -418,6 +424,11 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
private void moveMarker(ValueChangedEvent<int> divisor)
|
||||
{
|
||||
marker.MoveToX(getMappedPosition(divisor.NewValue), 100, Easing.OutQuint);
|
||||
|
||||
foreach (Tick tick in InternalChildren.OfType<Tick>().Where(t => !t.AlwaysDisplayed))
|
||||
{
|
||||
tick.FadeTo(divisor.NewValue % tick.Divisor == 0 ? 0.2f : 0f, 100, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void UpdateValue(float value)
|
||||
@ -483,13 +494,22 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
OnUserChange(Current.Value);
|
||||
}
|
||||
|
||||
private float getMappedPosition(float divisor) => MathF.Pow((divisor - 1) / (beatDivisor.ValidDivisors.Value.Presets.Last() - 1), 0.90f);
|
||||
private float getMappedPosition(float divisor) => 1 - 1 / divisor;
|
||||
|
||||
private partial class Tick : Circle
|
||||
{
|
||||
public Tick(int divisor)
|
||||
public readonly bool AlwaysDisplayed;
|
||||
|
||||
public readonly int Divisor;
|
||||
|
||||
public Tick(int divisor, bool alwaysDisplayed)
|
||||
{
|
||||
AlwaysDisplayed = alwaysDisplayed;
|
||||
Divisor = divisor;
|
||||
|
||||
Size = new Vector2(6f, 12) * BindableBeatDivisor.GetSize(divisor);
|
||||
Alpha = alwaysDisplayed ? 1 : 0;
|
||||
|
||||
InternalChild = new Box { RelativeSizeAxes = Axes.Both };
|
||||
}
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ using osu.Framework.Input;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
@ -26,7 +27,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
/// A container which provides a "blueprint" display of items.
|
||||
/// Includes selection and manipulation support via a <see cref="Components.SelectionHandler{T}"/>.
|
||||
/// </summary>
|
||||
public abstract partial class BlueprintContainer<T> : CompositeDrawable, IKeyBindingHandler<PlatformAction>
|
||||
public abstract partial class BlueprintContainer<T> : CompositeDrawable, IKeyBindingHandler<PlatformAction>, IKeyBindingHandler<GlobalAction>
|
||||
where T : class
|
||||
{
|
||||
protected DragBox DragBox { get; private set; }
|
||||
@ -91,7 +92,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
};
|
||||
|
||||
SelectionHandler = CreateSelectionHandler();
|
||||
SelectionHandler.DeselectAll = DeselectAll;
|
||||
SelectionHandler.SelectedItems.BindTo(SelectedItems);
|
||||
|
||||
AddRangeInternal(new[]
|
||||
@ -279,6 +279,30 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
{
|
||||
}
|
||||
|
||||
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||
{
|
||||
if (e.Repeat)
|
||||
return false;
|
||||
|
||||
switch (e.Action)
|
||||
{
|
||||
case GlobalAction.Back:
|
||||
if (SelectedItems.Count > 0)
|
||||
{
|
||||
DeselectAll();
|
||||
return true;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
|
||||
{
|
||||
}
|
||||
|
||||
#region Blueprint Addition/Removal
|
||||
|
||||
protected virtual void AddBlueprintFor(T item)
|
||||
|
@ -14,6 +14,8 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Edit.Tools;
|
||||
@ -56,7 +58,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
TernaryStates = CreateTernaryButtons().ToArray();
|
||||
MainTernaryStates = CreateTernaryButtons().ToArray();
|
||||
SampleBankTernaryStates = createSampleBankTernaryButtons().ToArray();
|
||||
|
||||
AddInternal(new DrawableRulesetDependenciesProvidingContainer(Composer.Ruleset)
|
||||
{
|
||||
@ -78,9 +81,10 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
|
||||
// we own SelectionHandler so don't need to worry about making bindable copies (for simplicity)
|
||||
foreach (var kvp in SelectionHandler.SelectionSampleStates)
|
||||
{
|
||||
kvp.Value.BindValueChanged(_ => updatePlacementSamples());
|
||||
}
|
||||
|
||||
foreach (var kvp in SelectionHandler.SelectionBankStates)
|
||||
kvp.Value.BindValueChanged(_ => updatePlacementSamples());
|
||||
}
|
||||
|
||||
protected override void TransferBlueprintFor(HitObject hitObject, DrawableHitObject drawableObject)
|
||||
@ -166,6 +170,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
|
||||
foreach (var kvp in SelectionHandler.SelectionSampleStates)
|
||||
sampleChanged(kvp.Key, kvp.Value.Value);
|
||||
|
||||
foreach (var kvp in SelectionHandler.SelectionBankStates)
|
||||
bankChanged(kvp.Key, kvp.Value.Value);
|
||||
}
|
||||
|
||||
private void sampleChanged(string sampleName, TernaryState state)
|
||||
@ -185,17 +192,29 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
|
||||
case TernaryState.True:
|
||||
if (existingSample == null)
|
||||
samples.Add(new HitSampleInfo(sampleName));
|
||||
samples.Add(CurrentPlacement.HitObject.CreateHitSampleInfo(sampleName));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void bankChanged(string bankName, TernaryState state)
|
||||
{
|
||||
if (CurrentPlacement == null) return;
|
||||
|
||||
if (bankName == EditorSelectionHandler.HIT_BANK_AUTO)
|
||||
CurrentPlacement.AutomaticBankAssignment = state == TernaryState.True;
|
||||
else if (state == TernaryState.True)
|
||||
CurrentPlacement.HitObject.Samples = CurrentPlacement.HitObject.Samples.Select(s => s.With(newBank: bankName)).ToList();
|
||||
}
|
||||
|
||||
public readonly Bindable<TernaryState> NewCombo = new Bindable<TernaryState> { Description = "New Combo" };
|
||||
|
||||
/// <summary>
|
||||
/// A collection of states which will be displayed to the user in the toolbox.
|
||||
/// </summary>
|
||||
public TernaryButton[] TernaryStates { get; private set; }
|
||||
public TernaryButton[] MainTernaryStates { get; private set; }
|
||||
|
||||
public TernaryButton[] SampleBankTernaryStates { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Create all ternary states required to be displayed to the user.
|
||||
@ -209,6 +228,39 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
yield return new TernaryButton(kvp.Value, kvp.Key.Replace("hit", string.Empty).Titleize(), () => GetIconForSample(kvp.Key));
|
||||
}
|
||||
|
||||
private IEnumerable<TernaryButton> createSampleBankTernaryButtons()
|
||||
{
|
||||
foreach (var kvp in SelectionHandler.SelectionBankStates)
|
||||
yield return new TernaryButton(kvp.Value, kvp.Key.Titleize(), () => getIconForBank(kvp.Key));
|
||||
}
|
||||
|
||||
private Drawable getIconForBank(string sampleName)
|
||||
{
|
||||
return new Container
|
||||
{
|
||||
Size = new Vector2(30, 20),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteIcon
|
||||
{
|
||||
Size = new Vector2(8),
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Icon = FontAwesome.Solid.VolumeOff
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
X = 10,
|
||||
Y = -1,
|
||||
Font = OsuFont.Default.With(weight: FontWeight.Bold, size: 20),
|
||||
Text = $"{char.ToUpperInvariant(sampleName.First())}"
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static Drawable GetIconForSample(string sampleName)
|
||||
{
|
||||
switch (sampleName)
|
||||
@ -317,12 +369,16 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
}
|
||||
}
|
||||
|
||||
private void commitIfPlacementActive()
|
||||
{
|
||||
CurrentPlacement?.EndPlacement(CurrentPlacement.PlacementActive == PlacementBlueprint.PlacementState.Active);
|
||||
removePlacement();
|
||||
}
|
||||
|
||||
private void removePlacement()
|
||||
{
|
||||
if (CurrentPlacement == null) return;
|
||||
|
||||
CurrentPlacement.EndPlacement(false);
|
||||
CurrentPlacement.Expire();
|
||||
CurrentPlacement?.EndPlacement(false);
|
||||
CurrentPlacement?.Expire();
|
||||
CurrentPlacement = null;
|
||||
}
|
||||
|
||||
@ -342,7 +398,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
|
||||
currentTool = value;
|
||||
|
||||
refreshTool();
|
||||
// As per stable editor, when changing tools, we should forcefully commit any pending placement.
|
||||
commitIfPlacementActive();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets.Edit;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
@ -20,6 +21,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
{
|
||||
public partial class EditorSelectionHandler : SelectionHandler<HitObject>
|
||||
{
|
||||
/// <summary>
|
||||
/// A special bank name that is only used in the editor UI.
|
||||
/// When selected and in placement mode, the bank of the last hit object will always be used.
|
||||
/// </summary>
|
||||
public const string HIT_BANK_AUTO = "auto";
|
||||
|
||||
[Resolved]
|
||||
protected EditorBeatmap EditorBeatmap { get; private set; }
|
||||
|
||||
@ -48,11 +55,83 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
/// </summary>
|
||||
public readonly Dictionary<string, Bindable<TernaryState>> SelectionSampleStates = new Dictionary<string, Bindable<TernaryState>>();
|
||||
|
||||
/// <summary>
|
||||
/// The state of each sample bank type for all selected hitobjects.
|
||||
/// </summary>
|
||||
public readonly Dictionary<string, Bindable<TernaryState>> SelectionBankStates = new Dictionary<string, Bindable<TernaryState>>();
|
||||
|
||||
/// <summary>
|
||||
/// Set up ternary state bindables and bind them to selection/hitobject changes (in both directions)
|
||||
/// </summary>
|
||||
private void createStateBindables()
|
||||
{
|
||||
foreach (string bankName in HitSampleInfo.AllBanks.Prepend(HIT_BANK_AUTO))
|
||||
{
|
||||
var bindable = new Bindable<TernaryState>
|
||||
{
|
||||
Description = bankName.Titleize()
|
||||
};
|
||||
|
||||
bindable.ValueChanged += state =>
|
||||
{
|
||||
switch (state.NewValue)
|
||||
{
|
||||
case TernaryState.False:
|
||||
if (SelectedItems.Count == 0)
|
||||
{
|
||||
// Ensure that if this is the last selected bank, it should remain selected.
|
||||
if (SelectionBankStates.Values.All(b => b.Value == TernaryState.False))
|
||||
bindable.Value = TernaryState.True;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Auto should never apply when there is a selection made.
|
||||
// This is also required to stop a bindable feedback loop when a HitObject has zero samples (and LINQ `All` below becomes true).
|
||||
if (bankName == HIT_BANK_AUTO)
|
||||
break;
|
||||
|
||||
// Never remove a sample bank.
|
||||
// These are basically radio buttons, not toggles.
|
||||
if (SelectedItems.All(h => h.Samples.All(s => s.Bank == bankName)))
|
||||
bindable.Value = TernaryState.True;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case TernaryState.True:
|
||||
if (SelectedItems.Count == 0)
|
||||
{
|
||||
// Ensure the user can't stack multiple bank selections when there's no hitobject selection.
|
||||
// Note that in normal scenarios this is sorted out by the feedback from applying the bank to the selected objects.
|
||||
foreach (var other in SelectionBankStates.Values)
|
||||
{
|
||||
if (other != bindable)
|
||||
other.Value = TernaryState.False;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Auto should just not apply if there's a selection already made.
|
||||
// Maybe we could make it a disabled button in the future, but right now the editor buttons don't support disabled state.
|
||||
if (bankName == HIT_BANK_AUTO)
|
||||
{
|
||||
bindable.Value = TernaryState.False;
|
||||
break;
|
||||
}
|
||||
|
||||
AddSampleBank(bankName);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
SelectionBankStates[bankName] = bindable;
|
||||
}
|
||||
|
||||
// start with normal selected.
|
||||
SelectionBankStates[SampleControlPoint.DEFAULT_BANK].Value = TernaryState.True;
|
||||
|
||||
foreach (string sampleName in HitSampleInfo.AllAdditions)
|
||||
{
|
||||
var bindable = new Bindable<TernaryState>
|
||||
@ -104,12 +183,33 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
{
|
||||
bindable.Value = GetStateFromSelection(SelectedItems, h => h.Samples.Any(s => s.Name == sampleName));
|
||||
}
|
||||
|
||||
foreach ((string bankName, var bindable) in SelectionBankStates)
|
||||
{
|
||||
bindable.Value = GetStateFromSelection(SelectedItems, h => h.Samples.All(s => s.Bank == bankName));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Ternary state changes
|
||||
|
||||
/// <summary>
|
||||
/// Adds a sample bank to all selected <see cref="HitObject"/>s.
|
||||
/// </summary>
|
||||
/// <param name="bankName">The name of the sample bank.</param>
|
||||
public void AddSampleBank(string bankName)
|
||||
{
|
||||
EditorBeatmap.PerformOnSelection(h =>
|
||||
{
|
||||
if (h.Samples.All(s => s.Bank == bankName))
|
||||
return;
|
||||
|
||||
h.Samples = h.Samples.Select(s => s.With(newBank: bankName)).ToList();
|
||||
EditorBeatmap.Update(h);
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds a hit sample to all selected <see cref="HitObject"/>s.
|
||||
/// </summary>
|
||||
@ -122,8 +222,12 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
if (h.Samples.Any(s => s.Name == sampleName))
|
||||
return;
|
||||
|
||||
var relevantSample = h.Samples.FirstOrDefault(s => s.Name != HitSampleInfo.HIT_NORMAL);
|
||||
h.Samples.Add(relevantSample?.With(sampleName) ?? h.GetSampleInfo(sampleName));
|
||||
var existingNonNormalSample = h.Samples.FirstOrDefault(s => s.Name != HitSampleInfo.HIT_NORMAL);
|
||||
|
||||
var sampleToAdd = h.CreateHitSampleInfo(sampleName);
|
||||
|
||||
h.Samples.Add(existingNonNormalSample?.With(sampleName) ?? h.GetSampleInfo(sampleName));
|
||||
h.Samples.Add(h.CreateHitSampleInfo(sampleName));
|
||||
EditorBeatmap.Update(h);
|
||||
});
|
||||
}
|
||||
@ -175,11 +279,17 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
yield return new TernaryStateToggleMenuItem("New combo") { State = { BindTarget = SelectionNewComboState } };
|
||||
}
|
||||
|
||||
yield return new OsuMenuItem("Sound")
|
||||
yield return new OsuMenuItem("Sample")
|
||||
{
|
||||
Items = SelectionSampleStates.Select(kvp =>
|
||||
new TernaryStateToggleMenuItem(kvp.Value.Description) { State = { BindTarget = kvp.Value } }).ToArray()
|
||||
};
|
||||
|
||||
yield return new OsuMenuItem("Bank")
|
||||
{
|
||||
Items = SelectionBankStates.Select(kvp =>
|
||||
new TernaryStateToggleMenuItem(kvp.Value.Description) { State = { BindTarget = kvp.Value } }).ToArray()
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -73,7 +73,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
if (selected is IHasSliderVelocity sliderVelocity)
|
||||
{
|
||||
AddHeader("Slider Velocity");
|
||||
AddValue($"{sliderVelocity.SliderVelocity:#,0.00}x");
|
||||
AddValue($"{sliderVelocity.SliderVelocity:#,0.00}x ({sliderVelocity.SliderVelocity * EditorBeatmap.Difficulty.SliderMultiplier:#,0.00}x)");
|
||||
}
|
||||
|
||||
if (selected is IHasRepeats repeats)
|
||||
|
@ -22,6 +22,8 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
{
|
||||
public const float BORDER_RADIUS = 3;
|
||||
|
||||
private const float button_padding = 5;
|
||||
|
||||
public Func<float, bool> OnRotation;
|
||||
public Func<Vector2, Anchor, bool> OnScale;
|
||||
public Func<Direction, bool, bool> OnFlip;
|
||||
@ -182,6 +184,13 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
return base.OnKeyDown(e);
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
ensureButtonsOnScreen();
|
||||
}
|
||||
|
||||
private void recreate()
|
||||
{
|
||||
if (LoadState < LoadState.Loading)
|
||||
@ -234,11 +243,10 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
},
|
||||
buttons = new FillFlowContainer
|
||||
{
|
||||
Y = 20,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
AutoSizeAxes = Axes.X,
|
||||
Height = 30,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.Centre
|
||||
Margin = new MarginPadding(button_padding),
|
||||
}
|
||||
};
|
||||
|
||||
@ -352,5 +360,39 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
if (activeOperations++ == 0)
|
||||
OperationStarted?.Invoke();
|
||||
}
|
||||
|
||||
private void ensureButtonsOnScreen()
|
||||
{
|
||||
buttons.Position = Vector2.Zero;
|
||||
|
||||
var thisQuad = ScreenSpaceDrawQuad;
|
||||
|
||||
// Shrink the parent quad to give a bit of padding so the buttons don't stick *right* on the border.
|
||||
// AABBFloat assumes no rotation. one would hope the whole editor is not being rotated.
|
||||
var parentQuad = Parent.ScreenSpaceDrawQuad.AABBFloat.Shrink(ToLocalSpace(thisQuad.TopLeft + new Vector2(button_padding * 2)));
|
||||
|
||||
float topExcess = thisQuad.TopLeft.Y - parentQuad.TopLeft.Y;
|
||||
float bottomExcess = parentQuad.BottomLeft.Y - thisQuad.BottomLeft.Y;
|
||||
float leftExcess = thisQuad.TopLeft.X - parentQuad.TopLeft.X;
|
||||
float rightExcess = parentQuad.TopRight.X - thisQuad.TopRight.X;
|
||||
|
||||
if (topExcess + bottomExcess < buttons.Height + button_padding)
|
||||
{
|
||||
buttons.Anchor = Anchor.BottomCentre;
|
||||
buttons.Origin = Anchor.BottomCentre;
|
||||
}
|
||||
else if (topExcess > bottomExcess)
|
||||
{
|
||||
buttons.Anchor = Anchor.TopCentre;
|
||||
buttons.Origin = Anchor.BottomCentre;
|
||||
}
|
||||
else
|
||||
{
|
||||
buttons.Anchor = Anchor.BottomCentre;
|
||||
buttons.Origin = Anchor.TopCentre;
|
||||
}
|
||||
|
||||
buttons.X += ToLocalSpace(thisQuad.TopLeft - new Vector2(Math.Min(0, leftExcess)) + new Vector2(Math.Min(0, rightExcess))).X;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -197,9 +197,9 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
#region Selection Handling
|
||||
|
||||
/// <summary>
|
||||
/// Bind an action to deselect all selected blueprints.
|
||||
/// Deselect all selected items.
|
||||
/// </summary>
|
||||
internal Action DeselectAll { private get; set; }
|
||||
protected void DeselectAll() => SelectedItems.Clear();
|
||||
|
||||
/// <summary>
|
||||
/// Handle a blueprint becoming selected.
|
||||
@ -303,7 +303,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
if (blueprint.IsSelected)
|
||||
return false;
|
||||
|
||||
DeselectAll?.Invoke();
|
||||
DeselectAll();
|
||||
blueprint.Select();
|
||||
return true;
|
||||
}
|
||||
@ -311,6 +311,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
protected void DeleteSelected()
|
||||
{
|
||||
DeleteItems(SelectedItems.ToArray());
|
||||
DeselectAll();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user