TiledMapImageContent.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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.Xml.Serialization;
  5. using Microsoft.Xna.Framework;
  6. namespace MonoGame.Extended.Content.Tiled;
  7. public class TiledMapImageContent
  8. {
  9. //[XmlIgnore]
  10. //public Texture2DContent Content { get; set; }
  11. //[XmlIgnore]
  12. //public ExternalReference<Texture2DContent> ContentRef { get; set; }
  13. [XmlAttribute(AttributeName = "source")]
  14. public string Source { get; set; }
  15. [XmlAttribute(AttributeName = "width")]
  16. public int Width { get; set; }
  17. [XmlAttribute(AttributeName = "height")]
  18. public int Height { get; set; }
  19. [XmlAttribute(AttributeName = "format")]
  20. public string Format { get; set; }
  21. [XmlAttribute(AttributeName = "trans")]
  22. public string RawTransparentColor { get; set; } = string.Empty;
  23. [XmlIgnore]
  24. public Color TransparentColor
  25. {
  26. get => RawTransparentColor == string.Empty ? Color.Transparent : ColorHelper.FromHex(RawTransparentColor);
  27. set => RawTransparentColor = ColorHelper.ToHex(value);
  28. }
  29. [XmlElement(ElementName = "data")]
  30. public TiledMapTileLayerDataContent Data { get; set; }
  31. public override string ToString()
  32. {
  33. return Source;
  34. }
  35. }