Minor documentation fix

This commit is contained in:
Sardelka
2022-07-02 18:30:16 +08:00
parent 17e1ae9ea9
commit e0c96cc200
5 changed files with 15 additions and 16 deletions

View File

@ -16,7 +16,7 @@ namespace RageCoop.Client.Scripting
/// </summary>
public int Hash { get; set; }
/// <summary>
/// Arguments
/// Supported types: byte, short, ushort, int, uint, long, ulong, float, bool, string, Vector3, Quaternion
/// </summary>
public List<object> Args { get; set; }
}
@ -223,8 +223,7 @@ namespace RageCoop.Client.Scripting
/// Send an event and data to the server.
/// </summary>
/// <param name="eventHash">An unique identifier of the event</param>
/// <param name="args">The objects conataing your data, supported types:
/// byte, short, ushort, int, uint, long, ulong, float, bool, string.</param>
/// <param name="args">The objects conataing your data, see <see cref="CustomEventReceivedArgs"/> for a list of supported types</param>
public static void SendCustomEvent(int eventHash, List<object> args)
{
var p = new Packets.CustomEvent()

View File

@ -8,12 +8,12 @@ namespace RageCoop.Client.Scripting
public abstract class ClientScript
{
/// <summary>
/// This method would be called from main thread shortly after all scripts have been loaded.
/// This method would be called from background thread, call <see cref="API.QueueAction(System.Action)"/> to dispatch it to main thread.
/// </summary>
public abstract void OnStart();
/// <summary>
/// This method would be called from main thread when the client disconnected from the server, you MUST terminate all background jobs/threads in this method.
/// This method would be called from background thread when the client disconnected from the server, you MUST terminate all background jobs/threads in this method.
/// </summary>
public abstract void OnStop();

View File

@ -206,7 +206,7 @@ namespace RageCoop.Server.Scripting
/// <param name="name">The name of the command (Example: "test" for "/test")</param>
/// <param name="usage">How to use this message (argsLength required!)</param>
/// <param name="argsLength">The length of args (Example: "/message USERNAME MESSAGE" = 2) (usage required!)</param>
/// <param name="callback">Create a new function!</param>
/// <param name="callback">A callback to invoke when the command received.</param>
public void RegisterCommand(string name, string usage, short argsLength, Action<CommandContext> callback)
{
Server.RegisterCommand(name, usage, argsLength, callback);
@ -215,7 +215,7 @@ namespace RageCoop.Server.Scripting
/// Register a new command chat command (Example: "/test")
/// </summary>
/// <param name="name">The name of the command (Example: "test" for "/test")</param>
/// <param name="callback">Create a new function!</param>
/// <param name="callback">A callback to invoke when the command received.</param>
public void RegisterCommand(string name, Action<CommandContext> callback)
{
Server.RegisterCommand(name, callback);
@ -249,7 +249,7 @@ namespace RageCoop.Server.Scripting
/// Send an event and data to the specified clients. Use <see cref="Client.SendCustomEvent(int, List{object})"/> if you want to send event to individual client.
/// </summary>
/// <param name="name">The name of the event, will be hashed to an int. For optimal performence, you should hash it in a static contructor inside the shared library, then call <see cref="SendCustomEvent(int, List{object}, List{Client})"/>.</param>
/// <param name="args">The objects conataing your data, supported types: byte, short, ushort, int, uint, long, ulong, float, bool, string.</param>
/// <param name="args">See <see cref="CustomEventReceivedArgs"/> for a list of supported types.</param>
/// <param name="targets">The target clients to send. Leave it null to send to all clients</param>
public void SendCustomEvent(string name, List<object> args = null, List<Client> targets = null)
{
@ -269,7 +269,7 @@ namespace RageCoop.Server.Scripting
/// Send an event and data to the specified clients. Use <see cref="Client.SendCustomEvent(int, List{object})"/> if you want to send event to individual client.
/// </summary>
/// <param name="eventHash">An unique identifier of the event, you can use <see cref="CustomEvents.Hash(string)"/> to get it from a string</param>
/// <param name="args">The objects conataing your data, supported types: byte, short, ushort, int, uint, long, ulong, float, bool, string.</param>
/// <param name="args">The objects conataing your data, see <see cref="Scripting.CustomEventReceivedArgs.Args"/> for supported types.</param>
/// <param name="targets">The target clients to send. Leave it null to send to all clients</param>
public void SendCustomEvent(int eventHash,List<object> args=null,List<Client> targets=null)
{
@ -288,7 +288,7 @@ namespace RageCoop.Server.Scripting
/// Register an handler to the specifed event hash, one event can have multiple handlers.
/// </summary>
/// <param name="hash">An unique identifier of the event, you can hash your event name with <see cref="Core.Scripting.CustomEvents.Hash(string)"/></param>
/// <param name="handler">An handler to be invoked when the event is received from the server. This will be invoked from main thread.</param>
/// <param name="handler">An handler to be invoked when the event is received from the server.</param>
public void RegisterCustomEventHandler(int hash,Action<CustomEventReceivedArgs> handler)
{
List<Action<CustomEventReceivedArgs>> handlers;

View File

@ -30,12 +30,14 @@ namespace RageCoop.Server.Scripting
/// The <see cref="Client"/> that triggered this event
/// </summary>
public Client Sender { get; set; }
/// <summary>
/// The event hash
/// </summary>
public int Hash { get; set; }
/// <summary>
/// The arguments of this event
/// Supported types: byte, short, ushort, int, uint, long, ulong, float, bool, string, Vector3, Quaternion, ServerPed, ServerVehicle, ServerProp
/// </summary>
public List<object> Args { get; set; }
}

View File

@ -24,7 +24,7 @@ namespace RageCoop.Server
/// <summary>
/// Pass the value as an argument in <see cref="Scripting.API.SendCustomEvent(int, List{object}, List{Client})"/> or <see cref="Client.SendCustomEvent(int, object[])"/> to convert this object to handle at client side.
/// Pass this as an argument in CustomEvent or NativeCall to convert this object to handle at client side.
/// </summary>
public Tuple<byte,byte[]> Handle
{
@ -83,9 +83,8 @@ namespace RageCoop.Server
}
/// <summary>
/// Pass the value as an argument in <see cref="Scripting.API.SendCustomEvent(int, List{object}, List{Client})"/> or <see cref="Client.SendCustomEvent(int, object[])"/> to convert this object to handle at client side.
/// Pass this as an argument in CustomEvent or NativeCall to convert this object to handle at client side.
/// </summary>
/// <returns></returns>
public Tuple<byte, byte[]> Handle
{
get
@ -141,9 +140,8 @@ namespace RageCoop.Server
}
/// <summary>
/// Pass the value as an argument in <see cref="Scripting.API.SendCustomEvent(int, List{object}, List{Client})"/> or <see cref="Client.SendCustomEvent(int, object[])"/> to convert this object to handle at client side.
/// Pass this as an argument in CustomEvent or NativeCall to convert this object to handle at client side.
/// </summary>
/// <returns></returns>
public Tuple<byte, byte[]> Handle
{
get{