Table of Contents
Extensions for sending and receiving data in coop
public static class NKMultiGameInterfaceExt
Inheritance System.Object NKMultiGameInterfaceExt
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);
nkGi
Il2CppNinjaKiwi.NKMulti.NKMultiGameInterface
Convert messageBytes to an object of type T
public static T ReadMessage<T>(this NKMultiGameInterface nkGI, Il2CppStructArray<byte> messageBytes);
T
Type to convert bytes to
nkGI
Il2CppNinjaKiwi.NKMulti.NKMultiGameInterface
messageBytes
Il2CppInterop.Runtime.InteropTypes.Arrays.Il2CppStructArray
messageBytes
Convert a Message's bytes to an object of type T
public static T ReadMessage<T>(this NKMultiGameInterface nkGI, Message message);
T
Type to convert bytes to
nkGI
Il2CppNinjaKiwi.NKMulti.NKMultiGameInterface
message
Il2CppNinjaKiwi.NKMulti.Message
Message you want to read
Send a Message to all players in the lobby
public static void SendMessage(this NKMultiGameInterface nkGI, Message message);
nkGI
Il2CppNinjaKiwi.NKMulti.NKMultiGameInterface
message
Il2CppNinjaKiwi.NKMulti.Message
Message to send
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="");
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
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;
T
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
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="");
T
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