mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2024-12-28 00:19:27 +00:00
fix api test mod
This commit is contained in:
parent
c06d73db09
commit
be23e80d51
@ -43,15 +43,15 @@ public class APITestMod : ModBehaviour
|
||||
|
||||
ModHelper.Console.WriteLine("Sending string message test...");
|
||||
qsbAPI.RegisterHandler<string>("apitest-string", MessageHandler);
|
||||
qsbAPI.SendMessage("apitest-string", "STRING MESSAGE", true);
|
||||
qsbAPI.SendMessage("apitest-string", "STRING MESSAGE", receiveLocally: true);
|
||||
|
||||
ModHelper.Console.WriteLine("Sending int message test...");
|
||||
qsbAPI.RegisterHandler<int>("apitest-int", MessageHandler);
|
||||
qsbAPI.SendMessage("apitest-int", 123, true);
|
||||
qsbAPI.SendMessage("apitest-int", 123, receiveLocally: true);
|
||||
|
||||
ModHelper.Console.WriteLine("Sending float message test...");
|
||||
qsbAPI.RegisterHandler<float>("apitest-float", MessageHandler);
|
||||
qsbAPI.SendMessage("apitest-float", 3.14f, true);
|
||||
qsbAPI.SendMessage("apitest-float", 3.14f, receiveLocally: true);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using OWML.Common;
|
||||
using System;
|
||||
using OWML.Common;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public interface IQSBAPI
|
||||
@ -58,8 +59,9 @@ public interface IQSBAPI
|
||||
/// <typeparam name="T">The type of the data being sent. This type must be serializable.</typeparam>
|
||||
/// <param name="messageType">The unique key of the message.</param>
|
||||
/// <param name="data">The data to send.</param>
|
||||
/// <param name="to">The player to send this message to. (0 is the host, uint.MaxValue means every player)</param>
|
||||
/// <param name="receiveLocally">If true, the action given to <see cref="RegisterHandler{T}"/> will also be called on the same client that is sending the message.</param>
|
||||
void SendMessage<T>(string messageType, T data, bool receiveLocally = false);
|
||||
void SendMessage<T>(string messageType, T data, uint to = uint.MaxValue, bool receiveLocally = false);
|
||||
|
||||
/// <summary>
|
||||
/// Registers an action to be called when a message is received.
|
||||
|
Loading…
Reference in New Issue
Block a user