完善NetDatabase

This commit is contained in:
sunqinzhe committed 2025-12-31 18:45:01 +08:00
1 parent 098cbfb696
commit 88125fc128
28 files changed
+771 -39

No files matched your search

+45
View File
@@ -354,6 +354,50 @@ MonoBehaviour:
m_EditorClassIdentifier:
address: 127.0.0.1
driverAsset: {fileID: 11400000, guid: a8a5562854ecf4cc1a49700e8bd93c19, type: 2}
--- !u!1 &1633746920
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1633746922}
- component: {fileID: 1633746921}
m_Layer: 0
m_Name: Tests
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1633746921
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1633746920}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dae5c80c53134e4689ce1b03af81f96e, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!4 &1633746922
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1633746920}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1936170114
GameObject:
m_ObjectHideFlags: 0
@@ -408,3 +452,4 @@ SceneRoots:
- {fileID: 705507995}
- {fileID: 1936170116}
- {fileID: 1613085078}
- {fileID: 1633746922}
+4 -6
View File
@@ -33,14 +33,12 @@ namespace ECSTest.Server
disconnectIndexList = new NativeList<int>(16, Allocator.Persistent);
var cannonMeta = EntityDataBlockMeta.Create<CannonData>();
world.cannonDatabase =
new EntityDatabase<EntityType, EntityDataBlockChain>(EntityType.Cannon,
new EntityDataBlockChain(cannonMeta));
var cannonDataBlockChain = new EntityDataBlockChain(cannonMeta, Allocator.Persistent);
world.cannonDatabase = cannonDataBlockChain.CreateEntityDatabase(EntityType.Cannon, 16);
var bulletMeta = EntityDataBlockMeta.Create<BulletData>();
world.bulletDatabase =
new EntityDatabase<EntityType, EntityDataBlockChain>(EntityType.Bullet,
new EntityDataBlockChain(bulletMeta));
var bulletDataBlockChain = new EntityDataBlockChain(bulletMeta, Allocator.Persistent);
world.bulletDatabase = bulletDataBlockChain.CreateEntityDatabase(EntityType.Bullet, 16);
}
private void OnDisable()
+2 -1
View File
@@ -1,4 +1,5 @@
using GameCore.TinyECS;
using Unity.Collections;
using UnityEngine;
namespace ECSTest
@@ -8,7 +9,7 @@ namespace ECSTest
public static void Run()
{
var meta = EntityDataBlockMeta.Create<TransformData, StateData>();
using var blockChain = new EntityDataBlockChain(meta, 1000);
using var blockChain = new EntityDataBlockChain(meta, Allocator.Persistent, 1000);
blockChain.Add();
ref var stateData = ref blockChain.GetDataRef<StateData>(0);