MatchingTwoDataManager.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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 string roleID = "Role";
  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. //道具索引
  35. public int DressPropIndex = 0;
  36. //道具索引字典
  37. public Dictionary<string, TransformData> DressPropTransInfoDic = new Dictionary<string, TransformData>();
  38. public List<GameObject> itemGameObjs = new List<GameObject>();
  39. //***************************************************************
  40. //解析后台获取的信息
  41. public void AnalysisInfoToList()
  42. {
  43. List<int> dressitemIDList = new List<int>();
  44. List<int> propIDList = new List<int>();
  45. List<TransformData> transDataList = new List<TransformData>();
  46. DressPropTransInfoDic.Clear();
  47. for (int i = 0; i < LeftRoleInfo.JudgingInfo.CollocationInfoList.Count; i++)
  48. {
  49. CollocationInfo colloctItemInfo = LeftRoleInfo.JudgingInfo.CollocationInfoList[i];
  50. if (colloctItemInfo.ItemId == roleID)
  51. {
  52. //propIDList.Add(colloctItemInfo.ItemId);
  53. //transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  54. DressPropTransInfoDic.Add(colloctItemInfo.ItemId, MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  55. }
  56. else
  57. {
  58. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(MatchingCompetitionDataManager.Instance.GetIDByString( colloctItemInfo.ItemId));
  59. if (itemCfg != null && itemCfg.itemType == ConstItemType.DRESS_UP)
  60. {
  61. if (itemCfg.subType == 19 || itemCfg.subType == 17 || itemCfg.subType == 21 || itemCfg.subType == 22)
  62. {
  63. //记录道具和位置信息
  64. //propIDList.Add(colloctItemInfo.ItemId);
  65. //transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  66. DressPropTransInfoDic.Add(colloctItemInfo.ItemId, MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  67. }
  68. else if (itemCfg != null && itemCfg.subType == ConstDressUpItemType.BEI_JING)
  69. {
  70. DressUpBgID = itemCfg.id;
  71. }
  72. else
  73. {
  74. dressitemIDList.Add(MatchingCompetitionDataManager.Instance.GetIDByString(colloctItemInfo.ItemId));
  75. }
  76. }
  77. else if (itemCfg != null && itemCfg.itemType == ConstItemType.PHOTOGRAPH)
  78. {
  79. //记录道具和位置信息
  80. //propIDList.Add(colloctItemInfo.ItemId);
  81. //transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  82. DressPropTransInfoDic.Add(colloctItemInfo.ItemId, MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  83. }
  84. }
  85. }
  86. MathingDressDate.itemList = dressitemIDList;
  87. MathingDressDate.actionId = LeftRoleInfo.JudgingInfo.ActionId;
  88. //DressPropIdList = propIDList;
  89. //TransformDataList = transDataList;
  90. DressUpBgID = LeftRoleInfo.JudgingInfo.BagId;
  91. }
  92. public void InsertGameObjectList()
  93. {
  94. int indexRoleData = 0;
  95. int i = 0;
  96. foreach (var item in DressPropTransInfoDic)
  97. {
  98. i++;
  99. if (item.Key == roleID)
  100. {
  101. indexRoleData = i;
  102. }
  103. }
  104. if (itemGameObjs.Count == 0)
  105. {
  106. itemGameObjs.Add(roleGameobj);
  107. }
  108. else
  109. {
  110. if(indexRoleData > itemGameObjs.Count)
  111. {
  112. itemGameObjs.Add(roleGameobj);
  113. }
  114. else
  115. {
  116. itemGameObjs.Insert(indexRoleData, roleGameobj);
  117. }
  118. }
  119. }
  120. }
  121. class MatchingRightDataManager : SingletonBase<MatchingRightDataManager>
  122. {
  123. //其他玩家信息用于展示
  124. public MatchingPhotoWorksData RightRoleInfo = new MatchingPhotoWorksData();
  125. //人物位置信息
  126. public TransformData roleTransFormData = new TransformData();
  127. public GameObject roleGameobj;
  128. public string roleID = "Role";
  129. //*********************搭配数据*********************************
  130. //需要传输的数据:MathingDressDate,DressUpBgID,DressPropIdList,TransformDataList,
  131. public DressUpData MathingDressDate = DressUpData.CreateDefault();
  132. public int DressUpBgID = 0;
  133. //*****这两个id放列表的最后面
  134. //边框id
  135. public int BorderID = 0;
  136. //NpcId
  137. public int NpcID = 0;
  138. //道具数据,一一对应
  139. //道具id
  140. //public List<int> DressPropIdList = new List<int>();
  141. //道具位置信息
  142. // public List<TransformData> TransformDataList = new List<TransformData>();
  143. //道具索引
  144. public int DressPropIndex = 0;
  145. //道具索引字典
  146. public Dictionary<string, TransformData> DressPropTransInfoDic = new Dictionary<string, TransformData>();
  147. public List<GameObject> itemGameObjs = new List<GameObject>();
  148. //***************************************************************
  149. //解析后台获取的信息
  150. public void AnalysisInfoToList()
  151. {
  152. List<int> dressitemIDList = new List<int>();
  153. List<int> propIDList = new List<int>();
  154. List<TransformData> transDataList = new List<TransformData>();
  155. DressPropTransInfoDic.Clear();
  156. for (int i = 0; i < RightRoleInfo.JudgingInfo.CollocationInfoList.Count; i++)
  157. {
  158. CollocationInfo colloctItemInfo = RightRoleInfo.JudgingInfo.CollocationInfoList[i];
  159. if (colloctItemInfo.ItemId == roleID)
  160. {
  161. //propIDList.Add(colloctItemInfo.ItemId);
  162. //transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  163. DressPropTransInfoDic.Add(colloctItemInfo.ItemId, MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  164. }
  165. else
  166. {
  167. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(MatchingCompetitionDataManager.Instance.GetIDByString(colloctItemInfo.ItemId));
  168. if (itemCfg != null && itemCfg.itemType == ConstItemType.DRESS_UP)
  169. {
  170. if (itemCfg.subType == 19 || itemCfg.subType == 17 || itemCfg.subType == 21 || itemCfg.subType == 22)
  171. {
  172. //记录道具和位置信息
  173. //propIDList.Add(colloctItemInfo.ItemId);
  174. //transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  175. DressPropTransInfoDic.Add(colloctItemInfo.ItemId, MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  176. }
  177. else if (itemCfg != null && itemCfg.subType == ConstDressUpItemType.BEI_JING)
  178. {
  179. DressUpBgID = itemCfg.id;
  180. }
  181. else
  182. {
  183. dressitemIDList.Add(MatchingCompetitionDataManager.Instance.GetIDByString(colloctItemInfo.ItemId));
  184. }
  185. }
  186. else if (itemCfg != null && itemCfg.itemType == ConstItemType.PHOTOGRAPH)
  187. {
  188. //记录道具和位置信息
  189. //propIDList.Add(colloctItemInfo.ItemId);
  190. //transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  191. DressPropTransInfoDic.Add(colloctItemInfo.ItemId, MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  192. }
  193. }
  194. }
  195. MathingDressDate.itemList = dressitemIDList;
  196. MathingDressDate.actionId = RightRoleInfo.JudgingInfo.ActionId;
  197. //DressPropIdList = propIDList;
  198. //TransformDataList = transDataList;
  199. DressUpBgID = RightRoleInfo.JudgingInfo.BagId;
  200. }
  201. public void InsertGameObjectList()
  202. {
  203. int indexRoleData = 0;
  204. int i = 0;
  205. foreach (var item in DressPropTransInfoDic)
  206. {
  207. i++;
  208. if (item.Key == roleID)
  209. {
  210. indexRoleData = i;
  211. }
  212. }
  213. if (itemGameObjs.Count == 0)
  214. {
  215. itemGameObjs.Add(roleGameobj);
  216. }
  217. else
  218. {
  219. if (indexRoleData > itemGameObjs.Count)
  220. {
  221. itemGameObjs.Add(roleGameobj);
  222. }
  223. else
  224. {
  225. itemGameObjs.Insert(indexRoleData, roleGameobj);
  226. }
  227. }
  228. }
  229. }
  230. }