This commit is contained in:
CortexCore
2024-06-08 10:07:40 +08:00
parent ccc9957809
commit b9731c20a1
11 changed files with 231 additions and 44 deletions

View File

@@ -1,11 +1,13 @@
using System;
using System.Data;
namespace BITKit.Net.Examples
{
public struct LogTime
{
public Guid Id;
public DateTime CreateTime;
#if NET5_0_OR_GREATER
#if NET5_0_OR_GREATER
public LogTime()
{
CreateTime=DateTime.Now;
@@ -13,5 +15,10 @@ namespace BITKit.Net.Examples
}
#endif
}
public struct SimplePing
{
public DateTime StartTime;
public DateTime EndTime;
}
}

View File

@@ -29,6 +29,11 @@ namespace BITKit
Message=6,
Heartbeat=7,
Ping=8,
GetFromServer=9,
GetFromClient=10,
ReciveFile=11,
ReturnToServer=12,
ReturnToClient=13,
}
/// <summary>
/// 网络提供服务包括了基础网络服务e.g
@@ -67,10 +72,9 @@ namespace BITKit
/// <summary>
/// 从服务端获取数据
/// </summary>
/// <param name="addressablePath">可寻址路劲 e.g. Key</param>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
UniTask<T> GetFromServer<T>(string addressablePath = Constant.System.Internal);
UniTask<T> GetFromServer<T>(T command = default);
/// <summary>
/// 从客户端获取数据
@@ -79,7 +83,7 @@ namespace BITKit
/// <param name="addressablePath">可寻址路劲 e.g. Key</param>
/// <typeparam name="T">远程指令类型</typeparam>
/// <returns></returns>
UniTask<T> GetFromClient<T>(int id, string addressablePath = Constant.System.Internal);
UniTask<T> GetFromClient<T>(int id,T command = default);
/// <summary>
/// 添加RPC远程服务服务类型为需要的方法标记[RPC]
@@ -93,13 +97,19 @@ namespace BITKit
/// <param name="handle">远程指令回调</param>
/// <typeparam name="T">远程指令类型</typeparam>
void AddCommandListener<T>(Action<T> handle);
/// <summary>
/// 监听远程func
/// </summary>
/// <param name="func"></param>
/// <typeparam name="T"></typeparam>
void AddCommandListener<T>(Func<T,T> func);
/// <summary>
/// 取消监听远程指令
/// </summary>
/// <param name="handle">远程指令回调</param>
/// <typeparam name="T">远程指令类型</typeparam>
void RemoveCommandListener<T>(Action<T> handle);
void RemoveCommandListener<T>(Func<T,T> func);
/// <summary>
/// 向服务端发送Rpc