/// <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> void IPersistable.WriteState(IValueWriter writer) { PersistableHelper.Write(this, writer); // Manually handle the WaveNoise sprite writer.Write(_valueKeyWaveNoise, WaveNoise.GrhData.GrhIndex); }
/// <summary> /// Reads the state of the object from an <see cref="IValueReader"/>. Values should be read in the exact /// same order as they were written. /// </summary> /// <param name="reader">The <see cref="IValueReader"/> to read the values from.</param> void IPersistable.ReadState(IValueReader reader) { PersistableHelper.Read(this, reader); // Manually handle the WaveNoise sprite var grhIndex = reader.ReadGrhIndex(_valueKeyWaveNoise); _waveNoise.SetGrh(grhIndex); }
/// <summary> /// Reads the state of the object from an <see cref="IValueReader"/>. Values should be read in the exact /// same order as they were written. /// </summary> /// <param name="reader">The <see cref="IValueReader"/> to read the values from.</param> public virtual void ReadState(IValueReader reader) { var grhIndex = reader.ReadGrhIndex(_grhIndexKeyName); if (!grhIndex.IsInvalid) { _grh.SetGrh(grhIndex); } PersistableHelper.Read(this, reader); }
/// <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); }
/// <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> void IPersistable.WriteState(IValueWriter writer) { PersistableHelper.Write(this, writer); /* * writer.Write(_keyID, ID); * * writer.Write(_keyHasSound, Sound.HasValue); * writer.Write(_keySoundID, (Sound.HasValue ? Sound.Value : new SoundID(0))); * * writer.Write(_keyScript, Script); * writer.Write(_keyGrhIndex, GrhIndex); * writer.Write(_keyParticleEffect, ParticleEffect);*/ }
/// <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) { PersistableHelper.Write(this, writer); // Equipped bodies Debug.Assert(_equippedBodies.Count <= byte.MaxValue); writer.Write("EquippedBodiesCount", (byte)_equippedBodies.Count); for (var i = 0; i < _equippedBodies.Count; i++) { writer.Write("EquippedBody_" + i, _equippedBodies[i]); } }
/// <summary> /// Reads the state of the object from an <see cref="IValueReader"/>. Values should be read in the exact /// same order as they were written. /// </summary> /// <param name="reader">The <see cref="IValueReader"/> to read the values from.</param> void IPersistable.ReadState(IValueReader reader) { PersistableHelper.Read(this, reader); /* * _id = reader.ReadActionDisplayID(_keyID); * * var hasSound = reader.ReadBool(_keyHasSound); * var soundID = reader.ReadSoundID(_keySoundID); * _sound = (hasSound ? soundID : (SoundID?)null); * * _script = reader.ReadString(_keyScript); * _grhIndex = reader.ReadGrhIndex(_keyGrhIndex); * _particleEffect = reader.ReadString(_keyParticleEffect);*/ }
/// <summary> /// Reads the state of the object from an <see cref="IValueReader"/>. Values should be read in the exact /// same order as they were written. /// </summary> /// <param name="reader">The <see cref="IValueReader"/> to read the values from.</param> public void ReadState(IValueReader reader) { PersistableHelper.Read(this, reader); // Equipped bodies int count = reader.ReadByte("EquippedBodiesCount"); _equippedBodies.Clear(); for (var i = 0; i < count; i++) { var s = reader.ReadString("EquippedBody_" + i); _equippedBodies.Add(s); } }
/// <summary> /// Reads the state of the object from an <see cref="IValueReader"/>. Values should be read in the exact /// same order as they were written. /// </summary> /// <param name="reader">The <see cref="IValueReader"/> to read the values from.</param> public void ReadState(IValueReader reader) { reader = reader.ReadNode(_particleEffectNodeName); // Clear the emitters foreach (var e in _emitters.ToImmutable()) { e.Dispose(); } Debug.Assert(_emitters.IsEmpty()); _emitters.Clear(); // Read the effect properties PersistableHelper.Read(this, reader); // Read the emitters var readEmitters = reader.ReadManyNodes(_emittersNodeName, r => ParticleEmitterFactory.Read(r, this)); Debug.Assert(readEmitters.All(x => x.Owner == this)); }
/// <summary> /// Reads the state of the object from an <see cref="IValueReader"/>. /// </summary> /// <param name="reader">The <see cref="IValueReader"/> to read the values from.</param> public virtual void ReadState(IValueReader reader) { PersistableHelper.Read(this, reader); }
/// <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 virtual void WriteState(IValueWriter writer) { writer.Write(_multilineValueKey, Multiline); writer.Write(_textValueKey, Text); PersistableHelper.Write(this, writer); }
/// <summary> /// Load settings. /// </summary> /// <param name="storage">Settings storage.</param> public void Load(SettingsStorage storage) { Name = storage.GetValue <string>(nameof(Name)); IsExtended = storage.GetValue <bool>(nameof(IsExtended)); //Number = storage.GetValue<int>(nameof(Number)); Values.AddRange(storage.GetValue <SettingsStorage[]>(nameof(Values)).Select(s => PersistableHelper.Load <FieldMappingValue>(s))); DefaultValue = storage.GetValue <string>(nameof(DefaultValue)); Format = storage.GetValue <string>(nameof(Format)); IsEnabled = storage.GetValue(nameof(IsEnabled), IsEnabled); }
/// <summary> /// Create a copy of <see cref="IIndicator"/>. /// </summary> /// <returns>Copy.</returns> public override IIndicator Clone() { return(PersistableHelper.Clone(this)); }
/// <summary> /// Reads the state of the object from an <see cref="IValueReader"/>. Values should be read in the exact /// same order as they were written. /// </summary> /// <param name="reader">The <see cref="IValueReader"/> to read the values from.</param> public virtual void ReadState(IValueReader reader) { Multiline = reader.ReadBool(_multilineValueKey); Text = reader.ReadString(_textValueKey); PersistableHelper.Read(this, reader); }
/// <summary> /// Reads the state of the object from an <see cref="IValueReader"/>. Values should be read in the exact /// same order as they were written. /// </summary> /// <param name="reader">The <see cref="IValueReader"/> to read the values from.</param> public void ReadState(IValueReader reader) { PersistableHelper.Read(this, reader); ReadCustomToolState(reader); }
/// <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) { PersistableHelper.Write(this, writer); WriteCustomToolState(writer); }
/// <summary> /// Reads the state of the object from an <see cref="IValueReader"/>. Values should be read in the exact /// same order as they were written. /// </summary> /// <param name="reader">The <see cref="IValueReader"/> to read the values from.</param> public virtual void ReadState(IValueReader reader) { Location = reader.ReadSystemPoint(_locationValueKey); Size = reader.ReadSize(_sizeValueKey); PersistableHelper.Read(this, reader); }
/// <summary> /// Reads the state of the object from an <see cref="IValueReader"/>. Values should be read in the exact /// same order as they were written. /// </summary> /// <param name="reader">The <see cref="IValueReader"/> to read the values from.</param> public virtual void ReadState(IValueReader reader) { Checked = reader.ReadBool(_checkedValueKey); PersistableHelper.Read(this, reader); }
/// <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 virtual void WriteState(IValueWriter writer) { writer.Write(_grhIndexKeyName, Grh.GrhData != null ? Grh.GrhData.GrhIndex : GrhIndex.Invalid); PersistableHelper.Write(this, writer); }
/// <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 virtual void WriteState(IValueWriter writer) { writer.Write(_locationValueKey, Location); writer.Write(_sizeValueKey, Size); PersistableHelper.Write(this, writer); }
/// <summary> /// Create a copy of <see cref="AlertRuleField"/>. /// </summary> /// <returns>Copy.</returns> public override AlertRuleField Clone() { return(PersistableHelper.Clone(this)); }
/// <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 virtual void WriteState(IValueWriter writer) { writer.Write(_checkedValueKey, Checked); PersistableHelper.Write(this, writer); }
/// <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> void IPersistable.WriteState(IValueWriter writer) { PersistableHelper.Write(this, writer); }
/// <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 virtual void WriteState(IValueWriter writer) { PersistableHelper.Write(this, writer); }
/// <summary> /// Reads the state of the object from an <see cref="IValueReader"/>. Values should be read in the exact /// same order as they were written. /// </summary> /// <param name="reader">The <see cref="IValueReader"/> to read the values from.</param> void IPersistable.ReadState(IValueReader reader) { PersistableHelper.Read(this, reader); }