本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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 );
}
示例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 );
}
示例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;
}
示例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;
}
示例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" );
//.........这里部分代码省略.........
示例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;
}
示例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;
}
示例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" ) );
}
}
示例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;
}