parent
5c4c25664d
commit
6256dcb52b
19 changed files with 307 additions and 141 deletions
@ -1,15 +1,37 @@ |
||||
using Unity.Burst; |
||||
using Unity.Collections; |
||||
using Unity.Jobs; |
||||
using Unity.Networking.Transport; |
||||
using UnityEngine; |
||||
|
||||
using Unity.Burst; |
||||
using Unity.Jobs; |
||||
using Unity.Networking.Transport; |
||||
|
||||
namespace ECSTest |
||||
{ |
||||
[BurstCompile] |
||||
public struct ServerReceiveJob : IJobParallelForDefer |
||||
{ |
||||
public NetworkDriver.Concurrent driver; |
||||
[ReadOnly] |
||||
public NativeList<NetworkConnection> connectionList; |
||||
public NativeList<int>.ParallelWriter disconnectIndexList; |
||||
|
||||
public void Execute(int index) |
||||
{ |
||||
var connection = connectionList[index]; |
||||
|
||||
NetworkEvent.Type cmd; |
||||
while ((cmd = driver.PopEventForConnection(connection, out var stream)) != |
||||
NetworkEvent.Type.Empty) |
||||
{ |
||||
if (cmd == NetworkEvent.Type.Data) |
||||
{ |
||||
//TODO |
||||
} |
||||
else if (cmd == NetworkEvent.Type.Disconnect) |
||||
{ |
||||
disconnectIndexList.AddNoResize(index); |
||||
Debug.Log("[Server] Received a disconnection"); |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
@ -1,12 +1,13 @@ |
||||
using Unity.Burst; |
||||
using Unity.Jobs; |
||||
|
||||
using Unity.Burst; |
||||
using Unity.Jobs; |
||||
|
||||
namespace ECSTest |
||||
{ |
||||
[BurstCompile] |
||||
public struct ServerSendJob : IJobParallelFor |
||||
{ |
||||
public void Execute(int index) |
||||
{ |
||||
|
||||
} |
||||
} |
||||
} |
||||
@ -1,19 +0,0 @@ |
||||
using System; |
||||
using Unity.Burst; |
||||
using Unity.Collections; |
||||
using Unity.Collections.LowLevel.Unsafe; |
||||
using Unity.Jobs; |
||||
using Unity.Mathematics; |
||||
using UnityEngine; |
||||
|
||||
namespace GameCore.Test |
||||
{ |
||||
[BurstCompile] |
||||
public struct TestJob : IJobParallelFor |
||||
{ |
||||
public void Execute(int index) |
||||
{ |
||||
|
||||
} |
||||
} |
||||
} |
||||
@ -1,11 +0,0 @@ |
||||
fileFormatVersion: 2 |
||||
guid: 68aafcef1265449e6b6b2dd81d7173a8 |
||||
MonoImporter: |
||||
externalObjects: {} |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
||||
Loading…
Reference in new issue