本文整理汇总了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);
}
示例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() );
}
}
示例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() );
}
示例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 );
}
}
示例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
//.........这里部分代码省略.........
示例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 );
}
//.........这里部分代码省略.........
示例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;
}
}
示例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;
}
}
示例9: OnSave
protected override void OnSave(TextBlock block)
{
base.OnSave(block);
block.SetAttribute("reachDistance", reachDistance.ToString());
}
示例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" );
}
}
示例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() );
}
}
示例12: OnSave
protected override void OnSave( TextBlock block )
{
base.OnSave( block );
if( Dimensions != new Vec3( 1, 1, 1 ) )
block.SetAttribute( "dimensions", Dimensions.ToString() );
}