1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-05 09:42:54 +08:00

Compare commits

...

10 Commits

Author SHA1 Message Date
Darius Wattimena
d41347f28a
Merge 00e3b20ff0 into aa0ee5cf3a 2024-12-04 10:23:34 -05:00
Salman Alshamrani
aa0ee5cf3a
Merge pull request #30970 from peppy/results-screen-quick-retry-transition
Fix quick retry transition from results screen
2024-12-04 07:12:38 -05:00
Salman Alshamrani
a7586c52d0
Merge branch 'master' into results-screen-quick-retry-transition 2024-12-04 06:31:14 -05:00
Dean Herbert
e555131b39
Merge pull request #30971 from smoogipoo/improve-multi-search
Improve multiplayer listing search by making it fuzzy
2024-12-04 00:11:32 -08:00
Dan Balasescu
ad4df82593
Improve multiplayer listing search by making it fuzzy 2024-12-04 16:26:36 +09:00
Dan Balasescu
a8963cf317
Merge pull request #30969 from peppy/buttons-search-term
Add "buttons" as a search term for key bindings
2024-12-04 15:52:12 +09:00
Dean Herbert
a4d58648e2
Fix quick retry transition from results screen 2024-12-04 14:31:39 +09:00
Dean Herbert
296fa69edd
Add "buttons" as a search term for key bindings 2024-12-04 14:30:59 +09:00
Darius Wattimena
00e3b20ff0 Change text to stream instead of fruits as that is the term by catch mappers 2024-11-18 22:30:15 +01:00
Darius Wattimena
5ac3bb73ee Adds an option to the catch editor to convert sliders to fruits 2024-11-18 22:19:08 +01:00
4 changed files with 98 additions and 9 deletions

View File

@ -10,10 +10,12 @@ using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Bindings;
using osu.Framework.Input.Events;
using osu.Framework.Utils;
using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Catch.Edit.Blueprints.Components;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Screens.Edit;
using osuTK;
using osuTK.Input;
@ -54,6 +56,12 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints
[Resolved]
private EditorBeatmap? editorBeatmap { get; set; }
[Resolved]
private IEditorChangeHandler? changeHandler { get; set; }
[Resolved]
private BindableBeatDivisor? beatDivisor { get; set; }
public JuiceStreamSelectionBlueprint(JuiceStream hitObject)
: base(hitObject)
{
@ -119,6 +127,20 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints
return base.OnMouseDown(e);
}
protected override bool OnKeyDown(KeyDownEvent e)
{
if (!IsSelected)
return false;
if (e.Key == Key.F && e.ControlPressed && e.ShiftPressed)
{
convertToStream();
return true;
}
return false;
}
private void onDefaultsApplied(HitObject _)
{
computeObjectBounds();
@ -168,6 +190,48 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints
lastSliderPathVersion = HitObject.Path.Version.Value;
}
private void convertToStream()
{
if (editorBeatmap == null || beatDivisor == null)
return;
var timingPoint = editorBeatmap.ControlPointInfo.TimingPointAt(HitObject.StartTime);
double streamSpacing = timingPoint.BeatLength / beatDivisor.Value;
changeHandler?.BeginChange();
int i = 0;
double time = HitObject.StartTime;
while (!Precision.DefinitelyBigger(time, HitObject.GetEndTime(), 1))
{
// positionWithRepeats is a fractional number in the range of [0, HitObject.SpanCount()]
// and indicates how many fractional spans of a slider have passed up to time.
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 (positionWithRepeats % 2 >= 1)
pathPosition = 1 - pathPosition;
float fruitXValue = HitObject.OriginalX + HitObject.Path.PositionAt(pathPosition).X;
editorBeatmap.Add(new Fruit
{
StartTime = time,
OriginalX = fruitXValue,
NewCombo = i == 0 && HitObject.NewCombo,
Samples = HitObject.Samples.Select(s => s.With()).ToList()
});
i += 1;
time = HitObject.StartTime + i * streamSpacing;
}
editorBeatmap.Remove(HitObject);
changeHandler?.EndChange();
}
private IEnumerable<MenuItem> getContextMenuItems()
{
yield return new OsuMenuItem("Add vertex", MenuItemType.Standard, () =>
@ -177,6 +241,11 @@ namespace osu.Game.Rulesets.Catch.Edit.Blueprints
{
Hotkey = new Hotkey(new KeyCombination(InputKey.Control, InputKey.MouseLeft))
};
yield return new OsuMenuItem("Convert to stream", MenuItemType.Destructive, convertToStream)
{
Hotkey = new Hotkey(new KeyCombination(InputKey.Control, InputKey.Shift, InputKey.F))
};
}
protected override void Dispose(bool isDisposing)

View File

@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
{
protected override LocalisableString Header => BindingSettingsStrings.ShortcutAndGameplayBindings;
public override IEnumerable<LocalisableString> FilterTerms => base.FilterTerms.Concat(new LocalisableString[] { @"keybindings", @"controls", @"keyboard", @"keys" });
public override IEnumerable<LocalisableString> FilterTerms => base.FilterTerms.Concat(new LocalisableString[] { @"keybindings", @"controls", @"keyboard", @"keys", @"buttons" });
public BindingSettings(KeyBindingPanel keyConfig)
{

View File

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
@ -80,19 +81,34 @@ namespace osu.Game.Screens.OnlinePlay.Lounge.Components
bool matchingFilter = true;
matchingFilter &= criteria.Ruleset == null || r.Room.PlaylistItemStats?.RulesetIDs.Any(id => id == criteria.Ruleset.OnlineID) != false;
if (!string.IsNullOrEmpty(criteria.SearchString))
{
// Room name isn't translatable, so ToString() is used here for simplicity.
matchingFilter &= r.FilterTerms.Any(term => term.ToString().Contains(criteria.SearchString, StringComparison.InvariantCultureIgnoreCase));
}
matchingFilter &= matchPermissions(r, criteria.Permissions);
// Room name isn't translatable, so ToString() is used here for simplicity.
string[] filterTerms = r.FilterTerms.Select(t => t.ToString()).ToArray();
string[] searchTerms = criteria.SearchString.Split(' ', StringSplitOptions.RemoveEmptyEntries);
matchingFilter &= searchTerms.All(searchTerm => filterTerms.Any(filterTerm => checkTerm(filterTerm, searchTerm)));
r.MatchingFilter = matchingFilter;
}
});
// Lifted from SearchContainer.
static bool checkTerm(string haystack, string needle)
{
int index = 0;
for (int i = 0; i < needle.Length; i++)
{
int found = CultureInfo.InvariantCulture.CompareInfo.IndexOf(haystack, needle[i], index, CompareOptions.OrdinalIgnoreCase);
if (found < 0)
return false;
index = found + 1;
}
return true;
}
static bool matchPermissions(DrawableLoungeRoom room, RoomPermissionsFilter accessType)
{
switch (accessType)

View File

@ -55,6 +55,8 @@ namespace osu.Game.Screens.Ranking
[Resolved]
private Player? player { get; set; }
private bool skipExitTransition;
[Resolved]
private IAPIProvider api { get; set; } = null!;
@ -203,6 +205,7 @@ namespace osu.Game.Screens.Ranking
{
if (!this.IsCurrentScreen()) return;
skipExitTransition = true;
player?.Restart(true);
},
});
@ -313,7 +316,8 @@ namespace osu.Game.Screens.Ranking
// HitObject references from HitEvent.
Score?.HitEvents.Clear();
this.FadeOut(100);
if (!skipExitTransition)
this.FadeOut(100);
return false;
}