RoleCustomBoneData.cs 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace MetaClient
  5. {
  6. public class RoleCustomData
  7. {
  8. public Dictionary<int, PartData> bodyList;
  9. public Dictionary<int, PartData> faceList;
  10. public Dictionary<int, Vector3> colorList;
  11. public Dictionary<int, int> spriteList;
  12. /// <summary>
  13. /// 初始缩放
  14. /// </summary>
  15. public Dictionary<string, Vector3> orginLocalScaleList;
  16. /// <summary>
  17. /// 缩放总系数
  18. /// </summary>
  19. public Dictionary<string, Vector3> orginChangeScaleList;
  20. /// <summary>
  21. /// 实际缩放值
  22. /// </summary>
  23. public Dictionary<string, Vector3> ChangedScaleParamsList;
  24. public Dictionary<string, Vector3> orginLocalPositionList;
  25. public Dictionary<string, Vector3> orginLocalRotationList;
  26. public Dictionary<string, float> orginBlendList;
  27. public Dictionary<int, float> changedValueList;
  28. public Dictionary<string, Vector3> changedScaleList;
  29. public Dictionary<string, Vector3> changedPositionList;
  30. public Dictionary<string, Vector3> changedRotationList;
  31. public RoleCustomData ()
  32. {
  33. bodyList = new Dictionary<int, PartData>();
  34. faceList = new Dictionary<int, PartData>();
  35. colorList = new Dictionary<int, Vector3>();
  36. spriteList = new Dictionary<int, int>();
  37. orginLocalScaleList = new Dictionary<string, Vector3>();
  38. orginChangeScaleList = new Dictionary<string, Vector3>();
  39. ChangedScaleParamsList = new Dictionary<string, Vector3>();
  40. orginLocalPositionList = new Dictionary<string, Vector3>();
  41. orginLocalRotationList = new Dictionary<string, Vector3>();
  42. orginBlendList = new Dictionary<string, float>();
  43. changedValueList = new Dictionary<int, float>();
  44. changedScaleList = new Dictionary<string, Vector3>();
  45. changedPositionList = new Dictionary<string, Vector3>();
  46. changedRotationList = new Dictionary<string, Vector3>();
  47. }
  48. }
  49. public class PartData
  50. {
  51. public int id;
  52. public EditableBodyPart part;
  53. public ModifyType modifyType;
  54. public float floatValue;
  55. public Vector3 vecValue;
  56. public string pathValue;
  57. public string[] bones;
  58. //使用变形器
  59. public string biggerBlendName;
  60. public string smallerBlendName;
  61. public bool useBlend;
  62. public bool oneBlend;
  63. public string[] extraBones = null;
  64. public bool keepChild = true;
  65. public bool isMirror;
  66. public float minChangeValue;
  67. public float maxChangeValue;
  68. public Vector3 scaleChange;
  69. public Vector3 positionChange;
  70. public Vector3 rotationChange;
  71. public PartData(int _id,EditableBodyPart _part, ModifyType _modifyType)
  72. {
  73. id = _id;
  74. part = _part;
  75. modifyType = _modifyType;
  76. floatValue = 1;
  77. vecValue = Vector3.zero;
  78. pathValue = "";
  79. }
  80. public PartData(int _id,string[] _bones,float _min,float _max,Vector3 _scaleChange,Vector3 _posChange,Vector3 _rotChange,bool _useBlend,string _bigBlendName,string _smallBlendName,float _defaultValue = 0,string _extrabone = "",bool _keepChildScale = true,bool _isMirror = false)
  81. {
  82. id = _id;
  83. vecValue = Vector3.zero;
  84. pathValue = "";
  85. bones = _bones;
  86. scaleChange = _scaleChange;
  87. positionChange = _posChange;
  88. rotationChange = _rotChange;
  89. useBlend = _useBlend;
  90. biggerBlendName = _bigBlendName;
  91. smallerBlendName = _smallBlendName;
  92. isMirror = _isMirror;
  93. if (biggerBlendName == "" || biggerBlendName == "no" || smallerBlendName == "" || smallerBlendName == "no")
  94. {
  95. oneBlend = true;
  96. }else
  97. {
  98. oneBlend = false;
  99. }
  100. if(_useBlend)
  101. {
  102. if (oneBlend)
  103. {
  104. floatValue = 0;
  105. }
  106. else
  107. {
  108. floatValue = 0.5f;
  109. }
  110. minChangeValue = 0;
  111. maxChangeValue = 1;
  112. }
  113. else
  114. {
  115. floatValue = 1;
  116. if (scaleChange.x == 1 || scaleChange.y == 1 || scaleChange.z == 1)
  117. {
  118. floatValue = 1;
  119. }
  120. if (positionChange.x == 1 || positionChange.y == 1 || positionChange.z == 1 || rotationChange.x == 1 || rotationChange.y == 1 || rotationChange.z == 1)
  121. {
  122. floatValue = 0;
  123. }
  124. minChangeValue = _min;
  125. maxChangeValue = _max;
  126. if(_extrabone != "")
  127. {
  128. extraBones = _extrabone.Split(',');
  129. }
  130. keepChild = _keepChildScale;
  131. }
  132. }
  133. }
  134. }