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


C# TextBlock.SetAttribute方法代码示例

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


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

示例1: OnSave

        protected override void OnSave(TextBlock block)
        {
            base.OnSave(block);

            if (!string.IsNullOrEmpty(diffuseMap))
                block.SetAttribute("diffuseMap", diffuseMap);
        }
开发者ID:AKNightHawk,项目名称:AssaultKnights2,代码行数:7,代码来源:SimpleExampleMaterial.cs

示例2: OnSave

        protected override void OnSave( TextBlock block )
        {
            base.OnSave( block );

            if( waveOnlyInVerticalPosition )
                block.SetAttribute( "waveOnlyInVerticalPosition", waveOnlyInVerticalPosition.ToString() );
            if( receiveObjectsPositionsFromVertices )
            {
                block.SetAttribute( "receiveObjectsPositionsFromVertices",
                    receiveObjectsPositionsFromVertices.ToString() );
            }
        }
开发者ID:CITS4242B2010,项目名称:project2010,代码行数:12,代码来源:VegetationMaterial.cs

示例3: OnSave

        protected override void OnSave( TextBlock block )
        {
            base.OnSave( block );

            if( receiveObjectsPositionsFromVertices )
            {
                block.SetAttribute( "receiveObjectsPositionsFromVertices",
                    receiveObjectsPositionsFromVertices.ToString() );
            }

            if( windEffectFactor != 1 )
                block.SetAttribute( "windEffectFactor", windEffectFactor.ToString() );

            if( bendScale != 0.02f )
                block.SetAttribute( "bendScale", bendScale.ToString() );
            if( bendVariation != 0.01f )
                block.SetAttribute( "bendVariation", bendVariation.ToString() );
            if( bendFrequency != 1 )
                block.SetAttribute( "bendFrequency", bendFrequency.ToString() );

            block.SetAttribute( "detailBending", detailBending.ToString() );
            if( branchAmplitude != 0.01f )
                block.SetAttribute( "branchAmplitude", branchAmplitude.ToString() );
            if( leafAmplitude != 0.01f )
                block.SetAttribute( "leafAmplitude", leafAmplitude.ToString() );
            if( branchFrequency != 1 )
                block.SetAttribute( "branchFrequency", branchFrequency.ToString() );
            if( leafFrequency != 1 )
                block.SetAttribute( "leafFrequency", leafFrequency.ToString() );
        }
开发者ID:whztt07,项目名称:SDK,代码行数:30,代码来源:VegetationMaterial.cs

示例4: Save

            public void Save( TextBlock block )
            {
                if( scroll != Vec2.Zero )
                    block.SetAttribute( "scroll", scroll.ToString() );
                if( scale != new Vec2( 1, 1 ) )
                    block.SetAttribute( "scale", scale.ToString() );
                if( rotate != 0 )
                    block.SetAttribute( "rotate", rotate.ToString() );
                if( dynamicParameters )
                    block.SetAttribute( "dynamicParameters", dynamicParameters.ToString() );

                if( animation.IsDataExists() )
                {
                    TextBlock animationBlock = block.AddChild( "animation" );
                    animation.Save( animationBlock );
                }
            }
开发者ID:whztt07,项目名称:SDK,代码行数:17,代码来源:ShaderBaseMaterial.cs

示例5: OnSave

        protected override void OnSave( TextBlock block )
        {
            base.OnSave( block );

            //General
            {
                if( blending != MaterialBlendingTypes.Opaque )
                    block.SetAttribute( "blending", blending.ToString() );

                if( !lighting )
                    block.SetAttribute( "lighting", lighting.ToString() );

                if( !ambientLighting )
                    block.SetAttribute( "ambientLighting", ambientLighting.ToString() );

                if( doubleSided )
                    block.SetAttribute( "doubleSided", doubleSided.ToString() );

                if( !useNormals )
                    block.SetAttribute( "useNormals", useNormals.ToString() );

                if( !receiveShadows )
                    block.SetAttribute( "receiveShadows", receiveShadows.ToString() );

                if( receiveSimpleShadows )
                    block.SetAttribute( "receiveSimpleShadows", receiveSimpleShadows.ToString() );

                if( alphaRejectFunction != CompareFunction.AlwaysPass )
                    block.SetAttribute( "alphaRejectFunction", alphaRejectFunction.ToString() );

                if( alphaRejectValue != 127 )
                    block.SetAttribute( "alphaRejectValue", alphaRejectValue.ToString() );

                if( alphaToCoverage )
                    block.SetAttribute( "alphaToCoverage", alphaToCoverage.ToString() );

                if( fadingByDistanceRange != new Range( 0, 0 ) )
                    block.SetAttribute( "fadingByDistanceRange", fadingByDistanceRange.ToString() );

                if( !allowFog )
                    block.SetAttribute( "allowFog", allowFog.ToString() );

                if( !depthWrite )
                    block.SetAttribute( "depthWrite", depthWrite.ToString() );

                if( !depthTest )
                    block.SetAttribute( "depthTest", depthTest.ToString() );

                if( softParticles )
                    block.SetAttribute( "softParticles", softParticles.ToString() );

                if( softParticlesFadingLength != 1 )
                    block.SetAttribute( "softParticlesFadingLength", softParticlesFadingLength.ToString() );

                if( depthOffset != 0 )
                    block.SetAttribute( "depthOffset", depthOffset.ToString() );

                if( halfLambert )
                    block.SetAttribute( "halfLambert", halfLambert.ToString() );
            }

            //Diffuse
            {
                if( diffuseColor != new ColorValue( 1, 1, 1 ) )
                    block.SetAttribute( "diffuseColor", diffuseColor.ToString() );
                if( diffusePower != 1 )
                    block.SetAttribute( "diffusePower", diffusePower.ToString() );

                if( diffuseScaleDynamic )
                    block.SetAttribute( "diffuseScaleDynamic", diffuseScaleDynamic.ToString() );

                if( diffuseVertexColor )
                    block.SetAttribute( "diffuseVertexColor", diffuseVertexColor.ToString() );

                if( diffuse1Map.IsDataExists() )
                {
                    TextBlock diffuse1MapBlock = block.AddChild( "diffuse1Map" );
                    diffuse1Map.Save( diffuse1MapBlock );
                }

                if( diffuse2Map.IsDataExists() )
                {
                    TextBlock diffuse2MapBlock = block.AddChild( "diffuse2Map" );
                    diffuse2Map.Save( diffuse2MapBlock );
                }

                if( diffuse3Map.IsDataExists() )
                {
                    TextBlock diffuse3MapBlock = block.AddChild( "diffuse3Map" );
                    diffuse3Map.Save( diffuse3MapBlock );
                }

                if( diffuse4Map.IsDataExists() )
                {
                    TextBlock diffuse4MapBlock = block.AddChild( "diffuse4Map" );
                    diffuse4Map.Save( diffuse4MapBlock );
                }
            }

            //Reflection
//.........这里部分代码省略.........
开发者ID:whztt07,项目名称:SDK,代码行数:101,代码来源:ShaderBaseMaterial.cs

示例6: OnSave

        protected override void OnSave( TextBlock block )
        {
            base.OnSave( block );

            //General
            {
                if( blending != MaterialBlendingTypes.Opaque )
                    block.SetAttribute( "blending", blending.ToString() );

                if( !lighting )
                    block.SetAttribute( "lighting", lighting.ToString() );

                if( !culling )
                    block.SetAttribute( "culling", culling.ToString() );

                if( !useNormals )
                    block.SetAttribute( "useNormals", useNormals.ToString() );

                if( !receiveShadows )
                    block.SetAttribute( "receiveShadows", receiveShadows.ToString() );

                if( alphaRejectFunction != CompareFunction.AlwaysPass )
                    block.SetAttribute( "alphaRejectFunction", alphaRejectFunction.ToString() );

                if( alphaRejectValue != 127 )
                    block.SetAttribute( "alphaRejectValue", alphaRejectValue.ToString() );

                if( alphaToCoverage )
                    block.SetAttribute( "alphaToCoverage", alphaToCoverage.ToString() );

                if( fadingByDistanceRange != new Range( 0, 0 ) )
                    block.SetAttribute( "fadingByDistanceRange", fadingByDistanceRange.ToString() );

                if( !allowFog )
                    block.SetAttribute( "allowFog", allowFog.ToString() );

                if( !depthWrite )
                    block.SetAttribute( "depthWrite", depthWrite.ToString() );

                if( !depthTest )
                    block.SetAttribute( "depthTest", depthTest.ToString() );
            }

            //Diffuse
            {
                if( diffuseColor != new ColorValue( 1, 1, 1 ) )
                    block.SetAttribute( "diffuseColor", diffuseColor.ToString() );
                if( diffusePower != 1 )
                    block.SetAttribute( "diffusePower", diffusePower.ToString() );

                if( diffuseScaleDynamic )
                    block.SetAttribute( "diffuseScaleDynamic", diffuseScaleDynamic.ToString() );

                if( diffuseVertexColor )
                    block.SetAttribute( "diffuseVertexColor", diffuseVertexColor.ToString() );

                if( diffuse1Map.IsDataExists() )
                {
                    TextBlock diffuse1MapBlock = block.AddChild( "diffuse1Map" );
                    diffuse1Map.Save( diffuse1MapBlock );
                }

                if( diffuse2Map.IsDataExists() )
                {
                    TextBlock diffuse2MapBlock = block.AddChild( "diffuse2Map" );
                    diffuse2Map.Save( diffuse2MapBlock );
                }

                if( diffuse3Map.IsDataExists() )
                {
                    TextBlock diffuse3MapBlock = block.AddChild( "diffuse3Map" );
                    diffuse3Map.Save( diffuse3MapBlock );
                }

                if( diffuse4Map.IsDataExists() )
                {
                    TextBlock diffuse4MapBlock = block.AddChild( "diffuse4Map" );
                    diffuse4Map.Save( diffuse4MapBlock );
                }
            }

            //Reflection
            {
                if( reflectionColor != new ColorValue( 0, 0, 0 ) )
                    block.SetAttribute( "reflectionColor", reflectionColor.ToString() );
                if( reflectionPower != 1 )
                    block.SetAttribute( "reflectionPower", reflectionPower.ToString() );

                if( reflectionScaleDynamic )
                    block.SetAttribute( "reflectionScaleDynamic", reflectionScaleDynamic.ToString() );

                if( reflectionMap.IsDataExists() )
                {
                    TextBlock reflectionMapBlock = block.AddChild( "reflectionMap" );
                    reflectionMap.Save( reflectionMapBlock );
                }

                if( !string.IsNullOrEmpty( reflectionSpecificCubemap ) )
                    block.SetAttribute( "reflectionSpecificCubemap", reflectionSpecificCubemap );
            }
//.........这里部分代码省略.........
开发者ID:DarrenHassan,项目名称:GDM4242-GroupD,代码行数:101,代码来源:ShaderBaseMaterial.cs

示例7: Save

            public static void Save(SystemKeyboardMouseValue item, TextBlock block)
            {
                block.SetAttribute("type", item.Type.ToString());
                switch (item.Type)
                {
                    case Types.Key:
                        block.SetAttribute("key", item.Key.ToString());
                        block.SetAttribute("strength", item.Strength.ToString());
                        break;

                    case Types.MouseButton:
                        block.SetAttribute("button", item.MouseButton.ToString());
                        block.SetAttribute("strength", item.Strength.ToString());
                        break;

                    case Types.MouseScrollDirection:
                        block.SetAttribute("scroll", item.scrollDirection.ToString());
                        block.SetAttribute("strength", item.Strength.ToString());
                        break;
                }
            }
开发者ID:AKNightHawk,项目名称:AssaultKnights2,代码行数:21,代码来源:GameControlsManager.cs

示例8: SaveCustomConfig

        public void SaveCustomConfig()
        {
            var block = new TextBlock();
            var controlBloc = block.AddChild("Controls");

            //var deadzone = controlBloc.AddChild("DeadZone");
            var keyBlockDz = DeadZone.ToString();
            block.SetAttribute("DeadZone", keyBlockDz);

            foreach (GameControlItem item in Items)
            {
                var currentKeyBlock = controlBloc.AddChild(item.ControlKey.ToString());
                //keybord Setting
                if (item.BindedKeyboardMouseValues.Count > 0)
                {
                    var keyboardBlock = currentKeyBlock.AddChild("Keyboard");
                    foreach (var keyboardvalue in item.BindedKeyboardMouseValues)
                    {
                        var keyBlock = keyboardBlock.AddChild("Item");
                        SystemKeyboardMouseValue.Save(keyboardvalue, keyBlock);
                    }
                }
                //Joystick setting
                if (item.BindedJoystickValues.Count > 0)
                {
                    var joystickBlock = currentKeyBlock.AddChild("Joystick");
                    foreach (var joystickvalue in item.BindedJoystickValues)
                    {
                        var keyBlock = joystickBlock.AddChild("Item");
                        SystemJoystickValue.Save(joystickvalue, keyBlock);
                    }
                }
            }

            string fileName = VirtualFileSystem.GetRealPathByVirtual(keyconfig);
            try
            {
                string directoryName = Path.GetDirectoryName(fileName);
                if (directoryName != "" && !Directory.Exists(directoryName))
                    Directory.CreateDirectory(directoryName);
                using (StreamWriter writer = new StreamWriter(fileName))
                {
                    writer.Write(block.DumpToString());
                }
            }
            catch
            {
                Log.Fatal(string.Format("Saving file failed \"{0}\".", fileName));
                return;
            }
        }
开发者ID:AKNightHawk,项目名称:AssaultKnights2,代码行数:51,代码来源:GameControlsManager.cs

示例9: OnSave

 protected override void OnSave(TextBlock block)
 {
     base.OnSave(block);
     block.SetAttribute("reachDistance", reachDistance.ToString());
 }
开发者ID:AKNightHawk,项目名称:AssaultKnights2,代码行数:5,代码来源:GameCharacterAI.cs

示例10: OnSave

        protected override void OnSave( TextBlock block )
        {
            base.OnSave( block );

            if( currentFireMode != null )
            {
                if( currentFireMode == normalMode )
                    block.SetAttribute( "currentFireMode", "normal" );
                else
                    block.SetAttribute( "currentFireMode", "alternative" );
            }
        }
开发者ID:whztt07,项目名称:SDK,代码行数:12,代码来源:Gun.cs

示例11: SaveAnimationState

        void SaveAnimationState( TextBlock block )
        {
            if( currentAnimationItem != null && !currentAnimationItem.Removed )
            {
                TextBlock itemBlock = block.AddChild( "currentAnimationItem" );

                MeshObjectAnimationController.AnimationItem item = currentAnimationItem;

                itemBlock.SetAttribute( "animationBaseName", item.AnimationBaseName );
                itemBlock.SetAttribute( "allowRandomAnimationNumber",
                    item.AllowRandomAnimationNumber.ToString() );
                itemBlock.SetAttribute( "loop", item.Loop.ToString() );
                itemBlock.SetAttribute( "velocity", item.Velocity.ToString() );
                itemBlock.SetAttribute( "weight", item.Weight.ToString() );
                itemBlock.SetAttribute( "timePosition", item.TimePosition.ToString() );
            }

            if( forceAnimationRemainingTime != 0 )
            {
                block.SetAttribute( "forceAnimationRemainingTime",
                    forceAnimationRemainingTime.ToString() );
            }
        }
开发者ID:DarrenHassan,项目名称:GDM4242-GroupD,代码行数:23,代码来源:Dynamic.cs

示例12: OnSave

 protected override void OnSave( TextBlock block )
 {
     base.OnSave( block );
     if( Dimensions != new Vec3( 1, 1, 1 ) )
         block.SetAttribute( "dimensions", Dimensions.ToString() );
 }
开发者ID:whztt07,项目名称:SDK,代码行数:6,代码来源:_Custom1Shape.cs


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