-
-
Notifications
You must be signed in to change notification settings - Fork 949
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
refactor: Component rebalancing is now performed via a global queue #2352
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good stuff! This should make it quite easy to introduce global priorities too right?
} | ||
} | ||
|
||
/// Usually this is not something that the user would want to call since the | ||
/// component list isn't re-ordered when it is called. | ||
/// See FlameGame.changePriority instead. | ||
@Deprecated('Will be removed in 1.8.0. Use priority setter instead.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥳
Nice, so much cleaner without this!
} | ||
} | ||
import '../custom_component.dart'; | ||
// ignore_for_file: deprecated_member_use_from_same_package |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does it use that is deprecated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it's mostly calls like game.children.changePriority(firstComponent, 11);
. Some time later we will refactor the test file to use more straightforward firstComponent.priority = 11;
, but for now I wanted to leave everything mostly as-is to ensure that the change is non-breaking.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one comment
Description
This PR ensures that all component rebalancing operations are resolved from a single location, after the
update
stage but before therender
stage (thus, components may get reordered during the update, and these changes will go into effect during the rendering step on the same game tick).This also fixes the problem where the child changing the priorities of its parent would cause a ConcurrentModificationError.
A number of methods that were used to handle rebalancing are now marked as deprecated. From the user's perspective, the only API they should be using is the
.priority
setter.Checklist
docs
and added dartdoc comments with///
.examples
ordocs
.Breaking Change?
Related Issues
Closes #2263