Skip to Main Content

BTD_Mod_Helper​.Api​.Coop​.MessageUtils


BloonsTD6 Mod Helper

BTD_Mod_Helper.Api.Coop

MessageUtils Class

Utility functions used for sending messages over the network.

public class MessageUtils

Inheritance System.Object  MessageUtils

Methods

MessageUtils.CreateMessage(T, string) Method

Old way to send a message

public static Message CreateMessage<T>(T objectToSend, string code="")
    where T : Object;

Type parameters

T

Parameters

objectToSend T

code System.String

Returns

Il2CppNinjaKiwi.NKMulti.Message

MessageUtils.CreateMessageEx(T, string) Method

Creates a message to be sent over the network.
The message will be serialized as JSON.

public static Message CreateMessageEx<T>(T objectToSend, string code="");

Type parameters

T

Parameters

objectToSend T

The object to be sent. The object's properties will be serialized.

code System.String

Unique code for your specific message.

Returns

Il2CppNinjaKiwi.NKMulti.Message

MessageUtils.ReadMessage(Il2CppStructArray) Method

Reads a message sent from the network.
Assumes message is sent as JSON. (via CreateMessageEx<T>(T, string))

public static T ReadMessage<T>(Il2CppStructArray<byte> serializedMessage);

Type parameters

T

Parameters

serializedMessage Il2CppInterop.Runtime.InteropTypes.Arrays.Il2CppStructArray

Raw bytes received from the network.

Returns

T

MessageUtils.ReadMessage(Message) Method

Reads a message sent from the network.
Assumes message is sent as JSON. (via CreateMessageEx<T>(T, string))

public static T ReadMessage<T>(Message message);

Type parameters

T

Parameters

message Il2CppNinjaKiwi.NKMulti.Message

Message received from the network.

Returns

T

To learn how to download BTD Mod Helper and install mods, click here