mirror of
https://github.com/ppy/osu.git
synced 2025-03-05 14:22:55 +08:00
Harden and simplify logic to avoid weird issues
This commit is contained in:
parent
22ea9a8ab4
commit
cf3bf41b49
@ -118,13 +118,16 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
int forwardsIndex = lastSelectedIndex;
|
int forwardsIndex = lastSelectedIndex;
|
||||||
bool hasForwards;
|
|
||||||
|
|
||||||
int backwardsIndex = lastSelectedIndex;
|
int backwardsIndex = lastSelectedIndex;
|
||||||
bool hasBackwards;
|
|
||||||
|
|
||||||
while ((hasBackwards = backwardsIndex >= 0) | (hasForwards = forwardsIndex < Items.Count))
|
while (true)
|
||||||
{
|
{
|
||||||
|
bool hasBackwards = backwardsIndex >= 0 && backwardsIndex < Items.Count;
|
||||||
|
bool hasForwards = forwardsIndex < Items.Count;
|
||||||
|
|
||||||
|
if (!hasBackwards && !hasForwards)
|
||||||
|
return null;
|
||||||
|
|
||||||
if (hasForwards && !Items[forwardsIndex].Filtered.Value)
|
if (hasForwards && !Items[forwardsIndex].Filtered.Value)
|
||||||
return Items[forwardsIndex];
|
return Items[forwardsIndex];
|
||||||
|
|
||||||
@ -134,8 +137,6 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
forwardsIndex++;
|
forwardsIndex++;
|
||||||
backwardsIndex--;
|
backwardsIndex--;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void PerformSelection()
|
protected virtual void PerformSelection()
|
||||||
|
Loading…
Reference in New Issue
Block a user