Exemplo n.º 1
0
            public bool VerifyPrediction(uint tick)
            {
                foreach (var predictedDataHandler in PredictedArray)
                {
                    if (!predictedDataHandler.VerifyPrediction(tick))
                    {
                        FSLog.Warning($"verify fail:{predictedDataHandler.GetTypeName()},tick:{tick}");
                        return(false);
                    }
                }


                return(true);
            }
Exemplo n.º 2
0
        protected override void OnUpdate()
        {
            if (isInit)
            {
                return;
            }
            isInit = true;

            var query    = GetEntityQuery(typeof(ReplicatedEntityData));
            var entities = query.ToEntityArray(Allocator.TempJob);

            // FSLog.Info($"entities.Length:{entities.Length}");

            var entityList = entities.ToList();

            entityList.Sort((a, b) =>
            {
                var sa = EntityManager.GetComponentData <ReplicatedEntityData>(a).NetId;
                var sb = EntityManager.GetComponentData <ReplicatedEntityData>(b).NetId;

                return(sa.CompareTo(sb));
            });


            for (var i = 0; i < entityList.Count; ++i)
            {
                var entity = entityList[i];
                var replicatedEntityData = EntityManager.GetComponentData <ReplicatedEntityData>(entity);
                replicatedEntityData.Id = i;
                EntityManager.SetComponentData(entity, replicatedEntityData);

                var trans = EntityManager.GetComponentData <Translation>(entity);
                FSLog.Info($"SceneEntities,id:{i},netId:{replicatedEntityData.NetId},trans:{trans.Value}");
            }

            SceneEntities.AddRange(entityList);
            FSLog.Info($"SceneEntities.count:{SceneEntities.Count}");

            entities.Dispose();
        }
Exemplo n.º 3
0
        public void RegisterFactory(ushort typeId, ReplicatedEntityFactory typeFactory)
        {
            factories[typeId] = typeFactory;

            FSLog.Info(($"RegisterFactory,typeId:{typeId},factories size:{factories.Count}"));
        }