TiledMapPropertyContent.cs 812 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright (c) Craftwork Games. All rights reserved.
  2. // Licensed under the MIT license.
  3. // See LICENSE file in the project root for full license information.
  4. using System.Collections.Generic;
  5. using System.Xml.Serialization;
  6. namespace MonoGame.Extended.Content.Tiled;
  7. public class TiledMapPropertyContent
  8. {
  9. [XmlAttribute(AttributeName = "name")]
  10. public string Name { get; set; }
  11. [XmlAttribute(AttributeName = "value")]
  12. public string ValueAttribute { get; set; }
  13. [XmlText]
  14. public string ValueBody { get; set; }
  15. [XmlArray("properties")]
  16. [XmlArrayItem("property")]
  17. public List<TiledMapPropertyContent> Properties { get; set; }
  18. public string Value => ValueAttribute ?? ValueBody;
  19. public override string ToString()
  20. {
  21. return $"{Name}: {Value}";
  22. }
  23. }