RoleCustomBoneData.cs 4.9 KB

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