30 lines
747 B
C#
30 lines
747 B
C#
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using NUnit.Framework;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.TestTools;
|
||
|
using Newtonsoft.Json;
|
||
|
using System.Reflection;
|
||
|
using System.IO;
|
||
|
using BITKit.IO;
|
||
|
using System.Text;
|
||
|
namespace BITKit
|
||
|
{
|
||
|
public class GenericEventTest
|
||
|
{
|
||
|
[Test]
|
||
|
public void TestInvokeByType()
|
||
|
{
|
||
|
GenericEvent genericEvent = new();
|
||
|
genericEvent.AddListener<string>(OnGetString);
|
||
|
|
||
|
genericEvent.Invoke<string>("Value 123");
|
||
|
genericEvent.Invoke(typeof(string).Name, "Value 321" as object);
|
||
|
void OnGetString(string value)
|
||
|
{
|
||
|
Debug.Log($"事件回调:{value}");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|