Ejemplo n.º 1
0
 /// <summary>
 /// Adds a refraction effect to the map as long as it does not already exist in the map's refraction effect collection.
 /// </summary>
 /// <param name="fx">The <see cref="IRefractionEffect"/> to add.</param>
 public void AddRefractionEffect(IRefractionEffect fx)
 {
     if (!_refractionEffects.Contains(fx))
     {
         _refractionEffects.Add(fx);
     }
 }
Ejemplo n.º 2
0
        /// <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);
        }
Ejemplo n.º 3
0
        /// <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);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Removes a refraction effect from the map.
 /// </summary>
 /// <param name="fx">The <see cref="IRefractionEffect"/> to add.</param>
 /// <returns>True if the <paramref name="fx"/> was removed; false if the <paramref name="fx"/> was not
 /// in the map's refraction effect collection and thus not removed.</returns>
 public bool RemoveLight(IRefractionEffect fx)
 {
     return(_refractionEffects.Remove(fx));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Removes the first occurrence of a specific object from the <see cref="T:System.Collections.Generic.ICollection`1"/>.
 /// </summary>
 /// <param name="item">The object to remove from the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param>
 /// <returns>
 /// true if <paramref name="item"/> was successfully removed from the <see cref="T:System.Collections.Generic.ICollection`1"/>;
 /// otherwise, false. This method also returns false if <paramref name="item"/> is not found in the original
 /// <see cref="T:System.Collections.Generic.ICollection`1"/>.
 /// </returns>
 /// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.
 /// </exception>
 public bool Remove(IRefractionEffect item)
 {
     return _list.Remove(item);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Inserts an item to the <see cref="T:System.Collections.Generic.IList`1"/> at the specified index.
 /// </summary>
 /// <param name="index">The zero-based index at which <paramref name="item"/> should be inserted.</param>
 /// <param name="item">The object to insert into the <see cref="T:System.Collections.Generic.IList`1"/>.</param>
 /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index"/> is not a valid index in the
 /// <see cref="T:System.Collections.Generic.IList`1"/>.
 /// </exception>
 /// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.IList`1"/> is read-only.
 /// </exception>
 public void Insert(int index, IRefractionEffect item)
 {
     _list.Insert(index, item);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Determines the index of a specific item in the <see cref="T:System.Collections.Generic.IList`1"/>.
 /// </summary>
 /// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.IList`1"/>.</param>
 /// <returns>
 /// The index of <paramref name="item"/> if found in the list; otherwise, -1.
 /// </returns>
 public int IndexOf(IRefractionEffect item)
 {
     return _list.IndexOf(item);
 }
Ejemplo n.º 8
0
 /// <summary>
 /// Adds an item to the <see cref="T:System.Collections.Generic.ICollection`1"/>.
 /// </summary>
 /// <param name="item">The object to add to the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param>
 /// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.
 /// </exception>
 public void Add(IRefractionEffect item)
 {
     _list.Add(item);
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Determines whether the <see cref="T:System.Collections.Generic.ICollection`1"/> contains a specific value.
 /// </summary>
 /// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param>
 /// <returns>
 /// true if <paramref name="item"/> is found in the <see cref="T:System.Collections.Generic.ICollection`1"/>; otherwise, false.
 /// </returns>
 public bool Contains(IRefractionEffect item)
 {
     return _list.Contains(item);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Adds an item to the <see cref="T:System.Collections.Generic.ICollection`1"/>.
 /// </summary>
 /// <param name="item">The object to add to the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param>
 /// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.
 /// </exception>
 public void Add(IRefractionEffect item)
 {
     _list.Add(item);
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Removes the first occurrence of a specific object from the <see cref="T:System.Collections.Generic.ICollection`1"/>.
 /// </summary>
 /// <param name="item">The object to remove from the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param>
 /// <returns>
 /// true if <paramref name="item"/> was successfully removed from the <see cref="T:System.Collections.Generic.ICollection`1"/>;
 /// otherwise, false. This method also returns false if <paramref name="item"/> is not found in the original
 /// <see cref="T:System.Collections.Generic.ICollection`1"/>.
 /// </returns>
 /// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1"/> is read-only.
 /// </exception>
 public bool Remove(IRefractionEffect item)
 {
     return(_list.Remove(item));
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Inserts an item to the <see cref="T:System.Collections.Generic.IList`1"/> at the specified index.
 /// </summary>
 /// <param name="index">The zero-based index at which <paramref name="item"/> should be inserted.</param>
 /// <param name="item">The object to insert into the <see cref="T:System.Collections.Generic.IList`1"/>.</param>
 /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="index"/> is not a valid index in the
 /// <see cref="T:System.Collections.Generic.IList`1"/>.
 /// </exception>
 /// <exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.IList`1"/> is read-only.
 /// </exception>
 public void Insert(int index, IRefractionEffect item)
 {
     _list.Insert(index, item);
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Determines the index of a specific item in the <see cref="T:System.Collections.Generic.IList`1"/>.
 /// </summary>
 /// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.IList`1"/>.</param>
 /// <returns>
 /// The index of <paramref name="item"/> if found in the list; otherwise, -1.
 /// </returns>
 public int IndexOf(IRefractionEffect item)
 {
     return(_list.IndexOf(item));
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Determines whether the <see cref="T:System.Collections.Generic.ICollection`1"/> contains a specific value.
 /// </summary>
 /// <param name="item">The object to locate in the <see cref="T:System.Collections.Generic.ICollection`1"/>.</param>
 /// <returns>
 /// true if <paramref name="item"/> is found in the <see cref="T:System.Collections.Generic.ICollection`1"/>; otherwise, false.
 /// </returns>
 public bool Contains(IRefractionEffect item)
 {
     return(_list.Contains(item));
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Adds a refraction effect to the map as long as it does not already exist in the map's refraction effect collection.
 /// </summary>
 /// <param name="fx">The <see cref="IRefractionEffect"/> to add.</param>
 public void AddRefractionEffect(IRefractionEffect fx)
 {
     if (!_refractionEffects.Contains(fx))
         _refractionEffects.Add(fx);
 }
Ejemplo n.º 16
0
 /// <summary>
 /// Removes a refraction effect from the map.
 /// </summary>
 /// <param name="fx">The <see cref="IRefractionEffect"/> to add.</param>
 /// <returns>True if the <paramref name="fx"/> was removed; false if the <paramref name="fx"/> was not
 /// in the map's refraction effect collection and thus not removed.</returns>
 public bool RemoveLight(IRefractionEffect fx)
 {
     return _refractionEffects.Remove(fx);
 }
Ejemplo n.º 17
0
 /// <summary>
 /// Copies the elements of the <see cref="T:System.Collections.Generic.ICollection`1"/> to an <see cref="T:System.Array"/>,
 /// starting at a particular <see cref="T:System.Array"/> index.
 /// </summary>
 /// <param name="array">The one-dimensional <see cref="T:System.Array"/> that is the destination of the elements copied from
 /// <see cref="T:System.Collections.Generic.ICollection`1"/>. The <see cref="T:System.Array"/> must have zero-based indexing.</param>
 /// <param name="arrayIndex">The zero-based index in <paramref name="array"/> at which copying begins.</param>
 /// <exception cref="T:System.ArgumentNullException"><paramref name="array"/> is null.
 /// </exception>
 /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="arrayIndex"/> is less than 0.
 /// </exception>
 /// <exception cref="T:System.ArgumentException"><paramref name="array"/> is multidimensional.
 /// -or-
 /// <paramref name="arrayIndex"/> is equal to or greater than the length of <paramref name="array"/>.
 /// -or-
 /// The number of elements in the source <see cref="T:System.Collections.Generic.ICollection`1"/> is greater than the
 /// available space from <paramref name="arrayIndex"/> to the end of the destination <paramref name="array"/>.
 /// -or-
 /// Type <see cref="IRefractionEffect"/> cannot be cast automatically to the type of the destination <paramref name="array"/>.
 /// </exception>
 public void CopyTo(IRefractionEffect[] array, int arrayIndex)
 {
     _list.CopyTo(array, arrayIndex);
 }