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


C# TextBlock.AddChild方法代码示例

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


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

示例1: 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

示例2: 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

示例3: Save

            public bool Save( TextBlock block )
            {
                //fireObjects
                if( fireObjects.Count != 0 )
                {
                    TextBlock fireObjectsBlock = block.AddChild( "fireObjects" );
                    if( !fireObjects.Save( fireObjectsBlock ) )
                        return false;
                }

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

示例4: 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

示例5: 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

示例6: OnSave

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

            //hitObjects
            if (hitObjects.Count != 0)
            {
                TextBlock hitObjectsBlock = block.AddChild("hitObjects");
                if (!hitObjects.Save(hitObjectsBlock))
                    return false;
            }

            return true;
        }
开发者ID:AKNightHawk,项目名称:AssaultKnights2,代码行数:15,代码来源:Bullet.cs

示例7: SaveEngineConfig

        private bool SaveEngineConfig()
        {
            TextBlock block = new TextBlock();

            //Renderer
            {
                EngineComponentManager.ComponentInfo[] components = GetSortedComponentsByType(
                    EngineComponentManager.ComponentTypeFlags.RenderingSystem);

                EngineComponentManager.ComponentInfo component = null;
                if (comboBoxRenderSystems.SelectedIndex != -1)
                    component = components[comboBoxRenderSystems.SelectedIndex];

                TextBlock rendererBlock = block.AddChild("Renderer");
                if (component != null)
                    rendererBlock.SetAttribute("implementationComponent", component.Name);

                //rendering device
                if (component != null && component.Name.Contains("Direct3D"))
                {
                    rendererBlock.SetAttribute("renderingDeviceName", (string)comboBoxRenderingDevices.SelectedItem);
                    rendererBlock.SetAttribute("renderingDeviceIndex", (comboBoxRenderingDevices.SelectedIndex - 1).ToString());
                }

                if (!checkBoxAllowShaders.Checked)
                    rendererBlock.SetAttribute("allowShaders", checkBoxAllowShaders.Checked.ToString());

                //depthBufferAccess
                if (comboBoxDepthBufferAccess.SelectedIndex != -1)
                {
                    rendererBlock.SetAttribute("depthBufferAccess",
                        (comboBoxDepthBufferAccess.SelectedIndex == 1).ToString());
                }

                //fullSceneAntialiasing
                if (comboBoxAntialiasing.SelectedIndex != -1)
                {
                    ComboBoxItem item = (ComboBoxItem)comboBoxAntialiasing.SelectedItem;
                    rendererBlock.SetAttribute("fullSceneAntialiasing", item.Identifier);
                }

                //filtering
                if (comboBoxFiltering.SelectedIndex != -1)
                {
                    RendererWorld.FilteringModes filtering = (RendererWorld.FilteringModes)
                        comboBoxFiltering.SelectedIndex;
                    rendererBlock.SetAttribute("filtering", filtering.ToString());
                }

                //renderTechnique
                if (comboBoxRenderTechnique.SelectedIndex != -1)
                {
                    ComboBoxItem item = (ComboBoxItem)comboBoxRenderTechnique.SelectedItem;
                    rendererBlock.SetAttribute("renderTechnique", item.Identifier);
                }

                //multiMonitorMode
                if (comboBoxVideoMode.SelectedIndex == 1)
                    rendererBlock.SetAttribute("multiMonitorMode", true.ToString());

                //videoMode
                if (comboBoxVideoMode.SelectedIndex >= 2)
                {
                    string[] strings = ((string)comboBoxVideoMode.SelectedItem).
                        Split(new char[] { 'x' });
                    Vec2I videoMode = new Vec2I(int.Parse(strings[0]),
                        int.Parse(strings[1]));
                    rendererBlock.SetAttribute("videoMode", videoMode.ToString());
                }

                //fullScreen
                rendererBlock.SetAttribute("fullScreen", checkBoxFullScreen.Checked.ToString());

                //vertical sync
                rendererBlock.SetAttribute("verticalSync",
                    checkBoxVerticalSync.Checked.ToString());
            }

            //Physics system
            {
                EngineComponentManager.ComponentInfo[] components = GetSortedComponentsByType(
                    EngineComponentManager.ComponentTypeFlags.PhysicsSystem);

                EngineComponentManager.ComponentInfo component = null;
                if (comboBoxPhysicsSystems.SelectedIndex != -1)
                    component = components[comboBoxPhysicsSystems.SelectedIndex];

                if (component != null)
                {
                    TextBlock physicsSystemBlock = block.AddChild("PhysicsSystem");
                    physicsSystemBlock.SetAttribute("implementationComponent", component.Name);
                    //physicsSystemBlock.SetAttribute( "allowHardwareAcceleration",
                    //   checkBoxPhysicsAllowHardwareAcceleration.Checked.ToString() );
                }
            }

            //Sound system
            {
                EngineComponentManager.ComponentInfo[] components = GetSortedComponentsByType(
                    EngineComponentManager.ComponentTypeFlags.SoundSystem);
//.........这里部分代码省略.........
开发者ID:AKNightHawk,项目名称:AssaultKnights2,代码行数:101,代码来源:MainForm.cs

示例8: OnSave

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

            if (!(currentTask is IdleTask))
            {
                TextBlock taskBlock = block.AddChild("currentTask");
                taskBlock.SetAttribute("class", GetTaskClassName(currentTask));
                currentTask._Save(taskBlock);
            }

            if (tasks.Count != 0)
            {
                TextBlock tasksBlock = block.AddChild("tasks");
                foreach (Task task in tasks)
                {
                    TextBlock taskBlock = tasksBlock.AddChild("item");
                    taskBlock.SetAttribute("class", GetTaskClassName(task));
                    task._Save(taskBlock);
                }
            }
        }
开发者ID:AKNightHawk,项目名称:AssaultKnights2,代码行数:22,代码来源:GameCharacterAI.cs

示例9: OnFormClosing

        protected override void OnFormClosing( FormClosingEventArgs e )
        {
            if( DialogResult == DialogResult.OK )
            {
                //save Engine.config

                TextBlock block = new TextBlock();

                //Renderer
                {
                    TextBlock rendererBlock = block.AddChild( "Renderer" );

                    string renderSystemName = "";
                    if( comboBoxRenderSystems.SelectedIndex != -1 )
                        renderSystemName = (string)comboBoxRenderSystems.SelectedItem;

                    if( renderSystemName != "" )
                        rendererBlock.SetAttribute( "renderSystemName", renderSystemName );

                    //maxPixelShaders
                    {
                        EnumTypeConverter enumConverter = new EnumTypeConverter(
                            typeof( RendererWorld.MaxPixelShadersVersions ) );
                        string text = comboBoxMaxPixelShaders.SelectedItem.ToString();
                        RendererWorld.MaxPixelShadersVersions maxPixelShaders =
                            (RendererWorld.MaxPixelShadersVersions)enumConverter.ConvertFromString( text );
                        rendererBlock.SetAttribute( "maxPixelShaders", maxPixelShaders.ToString() );
                    }

                    //maxVertexShaders
                    {
                        EnumTypeConverter enumConverter = new EnumTypeConverter(
                            typeof( RendererWorld.MaxVertexShadersVersions ) );
                        string text = comboBoxMaxVertexShaders.SelectedItem.ToString();
                        RendererWorld.MaxVertexShadersVersions maxVertexShaders =
                            (RendererWorld.MaxVertexShadersVersions)enumConverter.ConvertFromString( text );
                        rendererBlock.SetAttribute( "maxVertexShaders", maxVertexShaders.ToString() );
                    }

                    //fullSceneAntialiasing
                    {
                        int fullSceneAntialiasing = 0;
                        if( comboBoxAntialiasing.SelectedIndex > 0 )
                            fullSceneAntialiasing = int.Parse( (string)comboBoxAntialiasing.SelectedItem );
                        rendererBlock.SetAttribute( "fullSceneAntialiasing",
                            fullSceneAntialiasing.ToString() );
                    }

                    //filtering
                    {
                        EnumTypeConverter enumConverter = new EnumTypeConverter(
                            typeof( RendererWorld.FilteringModes ) );
                        string text = comboBoxFiltering.SelectedItem.ToString();
                        RendererWorld.FilteringModes filtering =
                            (RendererWorld.FilteringModes)enumConverter.ConvertFromString( text );
                        rendererBlock.SetAttribute( "filtering", filtering.ToString() );
                    }

                    //renderTechnique
                    if( comboBoxRenderTechnique.SelectedIndex != -1 )
                    {
                        string renderTechnique = "";
                        if( comboBoxRenderTechnique.SelectedIndex != 0 )
                        {
                            renderTechnique =
                                ( (RenderTechniqueItem)comboBoxRenderTechnique.SelectedItem ).Name;
                        }
                        rendererBlock.SetAttribute( "renderTechnique", renderTechnique );
                    }

                    //videoMode
                    if( comboBoxVideoMode.SelectedIndex > 0 )
                    {
                        string[] strings = ( (string)comboBoxVideoMode.SelectedItem ).
                            Split( new char[] { 'x' } );
                        Vec2i videoMode = new Vec2i( int.Parse( strings[ 0 ] ),
                            int.Parse( strings[ 1 ] ) );
                        rendererBlock.SetAttribute( "videoMode", videoMode.ToString() );
                    }

                    //fullScreen
                    rendererBlock.SetAttribute( "fullScreen", checkBoxFullScreen.Checked.ToString() );

                    //vertical sync
                    rendererBlock.SetAttribute( "verticalSync",
                        checkBoxVerticalSync.Checked.ToString() );

                    //allowChangeDisplayFrequency
                    rendererBlock.SetAttribute( "allowChangeDisplayFrequency",
                        checkBoxAllowChangeDisplayFrequency.Checked.ToString() );
                }

                //Physics system
                {
                    string physicsSystemName = "";
                    if( comboBoxPhysicsSystems.SelectedIndex != -1 )
                        physicsSystemName = (string)comboBoxPhysicsSystems.SelectedItem;

                    //physics system name
                    TextBlock physicsSystemBlock = block.AddChild( "PhysicsSystem" );
//.........这里部分代码省略.........
开发者ID:DarrenHassan,项目名称:GDM4242-GroupD,代码行数:101,代码来源:MainForm.cs

示例10: OnSave

        /// <summary>Overridden from <see cref="Engine.EntitySystem.Entity.OnSave(TextBlock)"/>.</summary>
        protected override void OnSave( TextBlock block )
        {
            base.OnSave( block );

            //World serialization: save animation tree.
            if( EntitySystemWorld.Instance.SerializationMode == SerializationModes.World )
            {
                AnimationTree tree = GetFirstAnimationTree();
                if( tree != null )
                {
                    TextBlock treeBlock = block.AddChild( "animationTree" );
                    tree.WorldSave( treeBlock );
                }
            }
        }
开发者ID:whztt07,项目名称:SDK,代码行数:16,代码来源:Dynamic.cs

示例11: 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


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