mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交
This commit is contained in:
@@ -10,6 +10,7 @@ using Plugins.JNGame.Network.Util;
|
||||
using Plugins.JNGame.System;
|
||||
using Plugins.JNGame.Util;
|
||||
using UnityEngine;
|
||||
using Object = System.Object;
|
||||
|
||||
namespace Plugins.JNGame.Network
|
||||
{
|
||||
@@ -87,11 +88,6 @@ namespace Plugins.JNGame.Network
|
||||
List<Delegate> funs = _event.EventHandlers[$"{data.HId}"];
|
||||
funs.ForEach(fun =>
|
||||
{
|
||||
if (data.Bytes.Length <= 0)
|
||||
{
|
||||
((Action<IMessage>)fun)(null);
|
||||
return;
|
||||
}
|
||||
if(fun.Method.GetParameters().Length == 1 && typeof(IMessage).IsAssignableFrom(fun.Method.GetParameters()[0].ParameterType))
|
||||
{
|
||||
var type = fun.Method.GetParameters()[0].ParameterType;
|
||||
@@ -102,9 +98,17 @@ namespace Plugins.JNGame.Network
|
||||
if (methodInfo != null)
|
||||
{
|
||||
var message = methodInfo.Invoke(cType.GetValue(null), new object[] { data.Bytes });
|
||||
fun.Method.Invoke(fun.Target,new object[]{ message });
|
||||
fun.Method.Invoke(fun.Target,new []{ message });
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fun.Method.Invoke(fun.Target,new [] { (object)null });
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
fun.Method.Invoke(fun.Target,new object[]{ });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -115,6 +119,11 @@ namespace Plugins.JNGame.Network
|
||||
{
|
||||
_event.AddListener($"{hId}",listener);
|
||||
}
|
||||
|
||||
public void AddListener(int hId, global::System.Action listener)
|
||||
{
|
||||
_event.AddListener($"{hId}",listener);
|
||||
}
|
||||
|
||||
//删除外部监听
|
||||
public void RemoveListener<T>(int hId,Action<T> listener) where T : IMessage
|
||||
|
Reference in New Issue
Block a user