当前位置: 首页>>代码示例>>C#>>正文


C# TextBlock.GetAttribute方法代码示例

本文整理汇总了C#中TextBlock.GetAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# TextBlock.GetAttribute方法的具体用法?C# TextBlock.GetAttribute怎么用?C# TextBlock.GetAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TextBlock的用法示例。


在下文中一共展示了TextBlock.GetAttribute方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnLoad

        protected override bool OnLoad( TextBlock block )
        {
            if( !base.OnLoad( block ) )
                return false;

            if( block.IsAttributeExist( "diffuseMap" ) )
                diffuseMap = block.GetAttribute( "diffuseMap" );

            return true;
        }
开发者ID:DarrenHassan,项目名称:GDM4242-GroupD,代码行数:10,代码来源:SimpleExampleMaterial.cs

示例2: OnLoad

        protected override bool OnLoad( TextBlock block )
        {
            if( !base.OnLoad( block ) )
                return false;

            if( block.IsAttributeExist( "waveOnlyInVerticalPosition" ) )
            {
                waveOnlyInVerticalPosition =
                    bool.Parse( block.GetAttribute( "waveOnlyInVerticalPosition" ) );
            }
            if( block.IsAttributeExist( "receiveObjectsPositionsFromVertices" ) )
            {
                receiveObjectsPositionsFromVertices =
                    bool.Parse( block.GetAttribute( "receiveObjectsPositionsFromVertices" ) );
            }

            return true;
        }
开发者ID:CITS4242B2010,项目名称:project2010,代码行数:18,代码来源:VegetationMaterial.cs

示例3: OnLoad

        protected override bool OnLoad( TextBlock block )
        {
            if( !base.OnLoad( block ) )
                return false;

            if( block.IsAttributeExist( "receiveObjectsPositionsFromVertices" ) )
            {
                receiveObjectsPositionsFromVertices =
                    bool.Parse( block.GetAttribute( "receiveObjectsPositionsFromVertices" ) );
            }

            if( block.IsAttributeExist( "windEffectFactor" ) )
                windEffectFactor = float.Parse( block.GetAttribute( "windEffectFactor" ) );

            if( block.IsAttributeExist( "bendScale" ) )
                bendScale = float.Parse( block.GetAttribute( "bendScale" ) );
            if( block.IsAttributeExist( "bendVariation" ) )
                bendVariation = float.Parse( block.GetAttribute( "bendVariation" ) );
            if( block.IsAttributeExist( "bendFrequency" ) )
                bendFrequency = float.Parse( block.GetAttribute( "bendFrequency" ) );

            if( block.IsAttributeExist( "detailBending" ) )
                detailBending = bool.Parse( block.GetAttribute( "detailBending" ) );
            if( block.IsAttributeExist( "branchAmplitude" ) )
                branchAmplitude = float.Parse( block.GetAttribute( "branchAmplitude" ) );
            if( block.IsAttributeExist( "leafAmplitude" ) )
                leafAmplitude = float.Parse( block.GetAttribute( "leafAmplitude" ) );
            if( block.IsAttributeExist( "branchFrequency" ) )
                branchFrequency = float.Parse( block.GetAttribute( "branchFrequency" ) );
            if( block.IsAttributeExist( "leafFrequency" ) )
                leafFrequency = float.Parse( block.GetAttribute( "leafFrequency" ) );

            return true;
        }
开发者ID:whztt07,项目名称:SDK,代码行数:34,代码来源:VegetationMaterial.cs

示例4: OnLoad

        /// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnLoad(TextBlock)"/>.</summary>
        protected override bool OnLoad( TextBlock block )
        {
            //for compatibility with old versions.
            if( block.IsAttributeExist( "initFaction" ) )
                initialFaction = (FactionType)EntityTypes.Instance.GetByName(
                    block.GetAttribute( "initFaction" ) );

            return base.OnLoad( block );
        }
开发者ID:huytd,项目名称:fosproject,代码行数:10,代码来源:Unit.cs

示例5: Load

            public virtual void Load( TextBlock block )
            {
                if( block.IsAttributeExist( "texture" ) )
                    texture = block.GetAttribute( "texture" );

                if( block.IsAttributeExist( "texCoord" ) )
                    texCoord = (TexCoordIndexes)Enum.Parse( typeof( TexCoordIndexes ),
                        block.GetAttribute( "texCoord" ) );

                if( block.IsAttributeExist( "clamp" ) )
                    clamp = bool.Parse( block.GetAttribute( "clamp" ) );

                TextBlock transformBlock = block.FindChild( "transform" );
                if( transformBlock != null )
                    transform.Load( transformBlock );
            }
开发者ID:whztt07,项目名称:SDK,代码行数:16,代码来源:ShaderBaseMaterial.cs

示例6: OnLoad

        protected override bool OnLoad( TextBlock block )
        {
            if( !base.OnLoad( block ) )
                return false;

            //dieObjects
            TextBlock dieObjectsBlock = block.FindChild( "dieObjects" );
            if( dieObjectsBlock != null )
            {
                if( !dieObjects.Load( dieObjectsBlock ) )
                    return false;
            }

            //old version compatibility
            if( block.IsAttributeExist( "lifeMax" ) )
                healthMax = float.Parse( block.GetAttribute( "lifeMax" ) );
            if( block.IsAttributeExist( "lifeMin" ) )
                healthMin = float.Parse( block.GetAttribute( "lifeMin" ) );

            return true;
        }
开发者ID:whztt07,项目名称:SDK,代码行数:21,代码来源:Dynamic.cs

示例7: Load

            public static SystemJoystickValue Load(TextBlock block)
            {
                var value = new SystemJoystickValue();

                {
                    var type = block.GetAttribute("type");
                    if (!string.IsNullOrEmpty(type))
                        value.type = (Types)Enum.Parse(typeof(Types), type);
                }

                {
                    var button = block.GetAttribute("button");
                    if (!string.IsNullOrEmpty(button))
                        value.button = (JoystickButtons)Enum.Parse(typeof(JoystickButtons), button);
                }
                {
                    var axis = block.GetAttribute("axis");
                    if (!string.IsNullOrEmpty(axis))
                        value.axis = (JoystickAxes)Enum.Parse(typeof(JoystickAxes), axis);
                }
                {
                    var axisfilter = block.GetAttribute("axisfilter");
                    if (!string.IsNullOrEmpty(axisfilter))
                        value.axisFilter = (JoystickAxisFilters)Enum.Parse(typeof(JoystickAxisFilters), axisfilter);
                }
                {
                    var pov = block.GetAttribute("POV");
                    if (!string.IsNullOrEmpty(pov))
                        value.pov = (JoystickPOVs)Enum.Parse(typeof(JoystickPOVs), pov);
                }
                {
                    var povdirection = block.GetAttribute("POVDirection");
                    if (!string.IsNullOrEmpty(povdirection))
                        value.povDirection = (JoystickPOVDirections)Enum.Parse(typeof(JoystickPOVDirections), povdirection);
                }
                {
                    var slider = block.GetAttribute("slider");
                    if (!string.IsNullOrEmpty(slider))
                        value.slider = (JoystickSliders)Enum.Parse(typeof(JoystickSliders), slider);
                }
                {
                    var slideraxis = block.GetAttribute("sliderAxis");
                    if (!string.IsNullOrEmpty(slideraxis))
                        value.sliderAxis = (JoystickSliderAxes)Enum.Parse(typeof(JoystickSliderAxes), slideraxis);
                }
                {
                    var strength = block.GetAttribute("strength");
                    if (!string.IsNullOrEmpty("strength"))
                    {
                        value.strength = float.Parse(strength);
                    }
                }
                return value;
            }
开发者ID:AKNightHawk,项目名称:AssaultKnights2,代码行数:54,代码来源:GameControlsManager.cs

示例8: OnLoad

        protected override bool OnLoad( TextBlock block )
        {
            if( !base.OnLoad( block ) )
                return false;

            //General
            {
                if( block.IsAttributeExist( "blending" ) )
                    blending = (MaterialBlendingTypes)Enum.Parse(
                        typeof( MaterialBlendingTypes ), block.GetAttribute( "blending" ) );

                if( block.IsAttributeExist( "lighting" ) )
                    lighting = bool.Parse( block.GetAttribute( "lighting" ) );

                if( block.IsAttributeExist( "ambientLighting" ) )
                    ambientLighting = bool.Parse( block.GetAttribute( "ambientLighting" ) );

                if( block.IsAttributeExist( "doubleSided" ) )
                    doubleSided = bool.Parse( block.GetAttribute( "doubleSided" ) );
                //old version compatibility
                if( block.IsAttributeExist( "culling" ) )
                    doubleSided = !bool.Parse( block.GetAttribute( "culling" ) );

                if( block.IsAttributeExist( "useNormals" ) )
                    useNormals = bool.Parse( block.GetAttribute( "useNormals" ) );

                if( block.IsAttributeExist( "receiveShadows" ) )
                    receiveShadows = bool.Parse( block.GetAttribute( "receiveShadows" ) );

                if( block.IsAttributeExist( "receiveSimpleShadows" ) )
                    receiveSimpleShadows = bool.Parse( block.GetAttribute( "receiveSimpleShadows" ) );

                if( block.IsAttributeExist( "alphaRejectFunction" ) )
                    alphaRejectFunction = (CompareFunction)Enum.Parse( typeof( CompareFunction ),
                        block.GetAttribute( "alphaRejectFunction" ) );

                if( block.IsAttributeExist( "alphaRejectValue" ) )
                    alphaRejectValue = byte.Parse( block.GetAttribute( "alphaRejectValue" ) );

                if( block.IsAttributeExist( "alphaToCoverage" ) )
                    alphaToCoverage = bool.Parse( block.GetAttribute( "alphaToCoverage" ) );

                if( block.IsAttributeExist( "fadingByDistanceRange" ) )
                    fadingByDistanceRange = Range.Parse( block.GetAttribute( "fadingByDistanceRange" ) );

                if( block.IsAttributeExist( "allowFog" ) )
                    allowFog = bool.Parse( block.GetAttribute( "allowFog" ) );

                if( block.IsAttributeExist( "depthWrite" ) )
                    depthWrite = bool.Parse( block.GetAttribute( "depthWrite" ) );

                if( block.IsAttributeExist( "depthTest" ) )
                    depthTest = bool.Parse( block.GetAttribute( "depthTest" ) );

                if( block.IsAttributeExist( "softParticles" ) )
                    softParticles = bool.Parse( block.GetAttribute( "softParticles" ) );

                if( block.IsAttributeExist( "softParticlesFadingLength" ) )
                    softParticlesFadingLength = float.Parse( block.GetAttribute( "softParticlesFadingLength" ) );

                if( block.IsAttributeExist( "depthOffset" ) )
                    depthOffset = float.Parse( block.GetAttribute( "depthOffset" ) );

                if( block.IsAttributeExist( "halfLambert" ) )
                    halfLambert = bool.Parse( block.GetAttribute( "halfLambert" ) );
            }

            //Diffuse
            {
                //old version compatibility
                if( block.IsAttributeExist( "diffuseScale" ) )
                {
                    diffuseColor = ColorValue.Parse( block.GetAttribute( "diffuseScale" ) );
                    float power = Math.Max( Math.Max( diffuseColor.Red, diffuseColor.Green ),
                        diffuseColor.Blue );
                    if( power > 1 )
                    {
                        diffuseColor.Red /= power;
                        diffuseColor.Green /= power;
                        diffuseColor.Blue /= power;
                        diffusePower = power;
                    }
                }

                if( block.IsAttributeExist( "diffuseColor" ) )
                    diffuseColor = ColorValue.Parse( block.GetAttribute( "diffuseColor" ) );
                if( block.IsAttributeExist( "diffusePower" ) )
                    diffusePower = float.Parse( block.GetAttribute( "diffusePower" ) );

                if( block.IsAttributeExist( "diffuseScaleDynamic" ) )
                    diffuseScaleDynamic = bool.Parse( block.GetAttribute( "diffuseScaleDynamic" ) );

                if( block.IsAttributeExist( "diffuseVertexColor" ) )
                    diffuseVertexColor = bool.Parse( block.GetAttribute( "diffuseVertexColor" ) );

                TextBlock diffuse1MapBlock = block.FindChild( "diffuse1Map" );
                if( diffuse1MapBlock != null )
                    diffuse1Map.Load( diffuse1MapBlock );

                TextBlock diffuse2MapBlock = block.FindChild( "diffuse2Map" );
//.........这里部分代码省略.........
开发者ID:whztt07,项目名称:SDK,代码行数:101,代码来源:ShaderBaseMaterial.cs

示例9: OnLoad

 protected virtual bool OnLoad(TextBlock block)
 {
     if (block.IsAttributeExist("taskPosition"))
         taskPosition = Vec3.Parse(block.GetAttribute("taskPosition"));
     if (block.IsAttributeExist("taskEntity"))
     {
         taskEntity = Entities.Instance.GetLoadingEntityBySerializedUIN(
             uint.Parse(block.GetAttribute("taskEntity"))) as MapObject;
         if (taskEntity == null)
             return false;
     }
     return true;
 }
开发者ID:AKNightHawk,项目名称:AssaultKnights2,代码行数:13,代码来源:GameCharacterAI.cs

示例10: OnLoad

        protected override bool OnLoad( TextBlock block )
        {
            if( !base.OnLoad( block ) )
                return false;

            if( block.IsAttributeExist( "currentFireMode" ) )
            {
                if( block.GetAttribute( "currentFireMode" ) == "normal" )
                    currentFireMode = normalMode;
                else
                    currentFireMode = alternativeMode;
            }

            return true;
        }
开发者ID:whztt07,项目名称:SDK,代码行数:15,代码来源:Gun.cs

示例11: LoadAnimationState

        void LoadAnimationState( TextBlock block )
        {
            TextBlock itemBlock = block.FindChild( "currentAnimationItem" );
            if( itemBlock != null )
            {
                string animationBaseName =
                    itemBlock.GetAttribute( "animationBaseName" );
                bool allowRandomAnimationNumber = bool.Parse(
                    itemBlock.GetAttribute( "allowRandomAnimationNumber", "true" ) );
                bool loop = bool.Parse( itemBlock.GetAttribute( "loop", "true" ) );

                currentAnimationItem = animationController.Add( animationBaseName,
                    allowRandomAnimationNumber, loop );
                if( currentAnimationItem != null )
                {
                    MeshObjectAnimationController.AnimationItem item = currentAnimationItem;

                    if( itemBlock.IsAttributeExist( "velocity" ) )
                        item.Velocity = float.Parse( itemBlock.GetAttribute( "velocity" ) );
                    if( itemBlock.IsAttributeExist( "weight" ) )
                        item.Weight = float.Parse( itemBlock.GetAttribute( "weight" ) );
                    if( itemBlock.IsAttributeExist( "timePosition" ) )
                        item.TimePosition = float.Parse( itemBlock.GetAttribute( "timePosition" ) );
                }
            }

            if( block.IsAttributeExist( "forceAnimationRemainingTime" ) )
            {
                forceAnimationRemainingTime = float.Parse(
                    block.GetAttribute( "forceAnimationRemainingTime" ) );
            }
        }
开发者ID:DarrenHassan,项目名称:GDM4242-GroupD,代码行数:32,代码来源:Dynamic.cs

示例12: OnLoad

 protected override bool OnLoad( TextBlock block, string modelFileName )
 {
     if( !base.OnLoad( block, modelFileName ) )
         return false;
     if( block.IsAttributeExist( "dimensions" ) )
         Dimensions = Vec3.Parse( block.GetAttribute( "dimensions" ) );
     return true;
 }
开发者ID:whztt07,项目名称:SDK,代码行数:8,代码来源:_Custom1Shape.cs


注:本文中的TextBlock.GetAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。