MatchingTwoDataManager.cs 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. using ET;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.Text.RegularExpressions;
  6. using UnityEngine;
  7. using Live2D.Cubism.Rendering;
  8. using FairyGUI;
  9. using UI.MatchingCompetition;
  10. namespace GFGGame
  11. {
  12. class MatchingLeftDataManager : SingletonBase<MatchingLeftDataManager>
  13. {
  14. //其他玩家信息用于展示
  15. public MatchingPhotoWorksData LeftRoleInfo = new MatchingPhotoWorksData();
  16. //人物位置信息
  17. public TransformData roleTransFormData = new TransformData();
  18. public GameObject roleGameobj;
  19. public int roleID = -1;
  20. //*********************搭配数据*********************************
  21. //需要传输的数据:MathingDressDate,DressUpBgID,DressPropIdList,TransformDataList,
  22. public DressUpData MathingDressDate = DressUpData.CreateDefault();
  23. public int DressUpBgID = 0;
  24. //*****这两个id放列表的最后面
  25. //边框id
  26. public int BorderID = 0;
  27. //NpcId
  28. public int NpcID = 0;
  29. //道具数据,一一对应
  30. //道具id
  31. public List<int> DressPropIdList = new List<int>();
  32. //道具位置信息
  33. public List<TransformData> TransformDataList = new List<TransformData>();
  34. public List<GameObject> itemGameObjs = new List<GameObject>();
  35. //***************************************************************
  36. //解析后台获取的信息
  37. public void AnalysisInfoToList()
  38. {
  39. List<int> dressitemIDList = new List<int>();
  40. List<int> propIDList = new List<int>();
  41. List<TransformData> transDataList = new List<TransformData>();
  42. for (int i = 0; i < LeftRoleInfo.JudgingInfo.CollocationInfoList.Count; i++)
  43. {
  44. if (LeftRoleInfo.JudgingInfo.CollocationInfoList[i].ItemId == roleID)
  45. {
  46. propIDList.Add(LeftRoleInfo.JudgingInfo.CollocationInfoList[i].ItemId);
  47. transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(LeftRoleInfo.JudgingInfo.CollocationInfoList[i].ClientPosition));
  48. }
  49. else
  50. {
  51. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(LeftRoleInfo.JudgingInfo.CollocationInfoList[i].ItemId);
  52. if (itemCfg != null && itemCfg.itemType == ConstItemType.DRESS_UP)
  53. {
  54. if (itemCfg.subType == 19 || itemCfg.subType == 17 || itemCfg.subType == 21 || itemCfg.subType == 22)
  55. {
  56. //记录道具和位置信息
  57. propIDList.Add(LeftRoleInfo.JudgingInfo.CollocationInfoList[i].ItemId);
  58. transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(LeftRoleInfo.JudgingInfo.CollocationInfoList[i].ClientPosition));
  59. if (itemCfg.resLayer2 == "t" || itemCfg.resLayer3 == "t")
  60. {
  61. propIDList.Add(-3);
  62. transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(LeftRoleInfo.JudgingInfo.CollocationInfoList[i].ClientPosition));
  63. }
  64. }
  65. else if (itemCfg != null && itemCfg.subType == ConstDressUpItemType.BEI_JING)
  66. {
  67. DressUpBgID = itemCfg.id;
  68. }
  69. else
  70. {
  71. dressitemIDList.Add(LeftRoleInfo.JudgingInfo.CollocationInfoList[i].ItemId);
  72. }
  73. }
  74. else if (itemCfg != null && itemCfg.itemType == ConstItemType.PHOTOGRAPH)
  75. {
  76. //记录道具和位置信息
  77. propIDList.Add(LeftRoleInfo.JudgingInfo.CollocationInfoList[i].ItemId);
  78. transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(LeftRoleInfo.JudgingInfo.CollocationInfoList[i].ClientPosition));
  79. }
  80. }
  81. }
  82. MathingDressDate.itemList = dressitemIDList;
  83. MathingDressDate.actionId = LeftRoleInfo.JudgingInfo.ActionId;
  84. DressPropIdList = propIDList;
  85. TransformDataList = transDataList;
  86. DressUpBgID = LeftRoleInfo.JudgingInfo.BagId;
  87. }
  88. public void InsertGameObjectList()
  89. {
  90. int indexRoleData = 0;
  91. for (int i = 0; i < DressPropIdList.Count; i++)
  92. {
  93. if (DressPropIdList[i] == roleID)
  94. {
  95. indexRoleData = i;
  96. }
  97. }
  98. if (itemGameObjs.Count == 0)
  99. {
  100. itemGameObjs.Add(roleGameobj);
  101. }
  102. else
  103. {
  104. if(indexRoleData > itemGameObjs.Count)
  105. {
  106. itemGameObjs.Add(roleGameobj);
  107. }
  108. else
  109. {
  110. itemGameObjs.Insert(indexRoleData, roleGameobj);
  111. }
  112. }
  113. }
  114. }
  115. class MatchingRightDataManager : SingletonBase<MatchingRightDataManager>
  116. {
  117. //其他玩家信息用于展示
  118. public MatchingPhotoWorksData RightRoleInfo = new MatchingPhotoWorksData();
  119. //人物位置信息
  120. public TransformData roleTransFormData = new TransformData();
  121. public GameObject roleGameobj;
  122. public int roleID = -1;
  123. //*********************搭配数据*********************************
  124. //需要传输的数据:MathingDressDate,DressUpBgID,DressPropIdList,TransformDataList,
  125. public DressUpData MathingDressDate = DressUpData.CreateDefault();
  126. public int DressUpBgID = 0;
  127. //*****这两个id放列表的最后面
  128. //边框id
  129. public int BorderID = 0;
  130. //NpcId
  131. public int NpcID = 0;
  132. //道具数据,一一对应
  133. //道具id
  134. public List<int> DressPropIdList = new List<int>();
  135. //道具位置信息
  136. public List<TransformData> TransformDataList = new List<TransformData>();
  137. public List<GameObject> itemGameObjs = new List<GameObject>();
  138. //***************************************************************
  139. //解析后台获取的信息
  140. public void AnalysisInfoToList()
  141. {
  142. List<int> dressitemIDList = new List<int>();
  143. List<int> propIDList = new List<int>();
  144. List<TransformData> transDataList = new List<TransformData>();
  145. for (int i = 0; i < RightRoleInfo.JudgingInfo.CollocationInfoList.Count; i++)
  146. {
  147. if (RightRoleInfo.JudgingInfo.CollocationInfoList[i].ItemId == roleID)
  148. {
  149. propIDList.Add(RightRoleInfo.JudgingInfo.CollocationInfoList[i].ItemId);
  150. transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(RightRoleInfo.JudgingInfo.CollocationInfoList[i].ClientPosition));
  151. }
  152. else
  153. {
  154. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(RightRoleInfo.JudgingInfo.CollocationInfoList[i].ItemId);
  155. if (itemCfg != null && itemCfg.itemType == ConstItemType.DRESS_UP)
  156. {
  157. if (itemCfg.subType == 19 || itemCfg.subType == 17 || itemCfg.subType == 21 || itemCfg.subType == 22)
  158. {
  159. //记录道具和位置信息
  160. propIDList.Add(RightRoleInfo.JudgingInfo.CollocationInfoList[i].ItemId);
  161. transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(RightRoleInfo.JudgingInfo.CollocationInfoList[i].ClientPosition));
  162. if ( itemCfg.resLayer2 == "t" || itemCfg.resLayer3 == "t")
  163. {
  164. propIDList.Add(-3);
  165. transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(RightRoleInfo.JudgingInfo.CollocationInfoList[i].ClientPosition));
  166. }
  167. }
  168. else if (itemCfg != null && itemCfg.subType == ConstDressUpItemType.BEI_JING)
  169. {
  170. DressUpBgID = itemCfg.id;
  171. }
  172. else
  173. {
  174. dressitemIDList.Add(RightRoleInfo.JudgingInfo.CollocationInfoList[i].ItemId);
  175. }
  176. }
  177. else if (itemCfg != null && itemCfg.itemType == ConstItemType.PHOTOGRAPH)
  178. {
  179. //记录道具和位置信息
  180. propIDList.Add(RightRoleInfo.JudgingInfo.CollocationInfoList[i].ItemId);
  181. transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(RightRoleInfo.JudgingInfo.CollocationInfoList[i].ClientPosition));
  182. }
  183. }
  184. }
  185. MathingDressDate.itemList = dressitemIDList;
  186. MathingDressDate.actionId = RightRoleInfo.JudgingInfo.ActionId;
  187. DressPropIdList = propIDList;
  188. TransformDataList = transDataList;
  189. DressUpBgID = RightRoleInfo.JudgingInfo.BagId;
  190. }
  191. public void InsertGameObjectList()
  192. {
  193. int indexRoleData = 0;
  194. for (int i = 0; i < DressPropIdList.Count; i++)
  195. {
  196. if (DressPropIdList[i] == roleID)
  197. {
  198. indexRoleData = i;
  199. }
  200. }
  201. if (itemGameObjs.Count == 0)
  202. {
  203. itemGameObjs.Add(roleGameobj);
  204. }
  205. else
  206. {
  207. if (indexRoleData > itemGameObjs.Count)
  208. {
  209. itemGameObjs.Add(roleGameobj);
  210. }
  211. else
  212. {
  213. itemGameObjs.Insert(indexRoleData, roleGameobj);
  214. }
  215. }
  216. }
  217. }
  218. }