Merge remote-tracking branch 'origin/master' into 2021.11.9

This commit is contained in:
js6pak committed 2021-12-03 00:52:46 +01:00
commit bc9b8ea8a2
2 files changed
+6 -3

No files matched your search

+4 -2
View File
@@ -18,11 +18,12 @@ namespace Reactor.Networking.MethodRpc
{
public delegate object HandleDelegate(InnerNetObject innerNetObject, object[] args);
public MethodRpc(BasePlugin plugin, MethodInfo method, uint id, SendOption option, RpcLocalHandling localHandling) : base(plugin, id)
public MethodRpc(BasePlugin plugin, MethodInfo method, uint id, SendOption option, RpcLocalHandling localHandling, bool sendImmediately) : base(plugin, id)
{
Method = method;
LocalHandling = localHandling;
SendOption = option;
SendImmediately = sendImmediately;
if (!method.IsStatic)
{
@@ -56,6 +57,7 @@ namespace Reactor.Networking.MethodRpc
public override Type InnerNetObjectType { get; }
public override RpcLocalHandling LocalHandling { get; }
public override SendOption SendOption { get; }
public bool SendImmediately { get; }
public override void UnsafeWrite(MessageWriter writer, object? data)
{
@@ -82,7 +84,7 @@ namespace Reactor.Networking.MethodRpc
public void Send(InnerNetObject innerNetObject, object[] args)
{
UnsafeSend(innerNetObject, args);
UnsafeSend(innerNetObject, args, SendImmediately);
}
private static readonly MethodInfo _sendMethod = AccessTools.Method(typeof(MethodRpc), nameof(Send));
@@ -13,6 +13,7 @@ namespace Reactor.Networking.MethodRpc
public uint Id { get; }
public SendOption Option { get; set; } = SendOption.Reliable;
public RpcLocalHandling LocalHandling { get; set; } = RpcLocalHandling.Before;
public bool SendImmediately { get; set; }
public MethodRpcAttribute(uint id)
{
@@ -34,7 +35,7 @@ namespace Reactor.Networking.MethodRpc
try
{
var customRpc = new MethodRpc(plugin, method, attribute.Id, attribute.Option, attribute.LocalHandling);
var customRpc = new MethodRpc(plugin, method, attribute.Id, attribute.Option, attribute.LocalHandling, attribute.SendImmediately);
PluginSingleton<ReactorPlugin>.Instance.CustomRpcManager.Register(customRpc);
}
catch (Exception e)