CharacterPartCache.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace UnityEditor.U2D.Animation
  5. {
  6. [Serializable]
  7. internal class CharacterGroupCache : SkinningObject, ICharacterOrder
  8. {
  9. [SerializeField]
  10. public int parentGroup;
  11. [SerializeField]
  12. private bool m_IsVisible = true;
  13. [SerializeField]
  14. private int m_Order = -1;
  15. public bool isVisible
  16. {
  17. get => m_IsVisible;
  18. set
  19. {
  20. m_IsVisible = value;
  21. skinningCache.GroupVisibilityChanged(this);
  22. }
  23. }
  24. public virtual int order
  25. {
  26. get => m_Order;
  27. set => m_Order = value;
  28. }
  29. }
  30. internal class CharacterPartCache : TransformCache, ICharacterOrder
  31. {
  32. [SerializeField]
  33. private SpriteCache m_Sprite;
  34. [SerializeField]
  35. private List<BoneCache> m_Bones = new List<BoneCache>();
  36. [SerializeField]
  37. private bool m_IsVisible = true;
  38. [SerializeField]
  39. private int m_ParentGroup = -1;
  40. [SerializeField]
  41. private int m_Order = -1;
  42. public virtual int order
  43. {
  44. get => m_Order;
  45. set => m_Order = value;
  46. }
  47. public int parentGroup
  48. {
  49. get { return m_ParentGroup; }
  50. set { m_ParentGroup = value; }
  51. }
  52. public virtual bool isVisible
  53. {
  54. get { return m_IsVisible; }
  55. set
  56. {
  57. m_IsVisible = value;
  58. if (skinningCache != null)
  59. skinningCache.SpriteVisibilityChanged(this);
  60. }
  61. }
  62. public int BoneCount { get { return m_Bones.Count; } }
  63. public virtual SpriteCache sprite
  64. {
  65. get { return m_Sprite; }
  66. set { m_Sprite = value; }
  67. }
  68. public BoneCache[] bones
  69. {
  70. get { return m_Bones.ToArray(); }
  71. set { m_Bones = new List<BoneCache>(value); }
  72. }
  73. public BoneCache GetBone(int index)
  74. {
  75. return m_Bones[index];
  76. }
  77. public int IndexOf(BoneCache bone)
  78. {
  79. return m_Bones.IndexOf(bone);
  80. }
  81. public bool Contains(BoneCache bone)
  82. {
  83. return m_Bones.Contains(bone);
  84. }
  85. }
  86. }