Make CurrentPlaylistItem
non-bindable
#30592
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Prereqs:
CachedModelDependencyContainer
to cache models with non-bindable fields osu-framework#6416This is the first bindable in the chain that is really ugly and prone to breakage. It changes meaning depending on the context - while inside a
RoomSubScreen
its value comes fromRoomSubScreen.SelectedItem
, but outside it comes fromRoom.CurrentPlaylistItem
(the API source). SeeOnlinePlayComposite
for how this is done.I'm trying something new here which seems to work pretty well - replacing with implementations of the form:
The
required
attribute means implementations are explicit about needing this to be set. I'm not sure if I'll/probably won't do this for every other property inOnlinePlayComposite
, but it especially makes sense here since this governs a core part of multiplayer.Another notable change is
DrawableRoom
. When implemented asDrawableMatchRoom
, it takes its item from the subscreen. When implemented asDrawableLoungeRoom
, it takes its item from theRoom
. This was previously done in the baseDrawableRoom
implementation, but now the base class exposes aprotected
Bindable<PlaylistItem?>
, which is implemented in each case depending on the relevant data source.I'm not sure if this is the best implementation for this, because it could just as easily use a property or a method, or maybe another way. If there's any opinions, I'd love to hear them.
As for
Room.PropertyChanged
... The two methods I've added are what Rider suggests when implementing theINotifyPropertyChanged
interface and seem good to me. I'm not sure if this will stay around or if it will keep its current form, but I'm just simplifying things first with an ultimate goal of removingCachedModelDependencyContainer
andOnlinePlaySubscreen
, and then will figure out where this sort of signalling should go - may be nice to have a global source likeMultiplayerClient
events instead of inside the model but not sure yet.