Skip to Main Content

BTD_Mod_Helper​.Extensions​.NKMultiGameInterfaceExt


BloonsTD6 Mod Helper

BTD_Mod_Helper.Extensions

NKMultiGameInterfaceExt Class

Extensions for sending and receiving data in coop

public static class NKMultiGameInterfaceExt

Inheritance System.Object  NKMultiGameInterfaceExt

Methods

NKMultiGameInterfaceExt.IsCoOpHost(this NKMultiGameInterface) Method

Returns true if the player is a host in a co-op game.
Works for both lobby and in-game.

public static bool IsCoOpHost(this NKMultiGameInterface nkGi);

Parameters

nkGi Il2CppNinjaKiwi.NKMulti.NKMultiGameInterface

Returns

System.Boolean

NKMultiGameInterfaceExt.ReadMessage(this NKMultiGameInterface, Il2CppStructArray) Method

Convert messageBytes to an object of type T

public static T ReadMessage<T>(this NKMultiGameInterface nkGI, Il2CppStructArray<byte> messageBytes);

Type parameters

T

Type to convert bytes to

Parameters

nkGI Il2CppNinjaKiwi.NKMulti.NKMultiGameInterface

messageBytes Il2CppInterop.Runtime.InteropTypes.Arrays.Il2CppStructArray

messageBytes

Returns

T

NKMultiGameInterfaceExt.ReadMessage(this NKMultiGameInterface, Message) Method

Convert a Message's bytes to an object of type T

public static T ReadMessage<T>(this NKMultiGameInterface nkGI, Message message);

Type parameters

T

Type to convert bytes to

Parameters

nkGI Il2CppNinjaKiwi.NKMulti.NKMultiGameInterface

message Il2CppNinjaKiwi.NKMulti.Message

Message you want to read

Returns

T

NKMultiGameInterfaceExt.SendMessage(this NKMultiGameInterface, Message) Method

Send a Message to all players in the lobby

public static void SendMessage(this NKMultiGameInterface nkGI, Message message);

Parameters

nkGI Il2CppNinjaKiwi.NKMulti.NKMultiGameInterface

message Il2CppNinjaKiwi.NKMulti.Message

Message to send

NKMultiGameInterfaceExt.SendMessage(this NKMultiGameInterface, String, Nullable, string) Method

Send a string to players or a player in the lobby

public static void SendMessage(this NKMultiGameInterface nkGI, String objectToSend, System.Nullable<byte> peerId=null, string code="");

Parameters

nkGI Il2CppNinjaKiwi.NKMulti.NKMultiGameInterface

objectToSend Il2CppSystem.String

string message to send. Can be JSON

peerId System.Nullable<System.Byte>

The id of the peer you want the message to go to. Leave null if you want to send to all players

code System.String

Coop code used to distinguish this message from others. Like a lock and key for reading messages

NKMultiGameInterfaceExt.SendMessage(this NKMultiGameInterface, T, Nullable, string) Method

Convert an object to json and send it players or a player in the lobby

public static void SendMessage<T>(this NKMultiGameInterface nkGI, T objectToSend, System.Nullable<byte> peerId=null, string code="")
    where T : Object;

Type parameters

T

Parameters

nkGI Il2CppNinjaKiwi.NKMulti.NKMultiGameInterface

objectToSend T

Object you want to send. The properties of the object will be serialised as JSON.

peerId System.Nullable<System.Byte>

The id of the peer you want the message to go to. Leave null if you want to send to all players

code System.String

Coop code used to distinguish this message from others. Like a lock and key for reading messages

NKMultiGameInterfaceExt.SendMessageEx(this NKMultiGameInterface, T, Nullable, string) Method

Convert an object to json and send it players or a player in the lobby

public static void SendMessageEx<T>(this NKMultiGameInterface nkGI, T objectToSend, System.Nullable<byte> peerId=null, string code="");

Type parameters

T

Parameters

nkGI Il2CppNinjaKiwi.NKMulti.NKMultiGameInterface

objectToSend T

Object you want to send. The properties of the object will be serialised as JSON.

peerId System.Nullable<System.Byte>

The id of the peer you want the message to go to. Leave null if you want to send to all players

code System.String

Coop code used to distinguish this message from others. Like a lock and key for reading messages

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