MatchingTwoDataManager.cs 11 KB

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