FriendBroadcasts - jimdroberts/FishMMO GitHub Wiki
Defines broadcast structures for character friend list actions, including adding, removing, and bulk updating friends. Used for networked communication of friend list changes between client and server.
-
public struct FriendAddNewBroadcast : IBroadcast
Broadcast for adding a new friend to a character's friend list. Contains the character ID of the new friend.
- long CharacterID: Character ID of the new friend to add.
-
public struct FriendAddBroadcast : IBroadcast
Broadcast for adding a friend to the friend list, including online status.
- long CharacterID: Character ID of the friend to add.
- bool Online: Whether the friend is currently online.
-
public struct FriendAddMultipleBroadcast : IBroadcast
Broadcast for adding multiple friends to the friend list at once. Used for bulk friend addition or synchronization.
- List Friends: List of friends to add.
-
public struct FriendRemoveBroadcast : IBroadcast
Broadcast for removing a friend from the friend list. Contains the character ID of the friend to remove.
- long CharacterID: Character ID of the friend to remove.
- Use these broadcast structs to send and receive friend list actions between client and server.
- Populate the fields as required for each friend operation (add, remove, bulk, etc.).
// Example 1: Adding a new friend
FriendAddNewBroadcast addNew = new FriendAddNewBroadcast {
CharacterID = 12345
};
networkManager.ClientManager.Broadcast(addNew);
// Example 2: Removing a friend
FriendRemoveBroadcast remove = new FriendRemoveBroadcast {
CharacterID = 12345
};
networkManager.ClientManager.Broadcast(remove);
- Always validate character IDs before sending or processing broadcasts.
- Use bulk updates for efficient synchronization of large friend lists.
- Keep friend list logic modular and well-documented for maintainability.
- Use the provided broadcast structs for clear, type-safe network communication.