예제 #1
0
        void ApplyChangeSet(EntityChangeSetSerialization.ResourcePacket resourcePacket)
        {
            var changeSet = LiveLinkChangeSet.Deserialize(resourcePacket, LiveLinkPlayerAssetRefreshSystem.GlobalAssetObjectResolver);

            m_Patcher.ApplyPatch(changeSet);
            changeSet.Dispose();
        }
예제 #2
0
        void ReceiveEntityChangeSet(MessageEventArgs args)
        {
            var resourcePacket = new EntityChangeSetSerialization.ResourcePacket(args.data);

            LiveLinkMsg.LogReceived($"EntityChangeSet patch: '{args.data.Length}' bytes, " +
                                    $"object GUIDs: {resourcePacket.GlobalObjectIds.ToDebugString(id => id.AssetGUID.ToString())}");

            m_ResourcePacketQueue.Enqueue(resourcePacket);
        }
        unsafe public static LiveLinkChangeSet Deserialize(EntityChangeSetSerialization.ResourcePacket resource, GlobalAssetObjectResolver resolver)
        {
            var reader = resource.ChangeSet.AsReader();

            LiveLinkChangeSet changeSet;
            changeSet.Changes = EntityChangeSetSerialization.Deserialize(&reader, resource.GlobalObjectIds, resolver);
            reader.ReadNext(out changeSet.SceneGUID);
            reader.ReadNext(out changeSet.SceneName);
            reader.ReadNext(out changeSet.UnloadAllPreviousEntities);

            return changeSet;
        }
예제 #4
0
        bool IsResourceReady(EntityChangeSetSerialization.ResourcePacket packet)
        {
            var entityChangeSetWithResources = packet;
            var resourceGuids = entityChangeSetWithResources.GlobalObjectIds;

            var guidResourceReady = new NativeHashMap <Entities.Hash128, byte>(m_Resources.CalculateEntityCount(), Allocator.Persistent);

            new BuildResourceMapJob
            {
                ResourceLoaded    = GetComponentDataFromEntity <ResourceLoaded>(),
                GuidResourceReady = guidResourceReady
            }.Run(m_Resources);

            var isResourceReady = true;
            var archetype       = EntityManager.CreateArchetype(typeof(ResourceGUID));

            for (int i = 0; i < resourceGuids.Length; i++)
            {
                var guid  = resourceGuids[i].AssetGUID;
                var found = guidResourceReady.ContainsKey(guid);
                if (!found)
                {
                    guidResourceReady.TryAdd(guid, 0);

                    var entity = EntityManager.CreateEntity(archetype);
                    EntityManager.SetComponentData(entity, new ResourceGUID
                    {
                        Guid = guid
                    });
                }

                var ready = guidResourceReady[guid] == 1;
                if (!ready)
                {
                    isResourceReady = false;
                }
            }

            guidResourceReady.Dispose();
            return(isResourceReady);
        }