准备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");
}
}
}
}
+1
View File
@@ -4,6 +4,7 @@ namespace ECSTest
{
Unit,
Monster,
Bullet,
}
}
-21
View File
@@ -1,21 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace ECSTest
{
public class Main : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
TestEntityDataBlock.Run();
}
// Update is called once per frame
void Update()
{
}
}
}
-11
View File
@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 694d8256118344eb2b130fceb1a11b7f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
+18
View File
@@ -0,0 +1,18 @@
using Unity.Jobs;
namespace ECSTest.Server
{
public class GameLogic
{
public JobHandle Simulate(int beginFrameId, int frameCount, JobHandle dependency)
{
//TODO
return dependency;
}
private JobHandle Step(int frameId, JobHandle dependency)
{
return dependency;
}
}
}
+3
View File
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 51ab02ddeb9e4cdbb736075b2c7b43a8
timeCreated: 1765871132
+1 -1
View File
@@ -4,7 +4,7 @@ using Unity.Jobs;
using Unity.Networking.Transport;
using UnityEngine;
namespace ECSTest
namespace ECSTest.Server
{
[BurstCompile]
public struct ServerConnectionJob : IJob
@@ -0,0 +1,17 @@
using GameCore.TinyECS;
using Unity.Burst;
using Unity.Jobs;
namespace ECSTest.Server
{
[BurstCompile]
public struct SpawnBulletJob : IJob
{
public WorldManager worldManager;
public void Execute()
{
}
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 9cfef090e4d64e91bf319abd48fe7e18
timeCreated: 1765877986
+1 -1
View File
@@ -7,7 +7,7 @@ using Unity.Jobs;
using Unity.Networking.Transport;
using UnityEngine;
namespace ECSTest
namespace ECSTest.Server
{
public class ServerMain : MonoBehaviour
{
+1 -1
View File
@@ -4,7 +4,7 @@ using Unity.Jobs;
using Unity.Networking.Transport;
using UnityEngine;
namespace ECSTest
namespace ECSTest.Server
{
[BurstCompile]
public struct ServerReceiveJob : IJobParallelForDefer
+1 -1
View File
@@ -1,7 +1,7 @@
using Unity.Burst;
using Unity.Jobs;
namespace ECSTest
namespace ECSTest.Server
{
[BurstCompile]
public struct ServerSendJob : IJobParallelFor
+10
View File
@@ -0,0 +1,10 @@
using GameCore.TinyECS;
namespace ECSTest.Server
{
public struct WorldManager
{
public EntityCollection<EntityType> entities;
public EntityDataBlockChain chain;
}
}
@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 34167e4ecf924d05b9abd31eb2b2e464
timeCreated: 1765879427