本文整理汇总了C#中IValueWriter.WriteStartNode方法的典型用法代码示例。如果您正苦于以下问题:C# IValueWriter.WriteStartNode方法的具体用法?C# IValueWriter.WriteStartNode怎么用?C# IValueWriter.WriteStartNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IValueWriter
的用法示例。
在下文中一共展示了IValueWriter.WriteStartNode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SaveRefractionEffects
void SaveRefractionEffects(IValueWriter w)
{
w.WriteStartNode(_refractionEffectsNodeName);
{
var validFx = _refractionEffects.Where(x => RefractionEffectFactory.IsValidType(x.GetType())).ToImmutable();
w.WriteManyNodes(_refractionEffectListNodeName, validFx, RefractionEffectFactory.Write);
}
w.WriteEndNode(_refractionEffectsNodeName);
}
示例2: WriteCustomValues
/// <summary>
/// When overridden in the derived class, writes the values unique to this derived type to the
/// <paramref name="writer"/>.
/// </summary>
/// <param name="writer">The <see cref="IValueWriter"/> to write to.</param>
protected override void WriteCustomValues(IValueWriter writer)
{
writer.Write(_automaticSizeValueKey, AutomaticSize);
writer.WriteStartNode(_textureNodeName);
writer.Write(_textureNameValueKey, TextureName);
writer.Write(_textureSourceValueKey, OriginalSourceRect);
writer.WriteEndNode(_textureNodeName);
}
示例3: SaveGrhs
/// <summary>
/// Writes all the MapGrhs to an <see cref="IValueWriter"/>.
/// </summary>
/// <param name="w">IValueWriter to write to.</param>
void SaveGrhs(IValueWriter w)
{
w.WriteStartNode(_mapGrhsNodeName);
{
// Used GrhIndexes
w.WriteMany(_usedIndiciesNodeName, GetMapGrhList(), w.Write);
// MapGrhs
w.WriteManyNodes(_mapGrhsNodeName, Spatial.GetMany<MapGrh>().Distinct(),
((writer, item) => item.WriteState(writer)));
}
w.WriteEndNode(_mapGrhsNodeName);
}
示例4: SaveLighting
void SaveLighting(IValueWriter w)
{
w.WriteStartNode(_lightingNodeName);
{
w.Write("Ambient", AmbientLight);
w.WriteManyNodes(_lightsNodeName, _lights.ToArray(), (wr, l) => l.WriteState(wr));
}
w.WriteEndNode(_lightingNodeName);
}
示例5: Write
/// <summary>
/// Writes the statistics to an <see cref="IValueWriter"/>.
/// </summary>
/// <param name="writer">The <see cref="IValueWriter"/> to write to.</param>
public void Write(IValueWriter writer)
{
foreach (var stat in GetAllStats())
{
var nodeName = "ID" + stat.ProcessorID;
writer.WriteStartNode(nodeName);
stat.Write(writer);
writer.WriteEndNode(nodeName);
}
}
示例6: Write
/// <summary>
/// Writes the <see cref="ParticleModifier"/> to the <paramref name="writer"/>.
/// </summary>
/// <param name="writer">The <see cref="IValueWriter"/> to write to.</param>
public void Write(IValueWriter writer)
{
var typeName = _typeFactory.GetTypeName(GetType());
writer.Write(_typeKeyName, typeName);
writer.WriteStartNode(_customValuesNodeName);
{
WriteState(writer);
}
writer.WriteEndNode(_customValuesNodeName);
}
示例7: Write
/// <summary>
/// Writes a <see cref="IRefractionEffect"/> to an <see cref="IValueWriter"/>.
/// </summary>
/// <param name="writer">The <see cref="IValueWriter"/> to write to.</param>
/// <param name="re">The <see cref="IRefractionEffect"/> to write.</param>
/// <exception cref="ArgumentException"><paramref name="re"/> is not in the <see cref="ValidTypes"/>.</exception>
/// <exception cref="ArgumentNullException"><paramref name="re"/> is null.</exception>
/// <exception cref="ArgumentNullException"><paramref name="writer"/> is null.</exception>
public static void Write(IValueWriter writer, IRefractionEffect re)
{
if (writer == null)
throw new ArgumentNullException("writer");
if (re == null)
throw new ArgumentNullException("re");
var asPersistable = re as IPersistable;
string typeName = null;
if (asPersistable != null)
typeName = Instance[re.GetType()];
if (typeName == null)
{
const string errmsg = "Type `{0}` is not a valid persistable IRefractionEffect type.";
if (log.IsErrorEnabled)
log.ErrorFormat(errmsg, re.GetType());
throw new ArgumentException(string.Format(errmsg, re.GetType()), "re");
}
writer.Write(_refractionEffectTypeKeyName, typeName);
writer.WriteStartNode(_refractionEffectNodeName);
{
asPersistable.WriteState(writer);
}
writer.WriteEndNode(_refractionEffectNodeName);
}
示例8: Write
/// <summary>
/// Writes the NPCChatDialogItemBase's values to an IValueWriter.
/// </summary>
/// <param name="writer">IValueWriter to write the values to.</param>
public void Write(IValueWriter writer)
{
writer.Write("Value", Value);
writer.Write("Page", Page);
writer.Write("Text", Text ?? string.Empty);
writer.WriteMany("Actions", Actions.Select(x => x.Name), writer.Write);
writer.WriteStartNode("Conditionals");
{
var c = Conditionals;
var hasConditionals = (c != null) && (!c.IsEmpty());
writer.Write("HasConditionals", hasConditionals);
if (hasConditionals)
c.Write(writer);
}
writer.WriteEndNode("Conditionals");
}
示例9: WriteState
/// <summary>
/// Writes the state of the object to an <see cref="IValueWriter"/>.
/// </summary>
/// <param name="writer">The <see cref="IValueWriter"/> to write the values to.</param>
public void WriteState(IValueWriter writer)
{
// Write the primary values
writer.Write(_nameKeyName, Name);
writer.Write(_blendModeKeyName, BlendMode);
writer.Write(_budgetKeyName, Budget);
writer.Write(_emitterLifeKeyName, EmitterLife);
writer.Write(_particleLifeKeyName, ParticleLife);
writer.Write(_originKeyName, Origin);
writer.Write(_releaseAmountKeyName, ReleaseAmount);
writer.Write(_releaseColorKeyName, ReleaseColor);
writer.Write(_releaseRateKeyName, ReleaseRate);
writer.Write(_releaseRotationKeyName, ReleaseRotation);
writer.Write(_releaseScaleKeyName, ReleaseScale);
writer.Write(_releaseSpeedKeyName, ReleaseSpeed);
writer.Write(_grhIndexKeyName, Sprite.GrhData != null ? Sprite.GrhData.GrhIndex : GrhIndex.Invalid);
// Write the custom values
writer.WriteStartNode(_customValuesNodeName);
{
WriteCustomValues(writer);
}
writer.WriteEndNode(_customValuesNodeName);
// Write the modifier collection
ParticleModifiers.Write(_particleModifiersNodeName, writer);
EmitterModifiers.Write(_emitterModifiersNodeName, writer);
}
示例10: Write
/// <summary>
/// Writes the NPCChatDialogItemBase's values to an IValueWriter.
/// </summary>
/// <param name="writer">IValueWriter to write the values to.</param>
public void Write(IValueWriter writer)
{
AssertBranchHasTwoResponses();
AssertNonBranchHasNoConditionals();
AssertResponsesHaveValidValues();
writer.Write("ID", ID);
writer.Write("Title", Title ?? string.Empty);
writer.Write("Text", Text ?? string.Empty);
writer.Write("IsBranch", IsBranch);
writer.WriteManyNodes("Responses", Responses, ((w, item) => item.Write(w)));
if (IsBranch)
{
writer.WriteStartNode("Conditionals");
{
var c = Conditionals;
var hasConditionals = (c != null) && (c.Count() > 0);
writer.Write("HasConditionals", hasConditionals);
if (hasConditionals)
c.Write(writer);
}
writer.WriteEndNode("Conditionals");
}
}
示例11: WriteState
/// <summary>
/// Writes the state of the object to an <see cref="IValueWriter"/>.
/// </summary>
/// <param name="writer">The <see cref="IValueWriter"/> to write the values to.</param>
public void WriteState(IValueWriter writer)
{
writer.WriteStartNode(_particleEffectNodeName);
{
// Write the effect properties
PersistableHelper.Write(this, writer);
// Write the emitters
writer.WriteManyNodes(_emittersNodeName, _emitters, ParticleEmitterFactory.Write);
}
writer.WriteEndNode(_particleEffectNodeName);
}
示例12: WriteKVP
/// <summary>
/// Writes a <see cref="KeyValuePair{T,U}"/> for a <see cref="Tool"/>.
/// </summary>
/// <param name="writer">The <see cref="IValueWriter"/> to write to.</param>
/// <param name="kvp">The value to write.</param>
static void WriteKVP(IValueWriter writer, KeyValuePair<string, Tool> kvp)
{
writer.Write(_kvpKeyName, kvp.Key);
writer.WriteStartNode(_kvpValueNodeName);
{
kvp.Value.WriteState(writer);
}
writer.WriteEndNode(_kvpValueNodeName);
}
示例13: WriteFilter
/// <summary>
/// Writes a filter to an <see cref="IValueWriter"/>.
/// </summary>
/// <param name="writer">The <see cref="IValueWriter"/> to write to.</param>
/// <param name="kvp">The filter name and object to write.</param>
static void WriteFilter(IValueWriter writer, KeyValuePair<string, MapDrawFilterHelper> kvp)
{
writer.Write(_filterKeyValueName, kvp.Key);
writer.WriteStartNode(_filterValueValueName);
{
kvp.Value.WriteState(writer);
}
writer.WriteEndNode(_filterValueValueName);
}
示例14: WriteCustomToolState
/// <summary>
/// Handles writing custom state information for this <see cref="Tool"/> to an <see cref="IValueWriter"/> for when
/// persisting the <see cref="Tool"/>'s state.
/// When possible, it is preferred that you use the <see cref="SyncValueAttribute"/> instead of manually handling
/// reading and writing the state.
/// </summary>
/// <param name="writer">The <see cref="IValueWriter"/> to write the values to.</param>
protected override void WriteCustomToolState(IValueWriter writer)
{
base.WriteCustomToolState(writer);
writer.WriteStartNode(_filterCollectionNodeName);
{
_filterCollection.WriteState(writer);
}
writer.WriteEndNode(_filterCollectionNodeName);
}
示例15: Write
/// <summary>
/// Writes a <see cref="ParticleEmitter"/> to an <see cref="IValueWriter"/>.
/// </summary>
/// <param name="writer">The <see cref="IValueWriter"/> to write to.</param>
/// <param name="emitter">The <see cref="ParticleEmitter"/> to write.</param>
public static void Write(IValueWriter writer, ParticleEmitter emitter)
{
writer.Write(_emitterTypeKeyName, Instance.GetTypeName(emitter.GetType()));
writer.WriteStartNode(_emitterNodeName);
{
emitter.WriteState(writer);
}
writer.WriteEndNode(_emitterNodeName);
}