This commit is contained in:
CortexCore 2024-06-16 17:55:29 +08:00
parent 22f318c8f6
commit 9186ab6e37
5 changed files with 13 additions and 8 deletions

View File

@ -123,6 +123,11 @@ namespace BITKit.Net
client.Tick();
await Task.Delay(100);
}
if (client.connected is false)
{
OnConnectedFailed?.Invoke();
}
return client.connected;
}
catch (Exception e)
@ -367,7 +372,8 @@ namespace BITKit.Net
}
return value.As<T>();
}
await Task.Delay(100);
await UniTask.Yield();
}
}

View File

@ -371,8 +371,8 @@ namespace BITKit.Net
var startTime = DateTime.Now;
while (true)
{
if(DateTime.Now-startTime>TimeSpan.FromSeconds(5) || server.connections.ContainsKey(id) is false)
throw new TimeoutException();
if(DateTime.Now-startTime>TimeSpan.FromSeconds(5))
throw new TimeoutException($"等待超时,Id:{id},时间{DateTime.Now-startTime}");
if (_p2p.TryRemove(index, out var value))
{
@ -382,7 +382,8 @@ namespace BITKit.Net
}
return (T)value;
}
await Task.Delay(100);
await UniTask.Yield();
}
}

View File

@ -187,7 +187,6 @@ namespace BITKit.Net.Kcp
Singleton = this;
client = new KcpNetClient();
client.OnConnectedFailed += Reconnect;
client.OnDisconnected += Reconnect;
}
private void Start()
{

View File

@ -187,7 +187,7 @@ namespace BITKit.UX
if (panelsLabel is null || currentPanelLabel is null || historyLabel is null) return;
panelsLabel.text=string.Join("\n",UXService.Panels);
currentPanelLabel.text = string.Join("\n",UXService.CurrentPanel?.Index);
historyLabel.text = string.Join("\n",UXService.History.Select(x=>x.Index));
historyLabel.text = string.Join("\n",UXService.History.Select(x=>x is null ? "Null" : x.Index));
}
}
#endif

View File

@ -189,8 +189,7 @@ namespace BITKit.GameEditor
Debug.LogException(e);
}
}
protected void RebuildList()
protected virtual void RebuildList()
{
List.Clear();
var paths = AssetDatabase.FindAssets($"t:{typeof(T).Name}");