You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.5 KiB

  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. namespace TMPro.SpriteAssetUtilities
  5. {
  6. public enum SpriteAssetImportFormats { None = 0, TexturePacker = 0x1 };
  7. public class TexturePacker
  8. {
  9. [System.Serializable]
  10. public struct SpriteFrame
  11. {
  12. public float x;
  13. public float y;
  14. public float w;
  15. public float h;
  16. public override string ToString()
  17. {
  18. string s = "x: " + x.ToString("f2") + " y: " + y.ToString("f2") + " h: " + h.ToString("f2") + " w: " + w.ToString("f2");
  19. return s;
  20. }
  21. }
  22. [System.Serializable]
  23. public struct SpriteSize
  24. {
  25. public float w;
  26. public float h;
  27. public override string ToString()
  28. {
  29. string s = "w: " + w.ToString("f2") + " h: " + h.ToString("f2");
  30. return s;
  31. }
  32. }
  33. [System.Serializable]
  34. public struct SpriteData
  35. {
  36. public string filename;
  37. public SpriteFrame frame;
  38. public bool rotated;
  39. public bool trimmed;
  40. public SpriteFrame spriteSourceSize;
  41. public SpriteSize sourceSize;
  42. public Vector2 pivot;
  43. }
  44. [System.Serializable]
  45. public class SpriteDataObject
  46. {
  47. public List<SpriteData> frames;
  48. }
  49. }
  50. }