准备server gamelogic

This commit is contained in:
sunqinzhe committed 2025-12-16 18:47:56 +08:00
1 parent 6256dcb52b
commit 6d912005a5
17 files changed
+126 -44

No files matched your search

+9 -2
View File
@@ -42,9 +42,16 @@ namespace ECSTest
{
jobHandle.Complete();
//TODO Render()
jobHandle = driver.ScheduleUpdate();
jobHandle = new ClientUpdateJob()
{
driver = driver,
unreliablePipeline = unreliablePipeline,
reliablePipeline = reliablePipeline,
connection = connection,
}.Schedule(jobHandle);
}
}
}
+18 -1
View File
@@ -2,6 +2,7 @@
using Unity.Collections;
using Unity.Jobs;
using Unity.Networking.Transport;
using UnityEngine;
namespace ECSTest
{
@@ -15,11 +16,27 @@ namespace ECSTest
public void Execute()
{
if (connection.Value == default)
return;
NetworkEvent.Type cmd;
while ((cmd = connection.Value.PopEvent(driver, out var stream, out var networkPipeline)) !=
NetworkEvent.Type.Empty)
{
if (cmd == NetworkEvent.Type.Data)
{
//TODO
}
else if (cmd == NetworkEvent.Type.Connect)
{
Debug.Log("[Client] Connected to server");
//TODO
}
else if (cmd == NetworkEvent.Type.Disconnect)
{
connection.Value = default;
Debug.Log("[Client] Disconnected to server");
}
}
}
}