1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-17 22:22:54 +08:00
osu-lazer/osu.Game/Screens
Bartłomiej Dach 4c59ec1d94
Fix incorrect ternary state computation for bank toggles
Closes https://github.com/ppy/osu/issues/28741.

Regressed in a7b066f3ee.

The intent of the original change there was to ensure that addition
banks being set will put the ternary state toggles in indeterminate
state (to at least provide a visual indication that the selection does
not use a single bank). This would previously not be the case due to
the use of `.All()` in the original condition (a single object/node
was considered to have a bank enabled if and only if *all* samples
within it used it). However the attempt to fix that via switching
to `Any()` was not correct.

The logic used in the offending commit operates on extracted `Samples`
and `NodeSamples` from the selection, and would consider the ternary
toggle:

- fully off if none of the samples/node samples contained a sample with
  the given bank,
- indeterminate if the some of the samples/node samples contained a
  sample with the given bank,
- fully on if at least one sample from every samples/node samples
  contained a sample with the given bank.

This is a *two-tiered* process, as in first a *binary* on/off state is
extracted from each object's samples/node samples, and *then* a ternary
state is extracted from all objects/nodes. This is insufficient to
express the *desired* behaviour, which is that the toggle should be:

- fully off if *none of the individual samples in the selection* use
  the given bank,
- indeterminate if *at least one individual sample in the selection*
  uses the given bank,
- fully on if *all individual samples in the selection* use the given
  bank.

The second wording is flattened, and no longer tries to consider "nodes"
or "objects", it just looks at all of the samples in the selection
without concern as to whether they're from separate objects/nodes
or not.

To explain why this discrepancy caused the bug, consider a single object
with a `soft` normal bank and `drum` addition bank. Selecting the object
would cause a ternary button state update; as per the incorrect logic,
there were two samples on the object and each had its own separate
banks, so two ternary toggles would have their state set to `True`
(rather than the correct `Indeterminate`), thus triggering a bindable
feedback loop that would cause one of these banks to win and actually
overwrite the other.

Note that the addition indeterminate state computation *still* needs
to do the two-tiered process, because there it actually makes sense (for
a selection to have an addition fully on rather than indeterminate,
*every* object/node *must* contain that addition).
2024-07-05 09:27:21 +02:00
..
Backgrounds Fix incorrect background being loaded due to async race 2024-05-01 00:05:14 +08:00
Edit Fix incorrect ternary state computation for bank toggles 2024-07-05 09:27:21 +02:00
Footer Merge branch 'master' into footer-v2-become-global 2024-06-08 14:13:05 +03:00
Import Merge branch 'master' into update-framework 2022-11-26 16:19:36 +01:00
Menu Add minimal viable variant of new daily challenge screen 2024-06-10 13:09:12 +02:00
OnlinePlay Use room watching functionality to receive realtime daily challenge updates 2024-06-28 13:35:16 +02:00
Play Update HasFlag usages 2024-07-03 00:19:04 +09:00
Ranking Update HasFlag usages 2024-07-03 00:19:04 +09:00
Select Update HasFlag usages 2024-07-03 00:19:04 +09:00
SelectV2 Adjust calls to GetContainingInputManager() 2024-06-18 07:41:19 +02:00
Spectate Remove managed clocks from SpectatorSyncManager on gameplay completion / abort 2024-04-26 15:29:59 +08:00
Utility Adjust calls to GetContainingInputManager() 2024-06-18 07:41:19 +02:00
BackgroundScreen.cs Unload beatmap storyboard background when no longer present 2023-11-09 17:20:11 +03:00
BackgroundScreenStack.cs Use alternative method of scheduling storyboard unload 2023-11-16 15:37:53 +09:00
IHandlePresentBeatmap.cs Automated pass 2023-06-24 01:00:03 +09:00
IHasSubScreenStack.cs Automated pass 2023-06-24 01:00:03 +09:00
IOsuScreen.cs Move screen footer to OsuGame 2024-05-16 07:48:58 +03:00
IPerformFromScreenRunner.cs
Loader.cs Remove disclaimer screen completely 2023-12-28 17:21:29 +09:00
OsuScreen.cs Move screen footer to OsuGame 2024-05-16 07:48:58 +03:00
OsuScreenDependencies.cs
OsuScreenStack.cs Move screen footer to OsuGame 2024-05-16 07:48:58 +03:00
ScorePresentType.cs Remove redundant nullable suppression directives 2023-06-07 08:20:41 +03:00
ScreenWhiteBox.cs Partial everything 2022-11-27 00:00:27 +09:00
StartupScreen.cs Automated pass 2023-06-24 01:00:03 +09:00