This commit is contained in:
DESKTOP-5RP3AKU\Jisol
2024-10-17 02:12:03 +08:00
parent c85f350e0a
commit dd2e0e8a46
16 changed files with 52 additions and 611 deletions

View File

@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Cysharp.Threading.Tasks;
using DotRecast.Core.Collections;
using Google.Protobuf;
using JNGame.Network.Entity;
using JNGame.Network.Util;
@@ -92,10 +91,10 @@ namespace JNGame.Network
if (hId == 0)
{
int size = 0;
_byteSize.ForEach(child =>
foreach (var child in _byteSize)
{
size += child.Value;
});
}
return size;
}
return _byteSize.GetValueOrDefault(hId, 0);

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using DotRecast.Core.Collections;
using JNGame.Runtime.System;
using JNGame.Util;
@@ -61,10 +60,10 @@ namespace JNGame.Network
int size = 0;
try
{
_byteSize.ForEach(child =>
foreach (var child in _byteSize)
{
size += child.Value;
});
}
}
catch (Exception e)
{

View File

@@ -2,7 +2,6 @@
using System;
using System.Threading.Tasks;
using Cysharp.Threading.Tasks;
using DotRecast.Core.Collections;
using Google.Protobuf;
using JNGame.Network.Action;
using JNGame.Network.Entity;
@@ -142,13 +141,13 @@ namespace JNGame.Network
public void AllSend(int hId,IMessage data = null,Func<SocketClient,bool> filter = null)
{
filter ??= (SocketClient client) => true;
service.GetClients().ForEach(client =>
foreach (var client in service.GetClients())
{
if (filter(client))
{
Send(client, hId, data);
}
});
}
}
}