Пример #1
0
 private LayoutInfo GetLayoutInfo(SerializedFileScheme serialized)
 {
     if (SerializedFileMetadata.HasPlatform(serialized.Header.Version))
     {
         SerializedFileMetadata metadata = serialized.Metadata;
         return(new LayoutInfo(metadata.UnityVersion, metadata.TargetPlatform, serialized.Flags));
     }
     else
     {
         const Platform DefaultPlatform = Platform.StandaloneWinPlayer;
         const TransferInstructionFlags DefaultFlags = TransferInstructionFlags.SerializeGameRelease;
         BundleFileScheme bundle = GetBundleFile();
         if (bundle == null)
         {
             Logger.Log(LogType.Warning, LogCategory.Import, "Unable to determine layout for provided files. Tring default one");
             Version version = GetDefaultGenerationVersions(serialized.Header.Version);
             return(new LayoutInfo(version, DefaultPlatform, DefaultFlags));
         }
         else
         {
             Logger.Log(LogType.Warning, LogCategory.Import, "Unable to precisly determine layout for provided files. Tring default one");
             return(new LayoutInfo(bundle.Header.EngineVersion, DefaultPlatform, DefaultFlags));
         }
     }
 }
        private static AssetLayout GetLayout(GameCollection collection, SerializedFileScheme scheme, string name)
        {
            if (!SerializedFileMetadata.HasPlatform(scheme.Header.Version))
            {
                return(collection.Layout);
            }
            if (FilenameUtils.IsDefaultResource(name))
            {
                return(collection.Layout);
            }

            LayoutInfo info = new LayoutInfo(scheme.Metadata.UnityVersion, scheme.Metadata.TargetPlatform, scheme.Flags);

            return(collection.GetLayout(info));
        }
Пример #3
0
        private void UpdateFlags()
        {
            Flags = TransferInstructionFlags.SerializeGameRelease;
            if (SerializedFileMetadata.HasPlatform(Header.Version))
            {
                if (Metadata.TargetPlatform == Platform.NoTarget)
                {
                    Flags = TransferInstructionFlags.NoTransferInstructionFlags;
                    if (FilePath.EndsWith(".unity", StringComparison.Ordinal))
                    {
                        Flags |= TransferInstructionFlags.SerializeEditorMinimalScene;
                    }
                }
            }

            if (FilenameUtils.IsEngineResource(Name) || Header.Version < FormatVersion.Unknown_10 && FilenameUtils.IsBuiltinExtra(Name))
            {
                Flags |= TransferInstructionFlags.IsBuiltinResourcesFile;
            }
            if (Header.Endianess || Metadata.SwapEndianess)
            {
                Flags |= TransferInstructionFlags.SwapEndianess;
            }
        }