public override void RegisterDependencies(ContainerBuilder containerBuilder) { base.RegisterDependencies(containerBuilder); containerBuilder.Register(c => SimulationWhitelist.ForServerSpawned).SingleInstance(); containerBuilder.Register(c => new SubnauticaServerProtobufSerializer("Assembly-CSharp", "Assembly-CSharp-firstpass", "NitroxModel", "NitroxModel-Subnautica")) .As <ServerProtobufSerializer>() .SingleInstance(); containerBuilder.RegisterType <SubnauticaEntitySpawnPointFactory>().As <EntitySpawnPointFactory>().SingleInstance(); ResourceAssets resourceAssets = ResourceAssetsParser.Parse(); containerBuilder.Register(c => resourceAssets).SingleInstance(); containerBuilder.Register(c => resourceAssets.WorldEntitiesByClassId).SingleInstance(); containerBuilder.Register(c => resourceAssets.PlaceholderPrefabsByGroupClassId).SingleInstance(); containerBuilder.RegisterType <SubnauticaUweWorldEntityFactory>().As <UweWorldEntityFactory>().SingleInstance(); SubnauticaUwePrefabFactory prefabFactory = new SubnauticaUwePrefabFactory(resourceAssets.LootDistributionsJson); containerBuilder.Register(c => prefabFactory).As <UwePrefabFactory>().SingleInstance(); Dictionary <TechTypeModel, IEntityBootstrapper> bootstrappersByTechType = new Dictionary <TechTypeModel, IEntityBootstrapper>(); bootstrappersByTechType[TechType.CrashHome.Model()] = new CrashFishBootstrapper(); bootstrappersByTechType[TechType.Reefback.Model()] = new ReefbackBootstrapper(); containerBuilder.Register(c => bootstrappersByTechType).SingleInstance(); }
private World CreateWorld(DateTime serverStartTime, EntityData entityData, BaseData baseData, VehicleData vehicleData, InventoryData inventoryData, PlayerData playerData, GameData gameData, List <Int3> ParsedBatchCells) { World world = new World(); world.TimeKeeper = new TimeKeeper(); world.TimeKeeper.ServerStartTime = serverStartTime; world.SimulationOwnership = new SimulationOwnership(); world.PlayerManager = new PlayerManager(playerData); world.EntityData = entityData; world.EventTriggerer = new EventTriggerer(world.PlayerManager); world.BaseData = baseData; world.VehicleData = vehicleData; world.InventoryData = inventoryData; world.PlayerData = playerData; world.GameData = gameData; ResourceAssets resourceAssets = ResourceAssetsParser.Parse(); world.BatchEntitySpawner = new BatchEntitySpawner(resourceAssets, ParsedBatchCells); return(world); }
public void LoadInto(ResourceAssets resourceAssets) { foreach (GameObjectAsset placeholderGroup in GameObjectAssetParser.GameObjectsByAssetId.Values) { List <AssetIdentifier> prefabPlaceholders; if (!PrefabPlaceholdersGroupParser.PrefabPlaceholderIdsByGameObjectId.TryGetValue(placeholderGroup.Identifier, out prefabPlaceholders)) { continue; } string placeholderGroupClassId = PrefabIdentifierParser.ClassIdByGameObjectId[placeholderGroup.Identifier]; List <PrefabAsset> spawnablePrefabs = new List <PrefabAsset>(); foreach (AssetIdentifier prefabPlaceholderId in prefabPlaceholders) { PrefabPlaceholderAsset prefabPlaceholderAsset = PrefabPlaceholderParser.PrefabPlaceholderIdToPlaceholderAsset[prefabPlaceholderId]; spawnablePrefabs.Add(CreatePrefabAsset(prefabPlaceholderAsset.GameObjectIdentifier, prefabPlaceholderAsset.ClassId)); } GameObjectAsset gameObject = GameObjectAssetParser.GameObjectsByAssetId[placeholderGroup.Identifier]; TransformAsset localTransform = GetTransform(gameObject); List <PrefabAsset> existingPrefabs = GetChildPrefabs(localTransform); resourceAssets.PrefabPlaceholderGroupsByGroupClassId[placeholderGroupClassId] = new PrefabPlaceholdersGroupAsset(spawnablePrefabs, existingPrefabs); } }
public void LoadInto(ResourceAssets resourceAssets) { foreach (GameObjectAsset placeholderGroup in GameObjectAssetParser.GameObjectsByAssetId.Values) { List <AssetIdentifier> prefabPlaceholders; if (!PrefabPlaceholdersGroupParser.PrefabPlaceholderIdsByGameObjectId.TryGetValue(placeholderGroup.Identifier, out prefabPlaceholders)) { continue; } string placeholderGroupClassId = PrefabIdentifierParser.ClassIdByGameObjectId[placeholderGroup.Identifier]; List <PrefabAsset> prefabs; if (!resourceAssets.PlaceholderPrefabsByGroupClassId.TryGetValue(placeholderGroupClassId, out prefabs)) { prefabs = new List <PrefabAsset>(); resourceAssets.PlaceholderPrefabsByGroupClassId[placeholderGroupClassId] = prefabs; } foreach (AssetIdentifier prefabPlaceholderId in prefabPlaceholders) { PrefabPlaceholderAsset prefabPlaceholderAsset = PrefabPlaceholderParser.PrefabPlaceholderIdToPlaceholderAsset[prefabPlaceholderId]; GameObjectAsset prefabPlaceholder = GameObjectAssetParser.GameObjectsByAssetId[prefabPlaceholderAsset.GameObjectIdentifier]; TransformAsset localTransform = GetTransform(prefabPlaceholder); prefabs.Add(new PrefabAsset(prefabPlaceholderAsset.ClassId, localTransform)); } } }
public BatchEntitySpawner(ResourceAssets resourceAssets) { worldEntitiesByClassId = resourceAssets.WorldEntitiesByClassId; batchCellsParser = new BatchCellsParser(); LootDistributionsParser lootDistributionsParser = new LootDistributionsParser(); lootDistributionData = lootDistributionsParser.GetLootDistributionData(resourceAssets.LootDistributionsJson); customBootstrappersByTechType[TechType.CrashHome] = new CrashFishBootstrapper(); }
public override bool Exists(UUID key) { if (m_Scene.TemporaryAssetService.Exists(key)) { return(true); } if (m_Scene.PersistentAssetService.Exists(key)) { return(true); } return(ResourceAssets.Exists(key)); }
public BatchEntitySpawner(ResourceAssets resourceAssets, List <Int3> loadedPreviousParsed) { parsedBatches = new HashSet <Int3>(loadedPreviousParsed); worldEntitiesByClassId = resourceAssets.WorldEntitiesByClassId; batchCellsParser = new BatchCellsParser(); LootDistributionsParser lootDistributionsParser = new LootDistributionsParser(); lootDistributionData = lootDistributionsParser.GetLootDistributionData(resourceAssets.LootDistributionsJson); customBootstrappersByTechType[TechType.CrashHome] = new CrashFishBootstrapper(); customBootstrappersByTechType[TechType.Reefback] = new ReefbackBootstrapper(); }
private World CreateWorld(DateTime serverStartTime, EntityData entityData, BaseData baseData, VehicleData vehicleData, InventoryData inventoryData, PlayerData playerData, GameData gameData, List <Int3> ParsedBatchCells, EscapePodData escapePodData, GameModeOption gameMode) { World world = new World(); world.TimeKeeper = new TimeKeeper(); world.TimeKeeper.ServerStartTime = serverStartTime; world.SimulationOwnershipData = new SimulationOwnershipData(); world.PlayerManager = new PlayerManager(playerData, config); world.EntityData = entityData; world.EventTriggerer = new EventTriggerer(world.PlayerManager); world.BaseData = baseData; world.VehicleData = vehicleData; world.InventoryData = inventoryData; world.PlayerData = playerData; world.GameData = gameData; world.EscapePodData = escapePodData; world.EscapePodManager = new EscapePodManager(escapePodData); world.EntitySimulation = new EntitySimulation(world.EntityData, world.SimulationOwnershipData, world.PlayerManager); world.GameMode = gameMode; ResourceAssets resourceAssets = ResourceAssetsParser.Parse(); world.BatchEntitySpawner = new BatchEntitySpawner(resourceAssets, ParsedBatchCells, serializer); Log.Info("World GameMode: " + gameMode); Log.Info("Server Password: "******"None. Public Server." : config.ServerPassword)); Log.Info("Admin Password: "******"To get help for commands, run help in console or /help in chatbox"); return(world); }
public override Dictionary <UUID, bool> Exists(List <UUID> assets) { Dictionary <UUID, bool> asset1 = m_Scene.TemporaryAssetService.Exists(assets); foreach (KeyValuePair <UUID, bool> kvp in m_Scene.PersistentAssetService.Exists(assets)) { if (kvp.Value) { asset1[kvp.Key] = true; } } foreach (KeyValuePair <UUID, bool> kvp in ResourceAssets.Exists(assets)) { if (kvp.Value) { asset1[kvp.Key] = true; } } return(asset1); }
public PacketHandler(PlayerManager playerManager, TimeKeeper timeKeeper, SimulationOwnership simulationOwnership) { this.playerManager = playerManager; defaultPacketProcessor = new DefaultServerPacketProcessor(playerManager); ResourceAssets resourceAssets = ResourceAssetsParser.Parse(); EntityData entityData = new EntityData(); Dictionary <Type, object> ProcessorArguments = new Dictionary <Type, object> { { typeof(PlayerManager), playerManager }, { typeof(TimeKeeper), timeKeeper }, { typeof(SimulationOwnership), simulationOwnership }, { typeof(EscapePodManager), new EscapePodManager() }, { typeof(EntityManager), new EntityManager(entityData, new BatchEntitySpawner(resourceAssets)) }, { typeof(EntitySimulation), new EntitySimulation(entityData, simulationOwnership) } }; authenticatedPacketProcessorsByType = PacketProcessor.GetProcessors(ProcessorArguments, p => p.BaseType.IsGenericType && p.BaseType.GetGenericTypeDefinition() == typeof(AuthenticatedPacketProcessor <>)); unauthenticatedPacketProcessorsByType = PacketProcessor.GetProcessors(ProcessorArguments, p => p.BaseType.IsGenericType && p.BaseType.GetGenericTypeDefinition() == typeof(UnauthenticatedPacketProcessor <>)); }
private World CreateWorld(DateTime serverStartTime, EntityData entityData, BaseData baseData, VehicleData vehicleData, InventoryData inventoryData, PlayerData playerData, GameData gameData, List <Int3> ParsedBatchCells, EscapePodData escapePodData, GameModeOption gameMode) { World world = new World(); world.TimeKeeper = new TimeKeeper(); world.TimeKeeper.ServerStartTime = serverStartTime; world.SimulationOwnershipData = new SimulationOwnershipData(); world.PlayerManager = new PlayerManager(playerData); world.EntityData = entityData; world.EventTriggerer = new EventTriggerer(world.PlayerManager); world.BaseData = baseData; world.VehicleData = vehicleData; world.InventoryData = inventoryData; world.PlayerData = playerData; world.GameData = gameData; world.EscapePodData = escapePodData; world.EscapePodManager = new EscapePodManager(escapePodData); world.EntitySimulation = new EntitySimulation(world.EntityData, world.SimulationOwnershipData, world.PlayerManager); world.GameMode = gameMode; ResourceAssets resourceAssets = ResourceAssetsParser.Parse(); world.BatchEntitySpawner = new BatchEntitySpawner(resourceAssets, ParsedBatchCells, serializer); Log.Info("World GameMode " + gameMode); Log.Info("Server Admin Password : "******" You can set your own password in the server config file or by using the /changepassword command"); return(world); }
bool IAssetDataServiceInterface.TryGetValue(UUID key, out Stream s) { if (m_Scene.TemporaryAssetService.Data.TryGetValue(key, out s)) { return(true); } if (m_Scene.PersistentAssetService.Data.TryGetValue(key, out s)) { return(true); } AssetData ad; if (ResourceAssets.TryGetValue(key, out ad)) { ad.Local = false; ad.Temporary = false; m_Scene.PersistentAssetService.Store(ad); s = new MemoryStream(ad.Data); return(true); } return(false); }
public override bool TryGetValue(UUID key, out AssetData assetData) { if (m_Scene.TemporaryAssetService.TryGetValue(key, out assetData)) { return(true); } if (m_Scene.PersistentAssetService.TryGetValue(key, out assetData)) { return(true); } if (ResourceAssets.TryGetValue(key, out assetData)) { assetData.Local = false; assetData.Temporary = false; m_Scene.PersistentAssetService.Store(assetData); return(true); } return(false); }
public override void RegisterDependencies(ContainerBuilder containerBuilder) { base.RegisterDependencies(containerBuilder); containerBuilder.Register(c => SimulationWhitelist.ForServerSpawned).SingleInstance(); containerBuilder.Register(c => new SubnauticaServerProtoBufSerializer( "Assembly-CSharp", "Assembly-CSharp-firstpass", "NitroxModel", "NitroxModel-Subnautica")) .As <ServerProtoBufSerializer, IServerSerializer>() .SingleInstance(); containerBuilder.Register(c => new SubnauticaServerJsonSerializer()) .As <ServerJsonSerializer, IServerSerializer>() .SingleInstance(); containerBuilder.RegisterType <SubnauticaEntitySpawnPointFactory>().As <EntitySpawnPointFactory>().SingleInstance(); ResourceAssets resourceAssets = ResourceAssetsParser.Parse(); containerBuilder.Register(c => resourceAssets).SingleInstance(); containerBuilder.Register(c => resourceAssets.WorldEntitiesByClassId).SingleInstance(); containerBuilder.Register(c => resourceAssets.PrefabPlaceholderGroupsByGroupClassId).SingleInstance(); containerBuilder.Register(c => resourceAssets.NitroxRandom).SingleInstance(); containerBuilder.RegisterType <SubnauticaUweWorldEntityFactory>().As <UweWorldEntityFactory>().SingleInstance(); SubnauticaUwePrefabFactory prefabFactory = new SubnauticaUwePrefabFactory(resourceAssets.LootDistributionsJson); containerBuilder.Register(c => prefabFactory).As <UwePrefabFactory>().SingleInstance(); containerBuilder.Register(c => new Dictionary <NitroxTechType, IEntityBootstrapper> { [TechType.CrashHome.ToDto()] = new CrashFishBootstrapper(), [TechType.Reefback.ToDto()] = new ReefbackBootstrapper(), [TechType.None.ToDto()] = new UntypedCellEntityBootstrapper() }).SingleInstance(); containerBuilder.RegisterType <SubnauticaMap>().As <IMap>().InstancePerLifetimeScope(); }
private World CreateWorld(DateTime serverStartTime, EntityData entityData, NitroxServer.GameLogic.Bases.BaseData baseData, VehicleData vehicleData, InventoryData inventoryData, PlayerData playerData, GameData gameData, List <Int3> parsedBatchCells, EscapePodData escapePodData, GameModeOption gameMode) { World world = new World(); world.TimeKeeper = new TimeKeeper(); world.TimeKeeper.ServerStartTime = serverStartTime; world.SimulationOwnershipData = new SimulationOwnershipData(); world.PlayerManager = new PlayerManager(playerData); world.EntityData = entityData; world.EventTriggerer = new EventTriggerer(world.PlayerManager); world.BaseData = baseData; world.VehicleData = vehicleData; world.InventoryData = inventoryData; world.PlayerData = playerData; world.GameData = gameData; world.EscapePodData = escapePodData; world.EscapePodManager = new EscapePodManager(escapePodData); world.EntitySimulation = new EntitySimulation(world.EntityData, world.SimulationOwnershipData, world.PlayerManager); world.GameMode = gameMode; ResourceAssets resourceAssets = ResourceAssetsParser.Parse(); world.BatchEntitySpawner = new BatchEntitySpawner(resourceAssets, parsedBatchCells); return(world); }
public override void Parse(AssetIdentifier identifier, AssetsFileReader reader, ResourceAssets resourceAssets) { MonoscriptAsset monoscriptAsset = new MonoscriptAsset(); monoscriptAsset.Name = reader.ReadCountStringInt32(); MonoscriptsByAssetId.Add(identifier, monoscriptAsset); }
public override void Parse(AssetIdentifier identifier, AssetsFileReader reader, ResourceAssets resourceAssets) { string assetName = reader.ReadCountStringInt32(); AssetParser textResourceParser; if (textParsersByAssetName.TryGetValue(assetName, out textResourceParser)) { textResourceParser.Parse(identifier, reader, resourceAssets); } }
public override void Parse(AssetIdentifier identifier, AssetsFileReader reader, ResourceAssets resourceAssets) { GameObjectAsset gameObjectAsset = new GameObjectAsset(); gameObjectAsset.Identifier = identifier; uint componentCount = reader.ReadUInt32(); for (int i = 0; i < componentCount; i++) { AssetIdentifier component = new AssetIdentifier(reader.ReadInt32(), reader.ReadInt64()); gameObjectAsset.Components.Add(component); } GameObjectsByAssetId.Add(identifier, gameObjectAsset); }
public override void Parse(AssetIdentifier identifier, AssetIdentifier gameObjectIdentifier, AssetsFileReader reader, ResourceAssets resourceAssets, Dictionary <int, string> relativeFileIdToPath) { string classId = reader.ReadCountStringInt32(); ClassIdByGameObjectId.Add(gameObjectIdentifier, classId); GameObjectIdByClassId.Add(classId, gameObjectIdentifier); }
public override void Parse(AssetIdentifier identifier, AssetsFileReader reader, ResourceAssets resourceAssets, Dictionary <int, string> relativeFileIdToPath) { MonoscriptAsset monoscriptAsset = new MonoscriptAsset(); monoscriptAsset.Name = reader.ReadCountStringInt32(); MonoscriptsByAssetId.Add(identifier, monoscriptAsset); }
public override void Parse(AssetIdentifier identifier, AssetsFileReader reader, ResourceAssets resourceAssets, Dictionary <int, string> relativeFileIdToPath) { string assetName = reader.ReadCountStringInt32(); if (textParsersByAssetName.TryGetValue(assetName, out AssetParser textResourceParser)) { textResourceParser.Parse(identifier, reader, resourceAssets, relativeFileIdToPath); } }
public override void Parse(AssetIdentifier identifier, AssetsFileReader reader, ResourceAssets resourceAssets, Dictionary <int, string> relativeFileIdToPath) { MonobehaviourAsset monobehaviour = new MonobehaviourAsset(); int fileId = reader.ReadInt32(); monobehaviour.GameObjectIdentifier = new AssetIdentifier(relativeFileIdToPath[fileId], reader.ReadInt64()); monobehaviour.Enabled = reader.ReadBoolean(); reader.Align(); monobehaviour.MonoscriptIdentifier = new AssetIdentifier(relativeFileIdToPath[reader.ReadInt32()], reader.ReadInt64()); monobehaviour.Name = reader.ReadCountStringInt32(); // Hack - If we have not yet loaded monoscripts then we are currently processing unit monobehaviours // that we do not care about. Monoscripts should be fully loaded before we actually parse anything // we do care about in resource.assets. If this becomes a problem later, we can do two passes and // load monobeahviours in the second pass. if (!MonoscriptAssetParser.MonoscriptsByAssetId.ContainsKey(monobehaviour.MonoscriptIdentifier)) { return; } MonoscriptAsset monoscript = MonoscriptAssetParser.MonoscriptsByAssetId[monobehaviour.MonoscriptIdentifier]; monobehaviour.MonoscriptName = monoscript.Name; if (monobehaviourParsersByMonoscriptName.TryGetValue(monoscript.Name, out MonobehaviourParser monoResourceParser)) { monoResourceParser.Parse(identifier, monobehaviour.GameObjectIdentifier, reader, resourceAssets, relativeFileIdToPath); } MonobehavioursByAssetId.Add(identifier, monobehaviour); }
public override void Parse(AssetIdentifier identifier, AssetsFileReader reader, ResourceAssets resourceAssets, Dictionary <int, string> relativeFileIdToPath) { TransformAsset transformAsset = new TransformAsset(); transformAsset.Identifier = identifier; transformAsset.GameObjectIdentifier = new AssetIdentifier(relativeFileIdToPath[reader.ReadInt32()], reader.ReadInt64()); transformAsset.LocalRotation = new NitroxQuaternion( reader.ReadSingle(), // Quaternion X reader.ReadSingle(), // Quaternion Y reader.ReadSingle(), // Quaternion Z reader.ReadSingle()); // Quaternion W transformAsset.LocalPosition = new NitroxVector3( reader.ReadSingle(), // Position X reader.ReadSingle(), // Position Y reader.ReadSingle()); // Position Z transformAsset.LocalScale = new NitroxVector3( reader.ReadSingle(), // Scale X reader.ReadSingle(), // Scale Y reader.ReadSingle()); // Scale Z // Children may be parsed out of order so we don't directly assign them to TransformAsset // instead, we rely on a call back to index ChildrenIdsByPatentId (same access pattern as // the other data structures throughout this process). List <AssetIdentifier> children = new List <AssetIdentifier>(); ChildrenIdsByParentId.Add(identifier, children); int childrenCount = reader.ReadInt32(); for (int i = 0; i < childrenCount; i++) { AssetIdentifier child = new AssetIdentifier(relativeFileIdToPath[reader.ReadInt32()], reader.ReadInt64()); ChildrenIdToParentId.Add(child, identifier); children.Add(child); } transformAsset.ParentIdentifier = new AssetIdentifier(relativeFileIdToPath[reader.ReadInt32()], reader.ReadInt64()); TransformsByAssetId.Add(identifier, transformAsset); }
public abstract void Parse(AssetIdentifier identifier, AssetIdentifier gameObjectIdentifier, AssetsFileReader reader, ResourceAssets resourceAssets);
public override void Parse(AssetIdentifier identifier, AssetsFileReader reader, ResourceAssets resourceAssets) { MonobehaviourAsset monobehaviour = new MonobehaviourAsset(); monobehaviour.GameObjectIdentifier = new AssetIdentifier((uint)reader.ReadInt32(), (ulong)reader.ReadInt64()); monobehaviour.Enabled = reader.ReadInt32(); // unknown but assume this is what it is monobehaviour.MonoscriptIdentifier = new AssetIdentifier((uint)reader.ReadInt32(), (ulong)reader.ReadInt64()); monobehaviour.Name = reader.ReadCountStringInt32(); // Hack - If we have not yet loaded monoscripts then we are currently processing unit monobehaviours // that we do not care about. Monoscripts should be fully loaded before we actually parse anything // we do care about in resource.assets. If this becomes a problem later, we can do two passes and // load monobeahviours in the second pass. if (!MonoscriptAssetParser.MonoscriptsByAssetId.ContainsKey(monobehaviour.MonoscriptIdentifier)) { return; } MonoscriptAsset monoscript = MonoscriptAssetParser.MonoscriptsByAssetId[monobehaviour.MonoscriptIdentifier]; monobehaviour.MonoscriptName = monoscript.Name; MonobehaviourParser monoResourceParser; if (monobehaviourParsersByMonoscriptName.TryGetValue(monoscript.Name, out monoResourceParser)) { monoResourceParser.Parse(identifier, monobehaviour.GameObjectIdentifier, reader, resourceAssets); } MonobehavioursByAssetId.Add(identifier, monobehaviour); }
public override void Parse(AssetIdentifier identifier, AssetIdentifier gameObjectIdentifier, AssetsFileReader reader, ResourceAssets resourceAssets) { int count = reader.ReadInt32(); // Array Count string[] allowedTypes = new string[count]; for (int i = 0; i < count; i++) { allowedTypes[i] = ((EntitySlot.Type)reader.ReadInt32()).ToString(); } string biomeType = ((BiomeType)reader.ReadInt32()).AsString(); // Yes EntitySlotsByIdentifier.Add(gameObjectIdentifier, new NitroxEntitySlot(biomeType, allowedTypes)); }
public override void Parse(AssetIdentifier identifier, AssetsFileReader reader, ResourceAssets resourceAssets) { TransformAsset transformAsset = new TransformAsset(); transformAsset.Identifier = identifier; reader.Position += 12; transformAsset.LocalRotation = new NitroxQuaternion( reader.ReadSingle(), // Quaternion X reader.ReadSingle(), // Quaternion Y reader.ReadSingle(), // Quaternion Z reader.ReadSingle()); // Quaternion W transformAsset.LocalPosition = new NitroxVector3( reader.ReadSingle(), // Position X reader.ReadSingle(), // Position Y reader.ReadSingle()); // Position Z transformAsset.LocalScale = new NitroxVector3( reader.ReadSingle(), // Scale X reader.ReadSingle(), // Scale Y reader.ReadSingle()); // Scale Z int childrenCount = reader.ReadInt32(); for (int i = 0; i < childrenCount; i++) { AssetIdentifier child = new AssetIdentifier(reader.ReadInt32(), reader.ReadInt64()); ChildrenIdToParentId.Add(child, identifier); } transformAsset.ParentIdentifier = new AssetIdentifier(reader.ReadInt32(), reader.ReadInt64()); TransformsByAssetId.Add(identifier, transformAsset); }
public override void Parse(AssetIdentifier identifier, AssetIdentifier gameObjectIdentifier, AssetsFileReader reader, ResourceAssets resourceAssets, Dictionary <int, string> relativeFileIdToPath) { PrefabPlaceholderAsset prefabPlaceholderAsset = new PrefabPlaceholderAsset(); prefabPlaceholderAsset.Identifier = identifier; prefabPlaceholderAsset.GameObjectIdentifier = gameObjectIdentifier; prefabPlaceholderAsset.ClassId = reader.ReadCountStringInt32(); PrefabPlaceholderIdToPlaceholderAsset.Add(identifier, prefabPlaceholderAsset); }
public abstract void Parse(AssetIdentifier identifier, AssetsFileReader reader, ResourceAssets resourceAssets, Dictionary <int, string> relativeFileIdToPath);
public override void Parse(AssetIdentifier identifier, AssetsFileReader reader, ResourceAssets resourceAssets, Dictionary <int, string> relativeFileIdToPath) { GameObjectAsset gameObjectAsset = new GameObjectAsset(); gameObjectAsset.Identifier = identifier; uint componentCount = reader.ReadUInt32(); for (int i = 0; i < componentCount; i++) { AssetIdentifier component = new AssetIdentifier(relativeFileIdToPath[reader.ReadInt32()], reader.ReadInt64()); gameObjectAsset.Components.Add(component); } reader.ReadUInt32(); // Layer (not used) int length = reader.ReadInt32(); gameObjectAsset.Name = reader.ReadStringLength(length); GameObjectsByAssetId.Add(identifier, gameObjectAsset); }