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

            if (!string.IsNullOrEmpty(diffuseMap))
                block.SetAttribute("diffuseMap", diffuseMap);
        }
        protected override void OnSave( TextBlock block )
        {
            base.OnSave( block );

            if( waveOnlyInVerticalPosition )
                block.SetAttribute( "waveOnlyInVerticalPosition", waveOnlyInVerticalPosition.ToString() );
            if( receiveObjectsPositionsFromVertices )
            {
                block.SetAttribute( "receiveObjectsPositionsFromVertices",
                    receiveObjectsPositionsFromVertices.ToString() );
            }
        }
Example #3
0
        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() );
        }
Example #4
0
            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 );
                }
            }
Example #5
0
            public override void Save( TextBlock block )
            {
                base.Save( block );

                if( blending != MapBlendingTypes.Modulate )
                    block.SetAttribute( "blending", blending.ToString() );
            }
Example #6
0
            public virtual void Save( TextBlock block )
            {
                if( !string.IsNullOrEmpty( texture ) )
                    block.SetAttribute( "texture", texture );

                if( texCoord != TexCoordIndexes.TexCoord0 )
                    block.SetAttribute( "texCoord", texCoord.ToString() );

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

                if( transform.IsDataExists() )
                {
                    TextBlock transformBlock = block.AddChild( "transform" );
                    transform.Save( transformBlock );
                }
            }
Example #7
0
        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
            {
                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 );

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

            //Emission
            {
                if( emissionColor != new ColorValue( 0, 0, 0 ) )
                    block.SetAttribute( "emissionColor", emissionColor.ToString() );
                if( emissionPower != 1 )
                    block.SetAttribute( "emissionPower", emissionPower.ToString() );

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

                if( emissionMap.IsDataExists() )
                {
                    TextBlock emissionMapBlock = block.AddChild( "emissionMap" );
                    emissionMap.Save( emissionMapBlock );
                }
            }

            //Specular
            {
                if( specularColor != new ColorValue( 0, 0, 0 ) )
                    block.SetAttribute( "specularColor", specularColor.ToString() );
                if( specularPower != 1 )
                    block.SetAttribute( "specularPower", specularPower.ToString() );

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

                if( specularMap.IsDataExists() )
                {
                    TextBlock specularMapBlock = block.AddChild( "specularMap" );
                    specularMap.Save( specularMapBlock );
                }

                if( specularShininess != 20 )
                    block.SetAttribute( "specularShininess", specularShininess.ToString() );
            }

            //Translucency
            {
                if( translucencyColor != new ColorValue( 0, 0, 0 ) )
                    block.SetAttribute( "translucencyColor", translucencyColor.ToString() );
                if( translucencyPower != 1 )
                    block.SetAttribute( "translucencyPower", translucencyPower.ToString() );

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

                if( translucencyMap.IsDataExists() )
                {
                    TextBlock translucencyMapBlock = block.AddChild( "translucencyMap" );
                    translucencyMap.Save( translucencyMapBlock );
                }

                if( translucencyClearness != 4f )
                    block.SetAttribute( "translucencyClearness", translucencyClearness.ToString() );
            }

            //Height
            {
                if( normalMap.IsDataExists() )
                {
                    TextBlock normalMapBlock = block.AddChild( "normalMap" );
                    normalMap.Save( normalMapBlock );
                }

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

                if( heightMap.IsDataExists() )
                {
                    TextBlock heightMapBlock = block.AddChild( "heightMap" );
                    heightMap.Save( heightMapBlock );
                }

                if( displacementTechnique != DisplacementTechniques.ParallaxOcclusionMapping )
                    block.SetAttribute( "displacementTechnique", displacementTechnique.ToString() );

                if( heightScale != .04f )
                    block.SetAttribute( "heightScale", heightScale.ToString() );
            }
        }
        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 );
            }

            //Emission
            {
                if( emissionColor != new ColorValue( 0, 0, 0 ) )
                    block.SetAttribute( "emissionColor", emissionColor.ToString() );
                if( emissionPower != 1 )
                    block.SetAttribute( "emissionPower", emissionPower.ToString() );

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

                if( emissionMap.IsDataExists() )
                {
                    TextBlock emissionMapBlock = block.AddChild( "emissionMap" );
                    emissionMap.Save( emissionMapBlock );
                }
            }

            //Specular
            {
                if( specularColor != new ColorValue( 0, 0, 0 ) )
                    block.SetAttribute( "specularColor", specularColor.ToString() );
                if( specularPower != 1 )
                    block.SetAttribute( "specularPower", specularPower.ToString() );

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

                if( specularMap.IsDataExists() )
                {
                    TextBlock specularMapBlock = block.AddChild( "specularMap" );
                    specularMap.Save( specularMapBlock );
                }

                if( specularShininess != 20 )
                    block.SetAttribute( "specularShininess", specularShininess.ToString() );
            }

            //Height
            {
                if( normalMap.IsDataExists() )
                {
                    TextBlock normalMapBlock = block.AddChild( "normalMap" );
                    normalMap.Save( normalMapBlock );
                }

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

                if( heightMap.IsDataExists() )
                {
                    TextBlock heightMapBlock = block.AddChild( "heightMap" );
                    heightMap.Save( heightMapBlock );
                }

                if( heightScale != .04f )
                    block.SetAttribute( "heightScale", heightScale.ToString() );
            }
        }
            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;
                }
            }
            public static void Save(SystemJoystickValue item, TextBlock block)
            {
                block.SetAttribute("type", item.Type.ToString());
                switch (item.Type)
                {
                    case Types.Button:
                        block.SetAttribute("button", item.Button.ToString());
                        block.SetAttribute("strength", item.strength.ToString());
                        break;

                    case Types.Axis:
                        block.SetAttribute("axis", item.Axis.ToString());
                        block.SetAttribute("axisfilter", item.AxisFilter.ToString());
                        block.SetAttribute("strength", item.strength.ToString());
                        break;

                    case Types.POV:
                        block.SetAttribute("POV", item.POV.ToString());
                        block.SetAttribute("POVDirection", item.POVDirection.ToString());
                        block.SetAttribute("strength", item.strength.ToString());
                        break;

                    case Types.Slider:
                        block.SetAttribute("slider", item.Slider.ToString());
                        block.SetAttribute("sliderAxis", item.SliderAxis.ToString());
                        block.SetAttribute("axisfilter", item.AxisFilter.ToString());
                        block.SetAttribute("strength", item.strength.ToString());
                        break;
                }
            }
        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;
            }
        }
 protected override void OnSave(TextBlock block)
 {
     base.OnSave(block);
     block.SetAttribute("reachDistance", reachDistance.ToString());
 }
 protected virtual void OnSave(TextBlock block)
 {
     if (taskPosition != Vec3.Zero)
         block.SetAttribute("taskPosition", taskPosition.ToString());
     if (taskEntity != null)
         block.SetAttribute("taskEntity", taskEntity.UIN.ToString());
 }
Example #14
0
File: Gun.cs Project: whztt07/SDK
        protected override void OnSave( TextBlock block )
        {
            base.OnSave( block );

            if( currentFireMode != null )
            {
                if( currentFireMode == normalMode )
                    block.SetAttribute( "currentFireMode", "normal" );
                else
                    block.SetAttribute( "currentFireMode", "alternative" );
            }
        }
Example #15
0
 public void Save( TextBlock block )
 {
     if( scrollSpeed != Vec2.Zero )
         block.SetAttribute( "scrollSpeed", scrollSpeed.ToString() );
     if( scrollRound != Vec2.Zero )
         block.SetAttribute( "scrollRound", scrollRound.ToString() );
     if( rotateSpeed != 0 )
         block.SetAttribute( "rotateSpeed", rotateSpeed.ToString() );
 }
Example #16
0
        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() );
            }
        }
Example #17
0
 protected override void OnSave( TextBlock block )
 {
     base.OnSave( block );
     if( Dimensions != new Vec3( 1, 1, 1 ) )
         block.SetAttribute( "dimensions", Dimensions.ToString() );
 }