MatchingTwoDataManager.cs 11 KB

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