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

View File

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

View File

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

View File

@@ -187,7 +187,7 @@ namespace BITKit.UX
if (panelsLabel is null || currentPanelLabel is null || historyLabel is null) return; if (panelsLabel is null || currentPanelLabel is null || historyLabel is null) return;
panelsLabel.text=string.Join("\n",UXService.Panels); panelsLabel.text=string.Join("\n",UXService.Panels);
currentPanelLabel.text = string.Join("\n",UXService.CurrentPanel?.Index); 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 #endif

View File

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