1
This commit is contained in:
@@ -118,6 +118,12 @@ namespace BITKit.Net
|
||||
|
||||
public async UniTask<bool> Connect(string address = "127.0.0.1", ushort port = 27014)
|
||||
{
|
||||
if (IsConnecting)
|
||||
{
|
||||
BIT4Log.Warning<KcpNetClient>("正在连接中");
|
||||
return false;
|
||||
}
|
||||
|
||||
//如果address是域名,解析为Ip
|
||||
if (address.Contains("."))
|
||||
{
|
||||
@@ -128,13 +134,13 @@ namespace BITKit.Net
|
||||
BIT4Log.Log<KcpNetClient>($"解析域名:{address}");
|
||||
}
|
||||
}
|
||||
|
||||
if (address is not "127.0.0.1")
|
||||
_connectedAddress = address;
|
||||
if (port is not 27014)
|
||||
_connectedPort = port;
|
||||
|
||||
|
||||
if (IsConnecting)
|
||||
{
|
||||
BIT4Log.Warning<KcpNetClient>("正在连接中");
|
||||
return false;
|
||||
}
|
||||
IsConnecting = true;
|
||||
if (client.connected) return false;
|
||||
await BITApp.SwitchToMainThread();
|
||||
|
@@ -325,7 +325,12 @@ namespace BITKit.Net
|
||||
{
|
||||
dynamic result = methodInfo.Invoke(handle, pars)!;
|
||||
|
||||
if (methodInfo.ReturnType == typeof(void) || methodInfo.ReturnType == typeof(UniTask))
|
||||
if (methodInfo.ReturnType == typeof(void)
|
||||
||
|
||||
methodInfo.ReturnType == typeof(UniTask)
|
||||
||
|
||||
methodInfo.ReturnType == typeof(UniTask<>)
|
||||
)
|
||||
{
|
||||
await result;
|
||||
value = -1;
|
||||
|
Reference in New Issue
Block a user