當前位置: 首頁>>代碼示例>>C#>>正文


C# Assets.PackageLoadingAssetFile類代碼示例

本文整理匯總了C#中SiliconStudio.Assets.PackageLoadingAssetFile的典型用法代碼示例。如果您正苦於以下問題:C# PackageLoadingAssetFile類的具體用法?C# PackageLoadingAssetFile怎麽用?C# PackageLoadingAssetFile使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PackageLoadingAssetFile類屬於SiliconStudio.Assets命名空間,在下文中一共展示了PackageLoadingAssetFile類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Upgrade

        public void Upgrade(AssetMigrationContext context, string dependencyName, PackageVersion currentVersion, PackageVersion targetVersion, YamlMappingNode yamlAssetNode, PackageLoadingAssetFile assetFile)
        {
            dynamic asset = new DynamicYamlMapping(yamlAssetNode);

            // upgrade the asset
            UpgradeAsset(context, currentVersion, targetVersion, asset, assetFile);
            SetSerializableVersion(asset, dependencyName, targetVersion);

            // upgrade its base
            var baseBranch = asset[Asset.BaseProperty];
            if (baseBranch != null)
            {
                UpgradeBase(context, dependencyName, currentVersion, targetVersion, baseBranch, assetFile);
            }

            // upgrade base parts
            var basePartsBranch = asset[Asset.BasePartsProperty] as DynamicYamlArray;
            if (basePartsBranch != null)
            {
                foreach (dynamic assetBase in basePartsBranch)
                {
                    UpgradeBase(context, dependencyName, currentVersion, targetVersion, assetBase, assetFile);
                }
            }
        }
開發者ID:psowinski,項目名稱:xenko,代碼行數:25,代碼來源:AssetUpgraderBase.cs

示例2: Upgrade

        public void Upgrade(AssetMigrationContext context, string dependencyName, PackageVersion currentVersion, PackageVersion targetVersion, YamlMappingNode yamlAssetNode, PackageLoadingAssetFile assetFile)
        {
            dynamic asset = new DynamicYamlMapping(yamlAssetNode);

            // upgrade the asset
            var baseBranch = asset[Asset.BaseProperty];
            var basePartsBranch = asset[Asset.BasePartsProperty] as DynamicYamlArray;

            // Detect in what kind of override context we are
            var overrideHint = (baseBranch != null || (basePartsBranch != null && basePartsBranch.Node.Children.Count > 0))
                ? OverrideUpgraderHint.Derived
                : OverrideUpgraderHint.Unknown;

            // Upgrade the asset
            UpgradeAsset(context, currentVersion, targetVersion, asset, assetFile, overrideHint);
            SetSerializableVersion(asset, dependencyName, targetVersion);

            // Upgrade its base
            if (baseBranch != null)
            {
                UpgradeBase(context, dependencyName, currentVersion, targetVersion, baseBranch, assetFile);
            }

            // Upgrade base parts
            if (basePartsBranch != null)
            {
                foreach (dynamic assetBase in basePartsBranch)
                {
                    UpgradeBase(context, dependencyName, currentVersion, targetVersion, assetBase, assetFile);
                }
            }
        }
開發者ID:cg123,項目名稱:xenko,代碼行數:32,代碼來源:AssetUpgraderBase.cs

示例3: Test

        public void Test()
        {
            var logger = new LoggerResult();
            var context = new AssetMigrationContext(null, logger);

            var files = Directory.EnumerateFiles(@"..\..\samples", "*.xkscene", SearchOption.AllDirectories);

            foreach (var sceneFile in files)
            {
                logger.HasErrors = false;
                logger.Clear();
                Console.WriteLine($"Checking file {sceneFile}");

                var file = new PackageLoadingAssetFile(sceneFile, null);

                var needMigration = AssetMigration.MigrateAssetIfNeeded(context, file, "Xenko");

                foreach (var message in logger.Messages)
                {
                    Console.WriteLine(message);
                }

                Assert.False(logger.HasErrors);

                if (needMigration)
                {
                    var result = Encoding.UTF8.GetString(file.AssetContent);
                    Console.WriteLine(result);

                    // We cannot load the Package here, as the package can use code/scripts that are only available when you actually compile project assmeblies
                }
            }
        }
開發者ID:psowinski,項目名稱:xenko,代碼行數:33,代碼來源:TestSceneUpgrader.cs

示例4: UpgradeAsset

 protected override void UpgradeAsset(AssetMigrationContext context, int currentVersion, int targetVersion, dynamic asset, PackageLoadingAssetFile assetFile)
 {
     if (asset.Source != null)
         asset.Source = DynamicYamlEmpty.Default;
     if (asset.SourceHash != null)
         asset.SourceHash = DynamicYamlEmpty.Default;
 }
開發者ID:releed,項目名稱:paradox,代碼行數:7,代碼來源:SceneAsset.cs

示例5: UpgradeAsset

 protected override void UpgradeAsset(AssetMigrationContext context, int currentVersion, int targetVersion, dynamic asset, PackageLoadingAssetFile assetFile)
 {
     // Introduction of MaterialInstance
     var material = asset.Type.Material;
     if (material != null)
     {
         asset.Type.MaterialInstance = new YamlMappingNode();
         asset.Type.MaterialInstance.Material = material;
         asset.Type.Material = DynamicYamlEmpty.Default;
     }
     var type = asset.Type.Node as YamlMappingNode;
     if (type != null && type.Tag == "!CubeProceduralModel")
     {
         // Size changed from scalar to vector3
         var size = asset.Type.Size as DynamicYamlScalar;
         if (size != null)
         {
             var vecSize = new YamlMappingNode
             {
                 { new YamlScalarNode("X"), new YamlScalarNode(size.Node.Value) },
                 { new YamlScalarNode("Y"), new YamlScalarNode(size.Node.Value) },
                 { new YamlScalarNode("Z"), new YamlScalarNode(size.Node.Value) }
             };
             vecSize.Style = YamlStyle.Flow;
             asset.Type.Size = vecSize;
         }
     }
 }
開發者ID:Aff1ic7i0n,項目名稱:paradox,代碼行數:28,代碼來源:ProceduralModelAsset.cs

示例6: UpgradeBase

 private void UpgradeBase(AssetMigrationContext context, string dependencyName, PackageVersion currentVersion, PackageVersion targetVersion, dynamic assetBase, PackageLoadingAssetFile assetFile)
 {
     var baseAsset = assetBase[nameof(AssetBase.Asset)];
     if (baseAsset != null)
     {
         UpgradeAsset(context, currentVersion, targetVersion, baseAsset, assetFile);
         SetSerializableVersion(baseAsset, dependencyName, targetVersion);
     }
 }
開發者ID:psowinski,項目名稱:xenko,代碼行數:9,代碼來源:AssetUpgraderBase.cs

示例7: Upgrade

            public void Upgrade(AssetMigrationContext context, int currentVersion, int targetVersion, YamlMappingNode yamlAssetNode, PackageLoadingAssetFile assetFile)
            {
                dynamic asset = new DynamicYamlMapping(yamlAssetNode);
                var baseBranch = asset["~Base"];
                if (baseBranch != null)
                    asset["~Base"] = DynamicYamlEmpty.Default;

                SetSerializableVersion(asset, targetVersion);
            }
開發者ID:releed,項目名稱:paradox,代碼行數:9,代碼來源:SceneAsset.cs

示例8: Upgrade

            public void Upgrade(AssetMigrationContext context, string dependencyName, PackageVersion currentVersion, PackageVersion targetVersion, YamlMappingNode yamlAssetNode, PackageLoadingAssetFile assetFile)
            {
                dynamic asset = new DynamicYamlMapping(yamlAssetNode);
                var baseBranch = asset[Asset.BaseProperty];
                if (baseBranch != null)
                    asset[BaseProperty] = DynamicYamlEmpty.Default;

                AssetUpgraderBase.SetSerializableVersion(asset, dependencyName, targetVersion);
            }
開發者ID:psowinski,項目名稱:xenko,代碼行數:9,代碼來源:SceneAsset.Upgraders.cs

示例9: ChangeFileExtension

        private void ChangeFileExtension(IList<PackageLoadingAssetFile> assetFiles, PackageLoadingAssetFile file, string newExtension)
        {
            // Create the new file
            var newFileName = new UFile(file.FilePath.FullPath.Replace(file.FilePath.GetFileExtension(), ".pdxsheet"));
            var newFile = new PackageLoadingAssetFile(newFileName, file.SourceFolder) { AssetContent = file.AssetContent };

            // Add the new file
            assetFiles.Add(newFile);

            // Mark the old file as "To Delete"
            file.Deleted = true;
        }
開發者ID:hck509,項目名稱:paradox,代碼行數:12,代碼來源:ParadoxPackageUpgrader.cs

示例10: UpgradeAsset

 protected override void UpgradeAsset(AssetMigrationContext context, PackageVersion currentVersion, PackageVersion targetVersion, dynamic asset, PackageLoadingAssetFile assetFile, OverrideUpgraderHint overrideHint)
 {
     var hierarchy = asset.Hierarchy;
     var entities = (DynamicYamlArray)hierarchy.Entities;
     foreach (dynamic entity in entities)
     {
         var components = entity.Components;
         var modelComponent = components["ModelComponent.Key"];
         if (modelComponent != null)
             modelComponent.RemoveChild("DrawOrder");
     }
 }
開發者ID:Kryptos-FR,項目名稱:xenko-reloaded,代碼行數:12,代碼來源:SceneAsset.Upgraders.cs

示例11: UpgradeAsset

 protected override void UpgradeAsset(AssetMigrationContext context, PackageVersion currentVersion, PackageVersion targetVersion, dynamic asset, PackageLoadingAssetFile assetFile)
 {
     var hierarchy = asset.Hierarchy;
     var entities = (DynamicYamlArray)hierarchy.Entities;
     foreach (dynamic entity in entities)
     {
         var components = entity.Components;
         var spriteComponent = components["SpriteComponent.Key"];
         if (spriteComponent != null)
             spriteComponent.RemoveChild("ExtrusionMethod");
     }
 }
開發者ID:h78hy78yhoi8j,項目名稱:xenko,代碼行數:12,代碼來源:SceneAsset.Upgraders.cs

示例12: UpgradeAsset

            protected override void UpgradeAsset(AssetMigrationContext context, PackageVersion currentVersion, PackageVersion targetVersion, dynamic asset, PackageLoadingAssetFile assetFile,
                OverrideUpgraderHint overrideHint)
            {
                if (asset.IsDynamic != null)
                {
                    var isDynamic = (bool)asset.IsDynamic;

                    // There is also SDF type, but old assets don't have it yet
                    asset.AddChild("FontType", isDynamic ? "Dynamic" : "Static");

                    asset.RemoveChild("IsDynamic");
                }
            }
開發者ID:Kryptos-FR,項目名稱:xenko-reloaded,代碼行數:13,代碼來源:SpriteFontAsset.Upgrader.cs

示例13: UpgradeAsset

 protected override void UpgradeAsset(AssetMigrationContext context, PackageVersion currentVersion, PackageVersion targetVersion, dynamic asset, PackageLoadingAssetFile assetFile)
 {
     foreach (var modelMaterial in asset.Materials)
     {
         var material = modelMaterial.Material;
         if (material != null)
         {
             modelMaterial.MaterialInstance = new YamlMappingNode();
             modelMaterial.MaterialInstance.Material = material;
             modelMaterial.Material = DynamicYamlEmpty.Default;
         }
     }
 }
開發者ID:FERRERDEV,項目名稱:xenko,代碼行數:13,代碼來源:ModelAsset.cs

示例14: Upgrade

        public void Upgrade(AssetMigrationContext context, int currentVersion, int targetVersion, YamlMappingNode yamlAssetNode, PackageLoadingAssetFile assetFile)
        {
            dynamic asset = new DynamicYamlMapping(yamlAssetNode);

            // upgrade the asset
            UpgradeAsset(context, currentVersion, targetVersion, asset, assetFile);
            SetSerializableVersion(asset, targetVersion);
            // upgrade its base
            var baseBranch = asset["~Base"];
            if (baseBranch != null)
            {
                var baseAsset = baseBranch["Asset"];
                if (baseAsset != null)
                    UpgradeAsset(context, currentVersion, targetVersion, baseAsset, assetFile);
                SetSerializableVersion(baseAsset, targetVersion);
            }
        }
開發者ID:releed,項目名稱:paradox,代碼行數:17,代碼來源:AssetUpgraderBase.cs

示例15: UpgradeAsset

            protected override void UpgradeAsset(AssetMigrationContext context, PackageVersion currentVersion, PackageVersion targetVersion, dynamic asset, PackageLoadingAssetFile assetFile)
            {
                if (asset.ColliderShapes == null)
                    return;

                foreach (var colliderShape in asset.ColliderShapes)
                {
                    if (colliderShape.Node.Tag == "!Box2DColliderShapeDesc")
                    {
                        var size = 2f * DynamicYamlExtensions.ConvertTo<Vector2>(colliderShape.HalfExtent);
                        colliderShape.Size = DynamicYamlExtensions.ConvertFrom(size);
                        colliderShape.HalfExtent = DynamicYamlEmpty.Default;
                    }
                    if (colliderShape.Node.Tag == "!BoxColliderShapeDesc")
                    {
                        var size = 2f * DynamicYamlExtensions.ConvertTo<Vector3>(colliderShape.HalfExtents);
                        colliderShape.Size = DynamicYamlExtensions.ConvertFrom(size);
                        colliderShape.HalfExtents = DynamicYamlEmpty.Default;
                    }
                    if (colliderShape.Node.Tag == "!CapsuleColliderShapeDesc" || colliderShape.Node.Tag == "!CylinderColliderShapeDesc")
                    {
                        var upVector = DynamicYamlExtensions.ConvertTo<Vector3>(colliderShape.UpAxis);
                        if (upVector == Vector3.UnitX)
                            colliderShape.Orientation = ShapeOrientation.UpX;
                        if (upVector == Vector3.UnitZ)
                            colliderShape.Orientation = ShapeOrientation.UpZ;

                        colliderShape.UpAxis = DynamicYamlEmpty.Default;
                    }
                    if (colliderShape.Node.Tag == "!CapsuleColliderShapeDesc" && colliderShape.Height != null)
                    {
                        colliderShape.Length = 2f * (float)colliderShape.Height;
                        colliderShape.Height = DynamicYamlEmpty.Default;
                    }
                    if (colliderShape.Node.Tag == "!CylinderColliderShapeDesc")
                    {
                        colliderShape.Radius = (float)colliderShape.HalfExtents.X;
                        colliderShape.Height = 2f * (float)colliderShape.HalfExtents.Y;
                        colliderShape.HalfExtents = DynamicYamlEmpty.Default;
                    }
                }
            }
開發者ID:h78hy78yhoi8j,項目名稱:xenko,代碼行數:42,代碼來源:ColliderShapeAsset.cs


注:本文中的SiliconStudio.Assets.PackageLoadingAssetFile類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。