mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 03:25:11 +08:00
Merge branch 'master' into flag-markdown
This commit is contained in:
commit
3d58df2b61
@ -51,7 +51,7 @@
|
||||
<Reference Include="Java.Interop" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.1005.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.1008.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.1011.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Transitive Dependencies">
|
||||
|
@ -3,9 +3,11 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Tests.Visual;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Tests
|
||||
@ -37,7 +39,7 @@ namespace osu.Game.Rulesets.Mania.Tests
|
||||
{
|
||||
}
|
||||
|
||||
protected override void ReloadMappings()
|
||||
protected override void ReloadMappings(IQueryable<RealmKeyBinding> realmKeyBindings)
|
||||
{
|
||||
KeyBindings = DefaultKeyBindings;
|
||||
}
|
||||
|
@ -148,6 +148,37 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
||||
});
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestFloatEdgeCaseConversion()
|
||||
{
|
||||
Slider slider = null;
|
||||
|
||||
AddStep("select first slider", () =>
|
||||
{
|
||||
slider = (Slider)EditorBeatmap.HitObjects.First(h => h is Slider);
|
||||
EditorClock.Seek(slider.StartTime);
|
||||
EditorBeatmap.SelectedHitObjects.Add(slider);
|
||||
});
|
||||
|
||||
AddStep("change to these specific circumstances", () =>
|
||||
{
|
||||
EditorBeatmap.Difficulty.SliderMultiplier = 1;
|
||||
var timingPoint = EditorBeatmap.ControlPointInfo.TimingPointAt(slider.StartTime);
|
||||
timingPoint.BeatLength = 352.941176470588;
|
||||
slider.Path.ControlPoints[^1].Position = new Vector2(-110, 16);
|
||||
slider.Path.ExpectedDistance.Value = 100;
|
||||
});
|
||||
|
||||
convertToStream();
|
||||
|
||||
AddAssert("stream created", () => streamCreatedFor(slider,
|
||||
(time: 0, pathPosition: 0),
|
||||
(time: 0.25, pathPosition: 0.25),
|
||||
(time: 0.5, pathPosition: 0.5),
|
||||
(time: 0.75, pathPosition: 0.75),
|
||||
(time: 1, pathPosition: 1)));
|
||||
}
|
||||
|
||||
private bool streamCreatedFor(Slider slider, params (double time, double pathPosition)[] expectedCircles)
|
||||
{
|
||||
if (EditorBeatmap.HitObjects.Contains(slider))
|
||||
|
@ -342,7 +342,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders
|
||||
double positionWithRepeats = (time - HitObject.StartTime) / HitObject.Duration * HitObject.SpanCount();
|
||||
double pathPosition = positionWithRepeats - (int)positionWithRepeats;
|
||||
// every second span is in the reverse direction - need to reverse the path position.
|
||||
if (Precision.AlmostBigger(positionWithRepeats % 2, 1))
|
||||
if (positionWithRepeats % 2 >= 1)
|
||||
pathPosition = 1 - pathPosition;
|
||||
|
||||
Vector2 position = HitObject.Position + HitObject.Path.PositionAt(pathPosition);
|
||||
|
@ -20,7 +20,9 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
public class OsuModRelax : ModRelax, IUpdatableByPlayfield, IApplicableToDrawableRuleset<OsuHitObject>, IApplicableToPlayer
|
||||
{
|
||||
public override LocalisableString Description => @"You don't need to click. Give your clicking/tapping fingers a break from the heat of things.";
|
||||
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot), typeof(OsuModMagnetised), typeof(OsuModAlternate), typeof(OsuModSingleTap) }).ToArray();
|
||||
|
||||
public override Type[] IncompatibleMods =>
|
||||
base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot), typeof(OsuModMagnetised), typeof(OsuModAlternate), typeof(OsuModSingleTap) }).ToArray();
|
||||
|
||||
/// <summary>
|
||||
/// How early before a hitobject's start time to trigger a hit.
|
||||
@ -51,7 +53,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
return;
|
||||
}
|
||||
|
||||
osuInputManager.AllowUserPresses = false;
|
||||
osuInputManager.AllowGameplayInputs = false;
|
||||
}
|
||||
|
||||
public void Update(Playfield playfield)
|
||||
|
@ -5,10 +5,12 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Input.StateChanges.Events;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Rulesets.UI;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu
|
||||
@ -17,9 +19,16 @@ namespace osu.Game.Rulesets.Osu
|
||||
{
|
||||
public IEnumerable<OsuAction> PressedActions => KeyBindingContainer.PressedActions;
|
||||
|
||||
public bool AllowUserPresses
|
||||
/// <summary>
|
||||
/// Whether gameplay input buttons should be allowed.
|
||||
/// Defaults to <c>true</c>, generally used for mods like Relax which turn off main inputs.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Of note, auxiliary inputs like the "smoke" key are left usable.
|
||||
/// </remarks>
|
||||
public bool AllowGameplayInputs
|
||||
{
|
||||
set => ((OsuKeyBindingContainer)KeyBindingContainer).AllowUserPresses = value;
|
||||
set => ((OsuKeyBindingContainer)KeyBindingContainer).AllowGameplayInputs = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -58,18 +67,36 @@ namespace osu.Game.Rulesets.Osu
|
||||
|
||||
private class OsuKeyBindingContainer : RulesetKeyBindingContainer
|
||||
{
|
||||
public bool AllowUserPresses = true;
|
||||
private bool allowGameplayInputs = true;
|
||||
|
||||
/// <summary>
|
||||
/// Whether gameplay input buttons should be allowed.
|
||||
/// Defaults to <c>true</c>, generally used for mods like Relax which turn off main inputs.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Of note, auxiliary inputs like the "smoke" key are left usable.
|
||||
/// </remarks>
|
||||
public bool AllowGameplayInputs
|
||||
{
|
||||
get => allowGameplayInputs;
|
||||
set
|
||||
{
|
||||
allowGameplayInputs = value;
|
||||
ReloadMappings();
|
||||
}
|
||||
}
|
||||
|
||||
public OsuKeyBindingContainer(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
|
||||
: base(ruleset, variant, unique)
|
||||
{
|
||||
}
|
||||
|
||||
protected override bool Handle(UIEvent e)
|
||||
protected override void ReloadMappings(IQueryable<RealmKeyBinding> realmKeyBindings)
|
||||
{
|
||||
if (!AllowUserPresses) return false;
|
||||
base.ReloadMappings(realmKeyBindings);
|
||||
|
||||
return base.Handle(e);
|
||||
if (!AllowGameplayInputs)
|
||||
KeyBindings = KeyBindings.Where(b => b.GetAction<OsuAction>() == OsuAction.Smoke).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -55,13 +55,13 @@ namespace osu.Game.Input.Bindings
|
||||
{
|
||||
// The first fire of this is a bit redundant as this is being called in base.LoadComplete,
|
||||
// but this is safest in case the subscription is restored after a context recycle.
|
||||
reloadMappings(sender.AsQueryable());
|
||||
ReloadMappings(sender.AsQueryable());
|
||||
});
|
||||
|
||||
base.LoadComplete();
|
||||
}
|
||||
|
||||
protected override void ReloadMappings() => reloadMappings(queryRealmKeyBindings(realm.Realm));
|
||||
protected sealed override void ReloadMappings() => ReloadMappings(queryRealmKeyBindings(realm.Realm));
|
||||
|
||||
private IQueryable<RealmKeyBinding> queryRealmKeyBindings(Realm realm)
|
||||
{
|
||||
@ -70,7 +70,7 @@ namespace osu.Game.Input.Bindings
|
||||
.Where(b => b.RulesetName == rulesetName && b.Variant == variant);
|
||||
}
|
||||
|
||||
private void reloadMappings(IQueryable<RealmKeyBinding> realmKeyBindings)
|
||||
protected virtual void ReloadMappings(IQueryable<RealmKeyBinding> realmKeyBindings)
|
||||
{
|
||||
var defaults = DefaultKeyBindings.ToList();
|
||||
|
||||
|
@ -230,9 +230,9 @@ namespace osu.Game.Rulesets.UI
|
||||
{
|
||||
}
|
||||
|
||||
protected override void ReloadMappings()
|
||||
protected override void ReloadMappings(IQueryable<RealmKeyBinding> realmKeyBindings)
|
||||
{
|
||||
base.ReloadMappings();
|
||||
base.ReloadMappings(realmKeyBindings);
|
||||
|
||||
KeyBindings = KeyBindings.Where(b => RealmKeyBindingStore.CheckValidForGameplay(b.KeyCombination)).ToList();
|
||||
}
|
||||
|
@ -1,18 +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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace osu.Game.Skinning
|
||||
{
|
||||
public enum HUDSkinComponents
|
||||
{
|
||||
ComboCounter,
|
||||
ScoreCounter,
|
||||
AccuracyCounter,
|
||||
HealthDisplay,
|
||||
SongProgress,
|
||||
BarHitErrorMeter,
|
||||
ColourHitErrorMeter,
|
||||
}
|
||||
}
|
@ -36,7 +36,7 @@
|
||||
</PackageReference>
|
||||
<PackageReference Include="Realm" Version="10.17.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2022.1011.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.1005.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.1008.0" />
|
||||
<PackageReference Include="Sentry" Version="3.22.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.32.2" />
|
||||
<PackageReference Include="NUnit" Version="3.13.3" />
|
||||
|
@ -61,7 +61,7 @@
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.1005.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.1008.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2022.1011.0" />
|
||||
</ItemGroup>
|
||||
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net6.0) -->
|
||||
|
Loading…
Reference in New Issue
Block a user