Skip to content

refactor!: CustomMessageManager is no longer static #737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Apr 16, 2021

Conversation

TwoTenPvP
Copy link
Contributor

BREAKING CHANGE: Access CustomMessageManager with NetworkManager.Singleton.CustomMessageManager

{
private NetworkManager m_NetworkManager { get; }
Copy link
Contributor

@mattwalsh-unity mattwalsh-unity Apr 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idea for later refactor, since several classes all have this pattern of having their own m_NetworkManager, you could have a base class like "NetworkManagerBound" or something. You could then wrap the xtor, m_NetworkManager property, its getter and maybe more things in that. You could then put those in an array in the NetworkManager.cs file and then loop over them to null them out, vs having the list of if statements that have to be maintained.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good input. At least a field would be nice, but some classes already have constructors like noels RPC queues so I think those should be left.

networkManager.StartServer();

Debug.Assert(preManager == null);
Debug.Assert(networkManager.CustomMessagingManager != null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assuming you like the 'base class' idea above, then you could test all of the "NetworkManager-extended" classes in a loop here.

Base automatically changed from singleton-removal-message-handler to develop April 16, 2021 07:54
@TwoTenPvP TwoTenPvP merged commit 9dc01b0 into develop Apr 16, 2021
@TwoTenPvP TwoTenPvP deleted the singleton-removal-custom-message-manager branch April 16, 2021 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants