mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 04:32:57 +08:00
Merge branch 'master' into daily-challenge-mvp
This commit is contained in:
commit
6c37560842
@ -2,7 +2,6 @@
|
||||
<Project>
|
||||
<PropertyGroup Label="C#">
|
||||
<LangVersion>12.0</LangVersion>
|
||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
|
@ -10,7 +10,7 @@
|
||||
<EmbedAssembliesIntoApk>true</EmbedAssembliesIntoApk>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2024.509.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2024.523.0" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup>
|
||||
<!-- Fody does not handle Android build well, and warns when unchanged.
|
||||
|
@ -273,7 +273,11 @@ namespace osu.Desktop
|
||||
|
||||
private static string clampLength(string str)
|
||||
{
|
||||
// For whatever reason, discord decides that strings shorter than 2 characters cannot possibly be valid input, because... reasons?
|
||||
// Empty strings are fine to discord even though single-character strings are not. Make it make sense.
|
||||
if (string.IsNullOrEmpty(str))
|
||||
return str;
|
||||
|
||||
// As above, discord decides that *non-empty* strings shorter than 2 characters cannot possibly be valid input, because... reasons?
|
||||
// And yes, that is two *characters*, or *codepoints*, not *bytes* as further down below (as determined by empirical testing).
|
||||
// That seems very questionable, and isn't even documented anywhere. So to *make it* accept such valid input,
|
||||
// just tack on enough of U+200B ZERO WIDTH SPACEs at the end.
|
||||
|
@ -36,11 +36,12 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators
|
||||
while (rhythmStart < historicalNoteCount - 2 && current.StartTime - current.Previous(rhythmStart).StartTime < history_time_max)
|
||||
rhythmStart++;
|
||||
|
||||
OsuDifficultyHitObject prevObj = (OsuDifficultyHitObject)current.Previous(rhythmStart);
|
||||
OsuDifficultyHitObject lastObj = (OsuDifficultyHitObject)current.Previous(rhythmStart + 1);
|
||||
|
||||
for (int i = rhythmStart; i > 0; i--)
|
||||
{
|
||||
OsuDifficultyHitObject currObj = (OsuDifficultyHitObject)current.Previous(i - 1);
|
||||
OsuDifficultyHitObject prevObj = (OsuDifficultyHitObject)current.Previous(i);
|
||||
OsuDifficultyHitObject lastObj = (OsuDifficultyHitObject)current.Previous(i + 1);
|
||||
|
||||
double currHistoricalDecay = (history_time_max - (current.StartTime - currObj.StartTime)) / history_time_max; // scales note 0 to 1 from history to now
|
||||
|
||||
@ -66,10 +67,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators
|
||||
}
|
||||
else
|
||||
{
|
||||
if (current.Previous(i - 1).BaseObject is Slider) // bpm change is into slider, this is easy acc window
|
||||
if (currObj.BaseObject is Slider) // bpm change is into slider, this is easy acc window
|
||||
effectiveRatio *= 0.125;
|
||||
|
||||
if (current.Previous(i).BaseObject is Slider) // bpm change was from a slider, this is easier typically than circle -> circle
|
||||
if (prevObj.BaseObject is Slider) // bpm change was from a slider, this is easier typically than circle -> circle
|
||||
effectiveRatio *= 0.25;
|
||||
|
||||
if (previousIslandSize == islandSize) // repeated island size (ex: triplet -> triplet)
|
||||
@ -100,6 +101,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Evaluators
|
||||
startRatio = effectiveRatio;
|
||||
islandSize = 1;
|
||||
}
|
||||
|
||||
lastObj = prevObj;
|
||||
prevObj = currObj;
|
||||
}
|
||||
|
||||
return Math.Sqrt(4 + rhythmComplexitySum * rhythm_multiplier) / 2; //produces multiplier that can be applied to strain. range [1, infinity) (not really though)
|
||||
|
@ -8,9 +8,9 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Graphics;
|
||||
@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
public readonly PathControlPoint ControlPoint;
|
||||
|
||||
private readonly T hitObject;
|
||||
private readonly Container marker;
|
||||
private readonly Circle circle;
|
||||
private readonly Drawable markerRing;
|
||||
|
||||
[Resolved]
|
||||
@ -60,38 +60,22 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
Origin = Anchor.Centre;
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
InternalChildren = new[]
|
||||
{
|
||||
marker = new Container
|
||||
circle = new Circle
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new[]
|
||||
{
|
||||
new Circle
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(20),
|
||||
},
|
||||
markerRing = new CircularContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(28),
|
||||
Masking = true,
|
||||
BorderThickness = 2,
|
||||
BorderColour = Color4.White,
|
||||
Alpha = 0,
|
||||
Child = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0,
|
||||
AlwaysPresent = true
|
||||
}
|
||||
}
|
||||
}
|
||||
Size = new Vector2(20),
|
||||
},
|
||||
markerRing = new CircularProgress
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Size = new Vector2(28),
|
||||
Alpha = 0,
|
||||
InnerRadius = 0.1f,
|
||||
Progress = 1
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -115,7 +99,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
}
|
||||
|
||||
// The connecting path is excluded from positional input
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => marker.ReceivePositionalInputAt(screenSpacePos);
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => circle.ReceivePositionalInputAt(screenSpacePos);
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
@ -209,8 +193,8 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
if (IsHovered || IsSelected.Value)
|
||||
colour = colour.Lighten(1);
|
||||
|
||||
marker.Colour = colour;
|
||||
marker.Scale = new Vector2(hitObject.Scale);
|
||||
Colour = colour;
|
||||
Scale = new Vector2(hitObject.Scale);
|
||||
}
|
||||
|
||||
private Color4 getColourFromNodeType()
|
||||
|
@ -1188,5 +1188,36 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
Assert.That(beatmap.HitObjects[0].GetEndTime(), Is.EqualTo(3153));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestBeatmapDifficultyIsClamped()
|
||||
{
|
||||
var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
|
||||
|
||||
using (var resStream = TestResources.OpenResource("out-of-range-difficulties.osu"))
|
||||
using (var stream = new LineBufferedReader(resStream))
|
||||
{
|
||||
var decoded = decoder.Decode(stream).Difficulty;
|
||||
Assert.That(decoded.DrainRate, Is.EqualTo(10));
|
||||
Assert.That(decoded.CircleSize, Is.EqualTo(10));
|
||||
Assert.That(decoded.OverallDifficulty, Is.EqualTo(10));
|
||||
Assert.That(decoded.ApproachRate, Is.EqualTo(10));
|
||||
Assert.That(decoded.SliderMultiplier, Is.EqualTo(3.6));
|
||||
Assert.That(decoded.SliderTickRate, Is.EqualTo(8));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestManiaBeatmapDifficultyCircleSizeClamp()
|
||||
{
|
||||
var decoder = new LegacyBeatmapDecoder { ApplyOffsets = false };
|
||||
|
||||
using (var resStream = TestResources.OpenResource("out-of-range-difficulties-mania.osu"))
|
||||
using (var stream = new LineBufferedReader(resStream))
|
||||
{
|
||||
var decoded = decoder.Decode(stream).Difficulty;
|
||||
Assert.That(decoded.CircleSize, Is.EqualTo(14));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,5 @@
|
||||
[General]
|
||||
Mode: 3
|
||||
|
||||
[Difficulty]
|
||||
CircleSize:14
|
10
osu.Game.Tests/Resources/out-of-range-difficulties.osu
Normal file
10
osu.Game.Tests/Resources/out-of-range-difficulties.osu
Normal file
@ -0,0 +1,10 @@
|
||||
[General]
|
||||
Mode: 0
|
||||
|
||||
[Difficulty]
|
||||
HPDrainRate:25
|
||||
CircleSize:25
|
||||
OverallDifficulty:25
|
||||
ApproachRate:30
|
||||
SliderMultiplier:30
|
||||
SliderTickRate:30
|
@ -5,6 +5,7 @@ using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Humanizer;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps;
|
||||
@ -396,7 +397,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
textBox.Current.Value = bank;
|
||||
// force a commit via keyboard.
|
||||
// this is needed when testing attempting to set empty bank - which should revert to the previous value, but only on commit.
|
||||
InputManager.ChangeFocus(textBox);
|
||||
((IFocusManager)InputManager).ChangeFocus(textBox);
|
||||
InputManager.Key(Key.Enter);
|
||||
});
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Beatmaps.Timing;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
@ -62,12 +63,12 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
createLabelledTimeSignature(TimeSignature.SimpleQuadruple);
|
||||
AddAssert("current is 4/4", () => timeSignature.Current.Value.Equals(TimeSignature.SimpleQuadruple));
|
||||
|
||||
AddStep("focus text box", () => InputManager.ChangeFocus(numeratorTextBox));
|
||||
AddStep("focus text box", () => ((IFocusManager)InputManager).ChangeFocus(numeratorTextBox));
|
||||
|
||||
AddStep("set numerator to 7", () => numeratorTextBox.Current.Value = "7");
|
||||
AddAssert("current is 4/4", () => timeSignature.Current.Value.Equals(TimeSignature.SimpleQuadruple));
|
||||
|
||||
AddStep("drop focus", () => InputManager.ChangeFocus(null));
|
||||
AddStep("drop focus", () => ((IFocusManager)InputManager).ChangeFocus(null));
|
||||
AddAssert("current is 7/4", () => timeSignature.Current.Value.Equals(new TimeSignature(7)));
|
||||
}
|
||||
|
||||
@ -77,12 +78,12 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
createLabelledTimeSignature(TimeSignature.SimpleQuadruple);
|
||||
AddAssert("current is 4/4", () => timeSignature.Current.Value.Equals(TimeSignature.SimpleQuadruple));
|
||||
|
||||
AddStep("focus text box", () => InputManager.ChangeFocus(numeratorTextBox));
|
||||
AddStep("focus text box", () => ((IFocusManager)InputManager).ChangeFocus(numeratorTextBox));
|
||||
|
||||
AddStep("set numerator to 0", () => numeratorTextBox.Current.Value = "0");
|
||||
AddAssert("current is 4/4", () => timeSignature.Current.Value.Equals(TimeSignature.SimpleQuadruple));
|
||||
|
||||
AddStep("drop focus", () => InputManager.ChangeFocus(null));
|
||||
AddStep("drop focus", () => ((IFocusManager)InputManager).ChangeFocus(null));
|
||||
AddAssert("current is 4/4", () => timeSignature.Current.Value.Equals(TimeSignature.SimpleQuadruple));
|
||||
AddAssert("numerator is 4", () => numeratorTextBox.Current.Value == "4");
|
||||
}
|
||||
|
@ -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 NUnit.Framework;
|
||||
@ -26,7 +24,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
{
|
||||
public partial class TestScenePresentScore : OsuGameTestScene
|
||||
{
|
||||
private BeatmapSetInfo beatmap;
|
||||
private BeatmapSetInfo beatmap = null!;
|
||||
|
||||
[SetUpSteps]
|
||||
public new void SetUpSteps()
|
||||
@ -64,7 +62,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
Ruleset = new OsuRuleset().RulesetInfo
|
||||
},
|
||||
}
|
||||
})?.Value;
|
||||
})!.Value;
|
||||
});
|
||||
}
|
||||
|
||||
@ -158,6 +156,27 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
presentAndConfirm(secondImport, type);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestScoreRefetchIgnoresEmptyHash()
|
||||
{
|
||||
AddStep("enter song select", () => Game.ChildrenOfType<ButtonSystem>().Single().OnSolo?.Invoke());
|
||||
AddUntilStep("song select is current", () => Game.ScreenStack.CurrentScreen is PlaySongSelect songSelect && songSelect.BeatmapSetsLoaded);
|
||||
|
||||
importScore(-1, hash: string.Empty);
|
||||
importScore(3, hash: @"deadbeef");
|
||||
|
||||
// oftentimes a `PresentScore()` call will be given a `ScoreInfo` which is converted from an online score,
|
||||
// in which cases the hash will generally not be available.
|
||||
AddStep("present score", () => Game.PresentScore(new ScoreInfo { OnlineID = 3, Hash = string.Empty }));
|
||||
|
||||
AddUntilStep("wait for results", () => lastWaitedScreen != Game.ScreenStack.CurrentScreen && Game.ScreenStack.CurrentScreen is ResultsScreen);
|
||||
AddUntilStep("correct score displayed", () =>
|
||||
{
|
||||
var score = ((ResultsScreen)Game.ScreenStack.CurrentScreen).Score!;
|
||||
return score.OnlineID == 3 && score.Hash == "deadbeef";
|
||||
});
|
||||
}
|
||||
|
||||
private void returnToMenu()
|
||||
{
|
||||
// if we don't pause, there's a chance the track may change at the main menu out of our control (due to reaching the end of the track).
|
||||
@ -171,14 +190,14 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
AddUntilStep("wait for menu", () => Game.ScreenStack.CurrentScreen is MainMenu);
|
||||
}
|
||||
|
||||
private Func<ScoreInfo> importScore(int i, RulesetInfo ruleset = null)
|
||||
private Func<ScoreInfo> importScore(int i, RulesetInfo? ruleset = null, string? hash = null)
|
||||
{
|
||||
ScoreInfo imported = null;
|
||||
ScoreInfo? imported = null;
|
||||
AddStep($"import score {i}", () =>
|
||||
{
|
||||
imported = Game.ScoreManager.Import(new ScoreInfo
|
||||
{
|
||||
Hash = Guid.NewGuid().ToString(),
|
||||
Hash = hash ?? Guid.NewGuid().ToString(),
|
||||
OnlineID = i,
|
||||
BeatmapInfo = beatmap.Beatmaps.First(),
|
||||
Ruleset = ruleset ?? new OsuRuleset().RulesetInfo,
|
||||
@ -188,14 +207,14 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
|
||||
AddAssert($"import {i} succeeded", () => imported != null);
|
||||
|
||||
return () => imported;
|
||||
return () => imported!;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Some tests test waiting for a particular screen twice in a row, but expect a new instance each time.
|
||||
/// There's a case where they may succeed incorrectly if we don't compare against the previous instance.
|
||||
/// </summary>
|
||||
private IScreen lastWaitedScreen;
|
||||
private IScreen lastWaitedScreen = null!;
|
||||
|
||||
private void presentAndConfirm(Func<ScoreInfo> getImport, ScorePresentType type)
|
||||
{
|
||||
|
@ -10,6 +10,7 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Framework.Utils;
|
||||
@ -623,7 +624,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
AddStep("press tab", () => InputManager.Key(Key.Tab));
|
||||
AddAssert("search text box focused", () => modSelectOverlay.SearchTextBox.HasFocus);
|
||||
|
||||
AddStep("unfocus search text box externally", () => InputManager.ChangeFocus(null));
|
||||
AddStep("unfocus search text box externally", () => ((IFocusManager)InputManager).ChangeFocus(null));
|
||||
|
||||
AddStep("press tab", () => InputManager.Key(Key.Tab));
|
||||
AddAssert("search text box focused", () => modSelectOverlay.SearchTextBox.HasFocus);
|
||||
|
@ -15,15 +15,16 @@ using osu.Game.Overlays.Mods;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Screens.Select.FooterV2;
|
||||
using osu.Game.Screens.Footer;
|
||||
using osu.Game.Screens.SelectV2.Footer;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Tests.Visual.SongSelect
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
public partial class TestSceneSongSelectFooterV2 : OsuManualInputManagerTestScene
|
||||
public partial class TestSceneScreenFooter : OsuManualInputManagerTestScene
|
||||
{
|
||||
private FooterButtonRandomV2 randomButton = null!;
|
||||
private FooterButtonModsV2 modsButton = null!;
|
||||
private ScreenFooterButtonRandom randomButton = null!;
|
||||
private ScreenFooterButtonMods modsButton = null!;
|
||||
|
||||
private bool nextRandomCalled;
|
||||
private bool previousRandomCalled;
|
||||
@ -39,25 +40,25 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
nextRandomCalled = false;
|
||||
previousRandomCalled = false;
|
||||
|
||||
FooterV2 footer;
|
||||
ScreenFooter footer;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new PopoverContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Child = footer = new FooterV2(),
|
||||
Child = footer = new ScreenFooter(),
|
||||
},
|
||||
overlay = new DummyOverlay()
|
||||
};
|
||||
|
||||
footer.AddButton(modsButton = new FooterButtonModsV2 { Current = SelectedMods }, overlay);
|
||||
footer.AddButton(randomButton = new FooterButtonRandomV2
|
||||
footer.AddButton(modsButton = new ScreenFooterButtonMods { Current = SelectedMods }, overlay);
|
||||
footer.AddButton(randomButton = new ScreenFooterButtonRandom
|
||||
{
|
||||
NextRandom = () => nextRandomCalled = true,
|
||||
PreviousRandom = () => previousRandomCalled = true
|
||||
});
|
||||
footer.AddButton(new FooterButtonOptionsV2());
|
||||
footer.AddButton(new ScreenFooterButtonOptions());
|
||||
|
||||
overlay.Hide();
|
||||
});
|
||||
@ -98,7 +99,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
{
|
||||
AddStep("enable options", () =>
|
||||
{
|
||||
var optionsButton = this.ChildrenOfType<FooterButtonV2>().Last();
|
||||
var optionsButton = this.ChildrenOfType<ScreenFooterButton>().Last();
|
||||
|
||||
optionsButton.Enabled.Value = true;
|
||||
optionsButton.TriggerClick();
|
||||
@ -108,7 +109,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
[Test]
|
||||
public void TestState()
|
||||
{
|
||||
AddToggleStep("set options enabled state", state => this.ChildrenOfType<FooterButtonV2>().Last().Enabled.Value = state);
|
||||
AddToggleStep("set options enabled state", state => this.ChildrenOfType<ScreenFooterButton>().Last().Enabled.Value = state);
|
||||
}
|
||||
|
||||
[Test]
|
@ -12,21 +12,21 @@ using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
using osu.Game.Screens.Select.FooterV2;
|
||||
using osu.Game.Screens.SelectV2.Footer;
|
||||
using osu.Game.Utils;
|
||||
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
public partial class TestSceneFooterButtonModsV2 : OsuTestScene
|
||||
public partial class TestSceneScreenFooterButtonMods : OsuTestScene
|
||||
{
|
||||
private readonly TestFooterButtonModsV2 footerButtonMods;
|
||||
private readonly TestScreenFooterButtonMods footerButtonMods;
|
||||
|
||||
[Cached]
|
||||
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Aquamarine);
|
||||
|
||||
public TestSceneFooterButtonModsV2()
|
||||
public TestSceneScreenFooterButtonMods()
|
||||
{
|
||||
Add(footerButtonMods = new TestFooterButtonModsV2
|
||||
Add(footerButtonMods = new TestScreenFooterButtonMods
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.CentreLeft,
|
||||
@ -97,9 +97,9 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
public void TestUnrankedBadge()
|
||||
{
|
||||
AddStep(@"Add unranked mod", () => changeMods(new[] { new OsuModDeflate() }));
|
||||
AddUntilStep("Unranked badge shown", () => footerButtonMods.ChildrenOfType<FooterButtonModsV2.UnrankedBadge>().Single().Alpha == 1);
|
||||
AddUntilStep("Unranked badge shown", () => footerButtonMods.ChildrenOfType<ScreenFooterButtonMods.UnrankedBadge>().Single().Alpha == 1);
|
||||
AddStep(@"Clear selected mod", () => changeMods(Array.Empty<Mod>()));
|
||||
AddUntilStep("Unranked badge not shown", () => footerButtonMods.ChildrenOfType<FooterButtonModsV2.UnrankedBadge>().Single().Alpha == 0);
|
||||
AddUntilStep("Unranked badge not shown", () => footerButtonMods.ChildrenOfType<ScreenFooterButtonMods.UnrankedBadge>().Single().Alpha == 0);
|
||||
}
|
||||
|
||||
private void changeMods(IReadOnlyList<Mod> mods) => footerButtonMods.Current.Value = mods;
|
||||
@ -112,7 +112,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
return expectedValue == footerButtonMods.MultiplierText.Current.Value;
|
||||
}
|
||||
|
||||
private partial class TestFooterButtonModsV2 : FooterButtonModsV2
|
||||
private partial class TestScreenFooterButtonMods : ScreenFooterButtonMods
|
||||
{
|
||||
public new OsuSpriteText MultiplierText => base.MultiplierText;
|
||||
}
|
@ -5,6 +5,7 @@ using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Graphics.UserInterfaceV2;
|
||||
@ -42,7 +43,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
AddStep("set instantaneous to false", () => sliderWithTextBoxInput.Instantaneous = false);
|
||||
|
||||
AddStep("focus textbox", () => InputManager.ChangeFocus(textBox));
|
||||
AddStep("focus textbox", () => ((IFocusManager)InputManager).ChangeFocus(textBox));
|
||||
AddStep("change text", () => textBox.Text = "3");
|
||||
AddAssert("slider not moved", () => slider.Current.Value, () => Is.Zero);
|
||||
AddAssert("current not changed", () => sliderWithTextBoxInput.Current.Value, () => Is.Zero);
|
||||
@ -61,7 +62,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
AddAssert("textbox changed", () => textBox.Current.Value, () => Is.EqualTo("-5"));
|
||||
AddAssert("current changed", () => sliderWithTextBoxInput.Current.Value, () => Is.EqualTo(-5));
|
||||
|
||||
AddStep("focus textbox", () => InputManager.ChangeFocus(textBox));
|
||||
AddStep("focus textbox", () => ((IFocusManager)InputManager).ChangeFocus(textBox));
|
||||
AddStep("set text to invalid", () => textBox.Text = "garbage");
|
||||
AddAssert("slider not moved", () => slider.Current.Value, () => Is.EqualTo(-5));
|
||||
AddAssert("current not changed", () => sliderWithTextBoxInput.Current.Value, () => Is.EqualTo(-5));
|
||||
@ -71,12 +72,12 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
AddAssert("slider not moved", () => slider.Current.Value, () => Is.EqualTo(-5));
|
||||
AddAssert("current not changed", () => sliderWithTextBoxInput.Current.Value, () => Is.EqualTo(-5));
|
||||
|
||||
AddStep("focus textbox", () => InputManager.ChangeFocus(textBox));
|
||||
AddStep("focus textbox", () => ((IFocusManager)InputManager).ChangeFocus(textBox));
|
||||
AddStep("set text to invalid", () => textBox.Text = "garbage");
|
||||
AddAssert("slider not moved", () => slider.Current.Value, () => Is.EqualTo(-5));
|
||||
AddAssert("current not changed", () => sliderWithTextBoxInput.Current.Value, () => Is.EqualTo(-5));
|
||||
|
||||
AddStep("lose focus", () => InputManager.ChangeFocus(null));
|
||||
AddStep("lose focus", () => ((IFocusManager)InputManager).ChangeFocus(null));
|
||||
AddAssert("text restored", () => textBox.Text, () => Is.EqualTo("-5"));
|
||||
AddAssert("slider not moved", () => slider.Current.Value, () => Is.EqualTo(-5));
|
||||
AddAssert("current not changed", () => sliderWithTextBoxInput.Current.Value, () => Is.EqualTo(-5));
|
||||
@ -87,7 +88,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
AddStep("set instantaneous to true", () => sliderWithTextBoxInput.Instantaneous = true);
|
||||
|
||||
AddStep("focus textbox", () => InputManager.ChangeFocus(textBox));
|
||||
AddStep("focus textbox", () => ((IFocusManager)InputManager).ChangeFocus(textBox));
|
||||
AddStep("change text", () => textBox.Text = "3");
|
||||
AddAssert("slider moved", () => slider.Current.Value, () => Is.EqualTo(3));
|
||||
AddAssert("current changed", () => sliderWithTextBoxInput.Current.Value, () => Is.EqualTo(3));
|
||||
@ -106,7 +107,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
AddAssert("textbox not changed", () => textBox.Current.Value, () => Is.EqualTo("-5"));
|
||||
AddAssert("current not changed", () => sliderWithTextBoxInput.Current.Value, () => Is.EqualTo(-5));
|
||||
|
||||
AddStep("focus textbox", () => InputManager.ChangeFocus(textBox));
|
||||
AddStep("focus textbox", () => ((IFocusManager)InputManager).ChangeFocus(textBox));
|
||||
AddStep("set text to invalid", () => textBox.Text = "garbage");
|
||||
AddAssert("slider not moved", () => slider.Current.Value, () => Is.EqualTo(-5));
|
||||
AddAssert("current not changed", () => sliderWithTextBoxInput.Current.Value, () => Is.EqualTo(-5));
|
||||
@ -116,12 +117,12 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
AddAssert("slider not moved", () => slider.Current.Value, () => Is.EqualTo(-5));
|
||||
AddAssert("current not changed", () => sliderWithTextBoxInput.Current.Value, () => Is.EqualTo(-5));
|
||||
|
||||
AddStep("focus textbox", () => InputManager.ChangeFocus(textBox));
|
||||
AddStep("focus textbox", () => ((IFocusManager)InputManager).ChangeFocus(textBox));
|
||||
AddStep("set text to invalid", () => textBox.Text = "garbage");
|
||||
AddAssert("slider not moved", () => slider.Current.Value, () => Is.EqualTo(-5));
|
||||
AddAssert("current not changed", () => sliderWithTextBoxInput.Current.Value, () => Is.EqualTo(-5));
|
||||
|
||||
AddStep("lose focus", () => InputManager.ChangeFocus(null));
|
||||
AddStep("lose focus", () => ((IFocusManager)InputManager).ChangeFocus(null));
|
||||
AddAssert("text restored", () => textBox.Text, () => Is.EqualTo("-5"));
|
||||
AddAssert("slider not moved", () => slider.Current.Value, () => Is.EqualTo(-5));
|
||||
AddAssert("current not changed", () => sliderWithTextBoxInput.Current.Value, () => Is.EqualTo(-5));
|
||||
|
@ -58,7 +58,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
editorInfo.Selected.ValueChanged += selection =>
|
||||
{
|
||||
// ensure any ongoing edits are committed out to the *current* selection before changing to a new one.
|
||||
GetContainingInputManager().TriggerFocusContention(null);
|
||||
GetContainingFocusManager().TriggerFocusContention(null);
|
||||
|
||||
// Required to avoid cyclic failure in BindableWithCurrent (TriggerChange called during the Current_Set process).
|
||||
// Arguable a framework issue but since we haven't hit it anywhere else a local workaround seems best.
|
||||
|
@ -85,6 +85,8 @@ namespace osu.Game.Beatmaps.Formats
|
||||
|
||||
base.ParseStreamInto(stream, beatmap);
|
||||
|
||||
applyDifficultyRestrictions(beatmap.Difficulty, beatmap);
|
||||
|
||||
flushPendingPoints();
|
||||
|
||||
// Objects may be out of order *only* if a user has manually edited an .osu file.
|
||||
@ -102,10 +104,30 @@ namespace osu.Game.Beatmaps.Formats
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensures that all <see cref="BeatmapDifficulty"/> settings are within the allowed ranges.
|
||||
/// See also: https://github.com/peppy/osu-stable-reference/blob/0e425c0d525ef21353c8293c235cc0621d28338b/osu!/GameplayElements/Beatmaps/Beatmap.cs#L567-L614
|
||||
/// </summary>
|
||||
private static void applyDifficultyRestrictions(BeatmapDifficulty difficulty, Beatmap beatmap)
|
||||
{
|
||||
difficulty.DrainRate = Math.Clamp(difficulty.DrainRate, 0, 10);
|
||||
|
||||
// mania uses "circle size" for key count, thus different allowable range
|
||||
difficulty.CircleSize = beatmap.BeatmapInfo.Ruleset.OnlineID != 3
|
||||
? Math.Clamp(difficulty.CircleSize, 0, 10)
|
||||
: Math.Clamp(difficulty.CircleSize, 1, 18);
|
||||
|
||||
difficulty.OverallDifficulty = Math.Clamp(difficulty.OverallDifficulty, 0, 10);
|
||||
difficulty.ApproachRate = Math.Clamp(difficulty.ApproachRate, 0, 10);
|
||||
|
||||
difficulty.SliderMultiplier = Math.Clamp(difficulty.SliderMultiplier, 0.4, 3.6);
|
||||
difficulty.SliderTickRate = Math.Clamp(difficulty.SliderTickRate, 0.5, 8);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processes the beatmap such that a new combo is started the first hitobject following each break.
|
||||
/// </summary>
|
||||
private void postProcessBreaks(Beatmap beatmap)
|
||||
private static void postProcessBreaks(Beatmap beatmap)
|
||||
{
|
||||
int currentBreak = 0;
|
||||
bool forceNewCombo = false;
|
||||
@ -161,7 +183,7 @@ namespace osu.Game.Beatmaps.Formats
|
||||
/// This method's intention is to restore those legacy defaults.
|
||||
/// See also: https://osu.ppy.sh/wiki/en/Client/File_formats/Osu_%28file_format%29
|
||||
/// </summary>
|
||||
private void applyLegacyDefaults(BeatmapInfo beatmapInfo)
|
||||
private static void applyLegacyDefaults(BeatmapInfo beatmapInfo)
|
||||
{
|
||||
beatmapInfo.WidescreenStoryboard = false;
|
||||
beatmapInfo.SamplesMatchPlaybackRate = false;
|
||||
@ -402,11 +424,11 @@ namespace osu.Game.Beatmaps.Formats
|
||||
break;
|
||||
|
||||
case @"SliderMultiplier":
|
||||
difficulty.SliderMultiplier = Math.Clamp(Parsing.ParseDouble(pair.Value), 0.4, 3.6);
|
||||
difficulty.SliderMultiplier = Parsing.ParseDouble(pair.Value);
|
||||
break;
|
||||
|
||||
case @"SliderTickRate":
|
||||
difficulty.SliderTickRate = Math.Clamp(Parsing.ParseDouble(pair.Value), 0.5, 8);
|
||||
difficulty.SliderTickRate = Parsing.ParseDouble(pair.Value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ namespace osu.Game.Collections
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
AddInternal(addOrRemoveButton = new IconButton
|
||||
AddInternal(addOrRemoveButton = new NoFocusChangeIconButton
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
@ -271,6 +271,11 @@ namespace osu.Game.Collections
|
||||
}
|
||||
|
||||
protected override Drawable CreateContent() => (Content)base.CreateContent();
|
||||
|
||||
private partial class NoFocusChangeIconButton : IconButton
|
||||
{
|
||||
public override bool ChangeFocusOnClick => false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ namespace osu.Game.Collections
|
||||
this.ScaleTo(0.9f, exit_duration);
|
||||
|
||||
// Ensure that textboxes commit
|
||||
GetContainingInputManager()?.TriggerFocusContention(this);
|
||||
GetContainingFocusManager()?.TriggerFocusContention(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1134,7 +1134,17 @@ namespace osu.Game.Database
|
||||
|
||||
case 41:
|
||||
foreach (var score in migration.NewRealm.All<ScoreInfo>())
|
||||
LegacyScoreDecoder.PopulateTotalScoreWithoutMods(score);
|
||||
{
|
||||
try
|
||||
{
|
||||
// this can fail e.g. if a user has a score set on a ruleset that can no longer be loaded.
|
||||
LegacyScoreDecoder.PopulateTotalScoreWithoutMods(score);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Log($@"Failed to populate total score without mods for score {score.ID}: {ex}", LoggingTarget.Database);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
if (!allowImmediateFocus)
|
||||
return;
|
||||
|
||||
Scheduler.Add(() => GetContainingInputManager().ChangeFocus(this));
|
||||
Scheduler.Add(() => GetContainingFocusManager().ChangeFocus(this));
|
||||
}
|
||||
|
||||
public new void KillFocus() => base.KillFocus();
|
||||
|
@ -52,8 +52,6 @@ namespace osu.Game.Graphics.UserInterface
|
||||
AutoSizeAxes = Axes.Y;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
|
||||
const float nub_padding = 5;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
LabelTextFlowContainer = new OsuTextFlowContainer(ApplyLabelParameters)
|
||||
@ -69,15 +67,13 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
Nub.Anchor = Anchor.CentreRight;
|
||||
Nub.Origin = Anchor.CentreRight;
|
||||
Nub.Margin = new MarginPadding { Right = nub_padding };
|
||||
LabelTextFlowContainer.Padding = new MarginPadding { Right = Nub.DEFAULT_EXPANDED_SIZE + nub_padding * 2 };
|
||||
LabelTextFlowContainer.Padding = new MarginPadding { Right = Nub.DEFAULT_EXPANDED_SIZE + 10f };
|
||||
}
|
||||
else
|
||||
{
|
||||
Nub.Anchor = Anchor.CentreLeft;
|
||||
Nub.Origin = Anchor.CentreLeft;
|
||||
Nub.Margin = new MarginPadding { Left = nub_padding };
|
||||
LabelTextFlowContainer.Padding = new MarginPadding { Left = Nub.DEFAULT_EXPANDED_SIZE + nub_padding * 2 };
|
||||
LabelTextFlowContainer.Padding = new MarginPadding { Left = Nub.DEFAULT_EXPANDED_SIZE + 10f };
|
||||
}
|
||||
|
||||
Nub.Current.BindTo(Current);
|
||||
|
@ -57,7 +57,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
||||
protected override void OnFocus(FocusEvent e)
|
||||
{
|
||||
base.OnFocus(e);
|
||||
GetContainingInputManager().ChangeFocus(Component);
|
||||
GetContainingFocusManager().ChangeFocus(Component);
|
||||
}
|
||||
|
||||
protected override OsuTextBox CreateComponent() => CreateTextBox().With(t =>
|
||||
|
@ -85,7 +85,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
||||
Current.BindValueChanged(updateTextBoxFromSlider, true);
|
||||
}
|
||||
|
||||
public bool TakeFocus() => GetContainingInputManager().ChangeFocus(textBox);
|
||||
public bool TakeFocus() => GetContainingFocusManager().ChangeFocus(textBox);
|
||||
|
||||
private bool updatingFromTextBox;
|
||||
|
||||
|
@ -578,17 +578,17 @@ namespace osu.Game
|
||||
{
|
||||
case ITabletHandler th:
|
||||
return new TabletSettings(th);
|
||||
|
||||
case MouseHandler mh:
|
||||
return new MouseSettings(mh);
|
||||
|
||||
case JoystickHandler jh:
|
||||
return new JoystickSettings(jh);
|
||||
}
|
||||
}
|
||||
|
||||
switch (handler)
|
||||
{
|
||||
case MouseHandler mh:
|
||||
return new MouseSettings(mh);
|
||||
|
||||
case JoystickHandler jh:
|
||||
return new JoystickSettings(jh);
|
||||
|
||||
case TouchHandler th:
|
||||
return new TouchSettings(th);
|
||||
|
||||
|
@ -243,7 +243,7 @@ namespace osu.Game.Overlays.AccountCreation
|
||||
|
||||
if (nextTextBox != null)
|
||||
{
|
||||
Schedule(() => GetContainingInputManager().ChangeFocus(nextTextBox));
|
||||
Schedule(() => GetContainingFocusManager().ChangeFocus(nextTextBox));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Comments
|
||||
base.LoadComplete();
|
||||
|
||||
if (!TextBox.ReadOnly)
|
||||
GetContainingInputManager().ChangeFocus(TextBox);
|
||||
GetContainingFocusManager().ChangeFocus(TextBox);
|
||||
}
|
||||
|
||||
protected override void OnCommit(string text)
|
||||
|
@ -150,7 +150,7 @@ namespace osu.Game.Overlays.Login
|
||||
|
||||
protected override void OnFocus(FocusEvent e)
|
||||
{
|
||||
Schedule(() => { GetContainingInputManager().ChangeFocus(string.IsNullOrEmpty(username.Text) ? username : password); });
|
||||
Schedule(() => { GetContainingFocusManager().ChangeFocus(string.IsNullOrEmpty(username.Text) ? username : password); });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ namespace osu.Game.Overlays.Login
|
||||
}
|
||||
|
||||
if (form != null)
|
||||
ScheduleAfterChildren(() => GetContainingInputManager()?.ChangeFocus(form));
|
||||
ScheduleAfterChildren(() => GetContainingFocusManager()?.ChangeFocus(form));
|
||||
});
|
||||
|
||||
private void updateDropdownCurrent(UserStatus? status)
|
||||
@ -216,7 +216,7 @@ namespace osu.Game.Overlays.Login
|
||||
|
||||
protected override void OnFocus(FocusEvent e)
|
||||
{
|
||||
if (form != null) GetContainingInputManager().ChangeFocus(form);
|
||||
if (form != null) GetContainingFocusManager().ChangeFocus(form);
|
||||
base.OnFocus(e);
|
||||
}
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ namespace osu.Game.Overlays.Login
|
||||
|
||||
protected override void OnFocus(FocusEvent e)
|
||||
{
|
||||
Schedule(() => { GetContainingInputManager().ChangeFocus(codeTextBox); });
|
||||
Schedule(() => { GetContainingFocusManager().ChangeFocus(codeTextBox); });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +78,7 @@ namespace osu.Game.Overlays
|
||||
this.FadeIn(transition_time, Easing.OutQuint);
|
||||
FadeEdgeEffectTo(WaveContainer.SHADOW_OPACITY, WaveContainer.APPEAR_DURATION, Easing.Out);
|
||||
|
||||
ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(panel));
|
||||
ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(panel));
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
|
@ -89,7 +89,7 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(nameTextBox));
|
||||
ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(nameTextBox));
|
||||
|
||||
nameTextBox.Current.BindValueChanged(s =>
|
||||
{
|
||||
|
@ -136,7 +136,7 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(nameTextBox));
|
||||
ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(nameTextBox));
|
||||
}
|
||||
|
||||
public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||
|
@ -949,7 +949,7 @@ namespace osu.Game.Overlays.Mods
|
||||
RequestScroll?.Invoke(this);
|
||||
|
||||
// Killing focus is done here because it's the only feasible place on ModSelectOverlay you can click on without triggering any action.
|
||||
Scheduler.Add(() => GetContainingInputManager().ChangeFocus(null));
|
||||
Scheduler.Add(() => GetContainingFocusManager().ChangeFocus(null));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -465,7 +465,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
}
|
||||
|
||||
if (HasFocus)
|
||||
GetContainingInputManager().ChangeFocus(null);
|
||||
GetContainingFocusManager().ChangeFocus(null);
|
||||
|
||||
cancelAndClearButtons.FadeOut(300, Easing.OutQuint);
|
||||
cancelAndClearButtons.BypassAutoSizeAxes |= Axes.Y;
|
||||
|
@ -106,7 +106,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
{
|
||||
var next = Children.SkipWhile(c => c != sender).Skip(1).FirstOrDefault();
|
||||
if (next != null)
|
||||
GetContainingInputManager().ChangeFocus(next);
|
||||
GetContainingFocusManager().ChangeFocus(next);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,12 +105,17 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
|
||||
highPrecisionMouse.Current.BindValueChanged(highPrecision =>
|
||||
{
|
||||
if (RuntimeInfo.OS != RuntimeInfo.Platform.Windows)
|
||||
switch (RuntimeInfo.OS)
|
||||
{
|
||||
if (highPrecision.NewValue)
|
||||
highPrecisionMouse.SetNoticeText(MouseSettingsStrings.HighPrecisionPlatformWarning, true);
|
||||
else
|
||||
highPrecisionMouse.ClearNoticeText();
|
||||
case RuntimeInfo.Platform.Linux:
|
||||
case RuntimeInfo.Platform.macOS:
|
||||
case RuntimeInfo.Platform.iOS:
|
||||
if (highPrecision.NewValue)
|
||||
highPrecisionMouse.SetNoticeText(MouseSettingsStrings.HighPrecisionPlatformWarning, true);
|
||||
else
|
||||
highPrecisionMouse.ClearNoticeText();
|
||||
|
||||
break;
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
searchTextBox.HoldFocus = false;
|
||||
if (searchTextBox.HasFocus)
|
||||
GetContainingInputManager().ChangeFocus(null);
|
||||
GetContainingFocusManager().ChangeFocus(null);
|
||||
}
|
||||
|
||||
public override bool AcceptsFocus => true;
|
||||
|
@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Extensions.EnumExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -421,13 +422,43 @@ namespace osu.Game.Overlays.SkinEditor
|
||||
drawable.Position -= drawable.AnchorPosition - previousAnchor;
|
||||
}
|
||||
|
||||
private static void applyOrigin(Drawable drawable, Anchor origin)
|
||||
private static void applyOrigin(Drawable drawable, Anchor screenSpaceOrigin)
|
||||
{
|
||||
if (origin == drawable.Origin) return;
|
||||
var boundingBox = drawable.ScreenSpaceDrawQuad.AABBFloat;
|
||||
|
||||
var previousOrigin = drawable.OriginPosition;
|
||||
drawable.Origin = origin;
|
||||
drawable.Position += drawable.OriginPosition - previousOrigin;
|
||||
var targetScreenSpacePosition = screenSpaceOrigin.PositionOnQuad(boundingBox);
|
||||
|
||||
Anchor localOrigin = Anchor.TopLeft;
|
||||
float smallestDistanceFromTargetPosition = float.PositiveInfinity;
|
||||
|
||||
void checkOrigin(Anchor originToTest)
|
||||
{
|
||||
Vector2 positionToTest = drawable.ToScreenSpace(originToTest.PositionOnQuad(drawable.DrawRectangle));
|
||||
float testedDistance = Vector2.Distance(targetScreenSpacePosition, positionToTest);
|
||||
|
||||
if (testedDistance < smallestDistanceFromTargetPosition)
|
||||
{
|
||||
localOrigin = originToTest;
|
||||
smallestDistanceFromTargetPosition = testedDistance;
|
||||
}
|
||||
}
|
||||
|
||||
checkOrigin(Anchor.TopLeft);
|
||||
checkOrigin(Anchor.TopCentre);
|
||||
checkOrigin(Anchor.TopRight);
|
||||
|
||||
checkOrigin(Anchor.CentreLeft);
|
||||
checkOrigin(Anchor.Centre);
|
||||
checkOrigin(Anchor.CentreRight);
|
||||
|
||||
checkOrigin(Anchor.BottomLeft);
|
||||
checkOrigin(Anchor.BottomCentre);
|
||||
checkOrigin(Anchor.BottomRight);
|
||||
|
||||
Vector2 offset = drawable.ToParentSpace(localOrigin.PositionOnQuad(drawable.DrawRectangle)) - drawable.ToParentSpace(drawable.Origin.PositionOnQuad(drawable.DrawRectangle));
|
||||
|
||||
drawable.Origin = localOrigin;
|
||||
drawable.Position += offset;
|
||||
}
|
||||
|
||||
private static void adjustScaleFromAnchor(ref Vector2 scale, Anchor reference)
|
||||
|
@ -88,7 +88,7 @@ namespace osu.Game.Scoring
|
||||
{
|
||||
ScoreInfo? databasedScoreInfo = null;
|
||||
|
||||
if (originalScoreInfo is ScoreInfo scoreInfo)
|
||||
if (originalScoreInfo is ScoreInfo scoreInfo && !string.IsNullOrEmpty(scoreInfo.Hash))
|
||||
databasedScoreInfo = Query(s => s.Hash == scoreInfo.Hash);
|
||||
|
||||
if (originalScoreInfo.OnlineID > 0)
|
||||
|
@ -580,7 +580,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
GetContainingInputManager().ChangeFocus(this);
|
||||
GetContainingFocusManager().ChangeFocus(this);
|
||||
SelectAll();
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(sliderVelocitySlider));
|
||||
ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(sliderVelocitySlider));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(volume));
|
||||
ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(volume));
|
||||
}
|
||||
|
||||
private static string? getCommonBank(IList<HitSampleInfo>[] relevantSamples) => relevantSamples.Select(GetBankValue).Distinct().Count() == 1 ? GetBankValue(relevantSamples.First()) : null;
|
||||
|
@ -45,7 +45,7 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
OnFocused?.Invoke();
|
||||
base.OnFocus(e);
|
||||
|
||||
GetContainingInputManager().TriggerFocusContention(this);
|
||||
GetContainingFocusManager().TriggerFocusContention(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
base.LoadComplete();
|
||||
|
||||
if (string.IsNullOrEmpty(ArtistTextBox.Current.Value))
|
||||
ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(ArtistTextBox));
|
||||
ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(ArtistTextBox));
|
||||
|
||||
ArtistTextBox.Current.BindValueChanged(artist => transferIfRomanised(artist.NewValue, RomanisedArtistTextBox));
|
||||
TitleTextBox.Current.BindValueChanged(title => transferIfRomanised(title.NewValue, RomanisedTitleTextBox));
|
||||
|
@ -126,7 +126,7 @@ namespace osu.Game.Screens.Edit.Timing
|
||||
protected override void OnFocus(FocusEvent e)
|
||||
{
|
||||
base.OnFocus(e);
|
||||
GetContainingInputManager().ChangeFocus(textBox);
|
||||
GetContainingFocusManager().ChangeFocus(textBox);
|
||||
}
|
||||
|
||||
private void updateState()
|
||||
|
@ -11,9 +11,9 @@ using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Overlays;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Select.FooterV2
|
||||
namespace osu.Game.Screens.Footer
|
||||
{
|
||||
public partial class FooterV2 : InputBlockingContainer
|
||||
public partial class ScreenFooter : InputBlockingContainer
|
||||
{
|
||||
//Should be 60, setting to 50 for now for the sake of matching the current BackButton height.
|
||||
private const int height = 50;
|
||||
@ -23,7 +23,7 @@ namespace osu.Game.Screens.Select.FooterV2
|
||||
|
||||
/// <param name="button">The button to be added.</param>
|
||||
/// <param name="overlay">The <see cref="OverlayContainer"/> to be toggled by this button.</param>
|
||||
public void AddButton(FooterButtonV2 button, OverlayContainer? overlay = null)
|
||||
public void AddButton(ScreenFooterButton button, OverlayContainer? overlay = null)
|
||||
{
|
||||
if (overlay != null)
|
||||
{
|
||||
@ -46,9 +46,9 @@ namespace osu.Game.Screens.Select.FooterV2
|
||||
}
|
||||
}
|
||||
|
||||
private FillFlowContainer<FooterButtonV2> buttons = null!;
|
||||
private FillFlowContainer<ScreenFooterButton> buttons = null!;
|
||||
|
||||
public FooterV2()
|
||||
public ScreenFooter()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = height;
|
||||
@ -66,7 +66,7 @@ namespace osu.Game.Screens.Select.FooterV2
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colourProvider.Background5
|
||||
},
|
||||
buttons = new FillFlowContainer<FooterButtonV2>
|
||||
buttons = new FillFlowContainer<ScreenFooterButton>
|
||||
{
|
||||
Position = new Vector2(TwoLayerButton.SIZE_EXTENDED.X + padding, 10),
|
||||
Anchor = Anchor.BottomLeft,
|
@ -21,9 +21,9 @@ using osu.Game.Overlays;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Select.FooterV2
|
||||
namespace osu.Game.Screens.Footer
|
||||
{
|
||||
public partial class FooterButtonV2 : OsuClickableContainer, IKeyBindingHandler<GlobalAction>
|
||||
public partial class ScreenFooterButton : OsuClickableContainer, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
// This should be 12 by design, but an extra allowance is added due to the corner radius specification.
|
||||
private const float shear_width = 13.5f;
|
||||
@ -70,7 +70,7 @@ namespace osu.Game.Screens.Select.FooterV2
|
||||
private readonly Box glowBox;
|
||||
private readonly Box flashLayer;
|
||||
|
||||
public FooterButtonV2()
|
||||
public ScreenFooterButton()
|
||||
{
|
||||
Size = new Vector2(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||
|
@ -248,21 +248,21 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(passwordTextBox));
|
||||
ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(passwordTextBox));
|
||||
passwordTextBox.OnCommit += (_, _) => performJoin();
|
||||
}
|
||||
|
||||
private void performJoin()
|
||||
{
|
||||
lounge?.Join(room, passwordTextBox.Text, null, joinFailed);
|
||||
GetContainingInputManager().TriggerFocusContention(passwordTextBox);
|
||||
GetContainingFocusManager().TriggerFocusContention(passwordTextBox);
|
||||
}
|
||||
|
||||
private void joinFailed(string error) => Schedule(() =>
|
||||
{
|
||||
passwordTextBox.Text = string.Empty;
|
||||
|
||||
GetContainingInputManager().ChangeFocus(passwordTextBox);
|
||||
GetContainingFocusManager().ChangeFocus(passwordTextBox);
|
||||
|
||||
errorText.Text = error;
|
||||
errorText
|
||||
|
@ -245,7 +245,7 @@ namespace osu.Game.Screens.Select
|
||||
searchTextBox.ReadOnly = true;
|
||||
searchTextBox.HoldFocus = false;
|
||||
if (searchTextBox.HasFocus)
|
||||
GetContainingInputManager().ChangeFocus(searchTextBox);
|
||||
GetContainingFocusManager().ChangeFocus(searchTextBox);
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
|
@ -20,24 +20,25 @@ using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Graphics.UserInterfaceV2;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Screens.Select;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osuTK.Input;
|
||||
using WebCommonStrings = osu.Game.Resources.Localisation.Web.CommonStrings;
|
||||
|
||||
namespace osu.Game.Screens.Select.FooterV2
|
||||
namespace osu.Game.Screens.SelectV2.Footer
|
||||
{
|
||||
public partial class BeatmapOptionsPopover : OsuPopover
|
||||
{
|
||||
private FillFlowContainer buttonFlow = null!;
|
||||
private readonly FooterButtonOptionsV2 footerButton;
|
||||
private readonly ScreenFooterButtonOptions footerButton;
|
||||
|
||||
private WorkingBeatmap beatmapWhenOpening = null!;
|
||||
|
||||
[Resolved]
|
||||
private IBindable<WorkingBeatmap> beatmap { get; set; } = null!;
|
||||
|
||||
public BeatmapOptionsPopover(FooterButtonOptionsV2 footerButton)
|
||||
public BeatmapOptionsPopover(ScreenFooterButtonOptions footerButton)
|
||||
{
|
||||
this.footerButton = footerButton;
|
||||
}
|
||||
@ -77,7 +78,7 @@ namespace osu.Game.Screens.Select.FooterV2
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
ScheduleAfterChildren(() => GetContainingInputManager().ChangeFocus(this));
|
||||
ScheduleAfterChildren(() => GetContainingFocusManager().ChangeFocus(this));
|
||||
|
||||
beatmap.BindValueChanged(_ => Hide());
|
||||
}
|
@ -21,14 +21,15 @@ using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Screens.Footer;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using osu.Game.Utils;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Select.FooterV2
|
||||
namespace osu.Game.Screens.SelectV2.Footer
|
||||
{
|
||||
public partial class FooterButtonModsV2 : FooterButtonV2, IHasCurrentValue<IReadOnlyList<Mod>>
|
||||
public partial class ScreenFooterButtonMods : ScreenFooterButton, IHasCurrentValue<IReadOnlyList<Mod>>
|
||||
{
|
||||
// todo: see https://github.com/ppy/osu-framework/issues/3271
|
||||
private const float torus_scale_factor = 1.2f;
|
@ -8,10 +8,11 @@ using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Screens.Footer;
|
||||
|
||||
namespace osu.Game.Screens.Select.FooterV2
|
||||
namespace osu.Game.Screens.SelectV2.Footer
|
||||
{
|
||||
public partial class FooterButtonOptionsV2 : FooterButtonV2, IHasPopover
|
||||
public partial class ScreenFooterButtonOptions : ScreenFooterButton, IHasPopover
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colour)
|
@ -10,12 +10,13 @@ using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Screens.Footer;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
|
||||
namespace osu.Game.Screens.Select.FooterV2
|
||||
namespace osu.Game.Screens.SelectV2.Footer
|
||||
{
|
||||
public partial class FooterButtonRandomV2 : FooterButtonV2
|
||||
public partial class ScreenFooterButtonRandom : ScreenFooterButton
|
||||
{
|
||||
public Action? NextRandom { get; set; }
|
||||
public Action? PreviousRandom { get; set; }
|
@ -35,7 +35,7 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Realm" Version="11.5.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2024.509.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2024.523.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2024.517.0" />
|
||||
<PackageReference Include="Sentry" Version="4.3.0" />
|
||||
<!-- Held back due to 0.34.0 failing AOT compilation on ZstdSharp.dll dependency. -->
|
||||
|
@ -23,6 +23,6 @@
|
||||
<RuntimeIdentifier>iossimulator-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2024.509.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2024.523.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
Loading…
Reference in New Issue
Block a user