暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. using System;
  2. using Unity.Collections;
  3. using UnityEngine;
  4. namespace UnityEditor.U2D.PSD
  5. {
  6. [Serializable]
  7. class PSDLayer : IPSDLayerMappingStrategyComparable
  8. {
  9. [SerializeField]
  10. string m_Name;
  11. [SerializeField]
  12. string m_SpriteName;
  13. [SerializeField]
  14. bool m_IsGroup;
  15. [SerializeField]
  16. int m_ParentIndex;
  17. [SerializeField]
  18. string m_SpriteID;
  19. [SerializeField]
  20. int m_LayerID;
  21. [SerializeField]
  22. Vector2Int m_MosaicPosition;
  23. [SerializeField]
  24. bool m_Flatten;
  25. [SerializeField]
  26. bool m_IsImported;
  27. [SerializeField]
  28. bool m_IsVisible;
  29. [NonSerialized]
  30. Vector2 m_LayerPosition;
  31. [NonSerialized]
  32. GameObject m_GameObject;
  33. public PSDLayer(NativeArray<Color32> tex, int parent, bool group, string layerName, int width, int height, int id, bool hidden)
  34. {
  35. isGroup = group;
  36. parentIndex = parent;
  37. texture = tex;
  38. name = layerName;
  39. this.width = width;
  40. this.height = height;
  41. layerID = id;
  42. m_Flatten = false;
  43. m_IsImported = false;
  44. m_IsVisible = hidden;
  45. m_SpriteID = new GUID().ToString();
  46. }
  47. public PSDLayer(PSDLayer layer)
  48. {
  49. m_Name = layer.m_Name;
  50. m_SpriteName = layer.m_SpriteName;
  51. m_IsGroup = layer.m_IsGroup;
  52. m_ParentIndex = layer.m_ParentIndex;
  53. m_SpriteID = layer.m_SpriteID;
  54. m_LayerID = layer.m_LayerID;
  55. m_MosaicPosition = layer.m_MosaicPosition;
  56. m_Flatten = layer.m_Flatten;
  57. m_IsImported = layer.m_IsImported;
  58. m_IsVisible = layer.m_IsVisible;
  59. m_LayerPosition = layer.m_LayerPosition;
  60. m_GameObject = layer.m_GameObject;
  61. width = layer.width;
  62. height = layer.height;
  63. texture = layer.texture;
  64. }
  65. public bool isVisible => m_IsVisible;
  66. public int layerID { get { return m_LayerID; } private set { m_LayerID = value; } }
  67. public string name { get { return m_Name; } private set { m_Name = value; } }
  68. public string spriteName { get { return m_SpriteName; } set { m_SpriteName = value; } }
  69. public bool isGroup { get { return m_IsGroup; } private set { m_IsGroup = value; } }
  70. public int parentIndex { get { return m_ParentIndex; } private set { m_ParentIndex = value; } }
  71. public Vector2Int mosaicPosition { get { return m_MosaicPosition; } set { m_MosaicPosition = value; } }
  72. public GUID spriteID { get { return new GUID(m_SpriteID); } set { m_SpriteID = value.ToString(); } }
  73. public Vector2 layerPosition { get => m_LayerPosition; set => m_LayerPosition = value; }
  74. public GameObject gameObject { get { return m_GameObject; } set { m_GameObject = value; } }
  75. public bool flatten
  76. {
  77. get => m_Flatten;
  78. set => m_Flatten = value;
  79. }
  80. public bool isImported
  81. {
  82. get => m_IsImported;
  83. set => m_IsImported = value;
  84. }
  85. public NativeArray<Color32> texture { get; set; }
  86. public int width { get; set; }
  87. public int height { get; set; }
  88. public void Dispose()
  89. {
  90. if (texture.IsCreated)
  91. texture.Dispose();
  92. }
  93. }
  94. }