MatchingCompetitionDataManager.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  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 MatchingCompetitionDataManager : SingletonBase<MatchingCompetitionDataManager>
  13. {
  14. ////搭配赛标记
  15. //public int type = 2;
  16. //位置信息数据索引
  17. public int indexRoleData = 0;
  18. //人物位置信息
  19. public TransformData roleTransFormData = new TransformData();
  20. public GameObject roleGameobj;
  21. public string roleID = "Role";
  22. //*********************搭配数据*********************************
  23. //需要传输的数据:MathingDressDate,DressUpBgID,DressPropIdList,TransformDataList,
  24. public DressUpData MathingDressDate = DressUpData.CreateDefault();
  25. public int DressUpBgID = 0;
  26. //*****这两个id放列表的最后面
  27. //边框id
  28. public int BorderID = 0;
  29. //NpcId
  30. public int NpcID = 0;
  31. //*************=**************
  32. //道具数据,一一对应
  33. //场景名字,自己搭配的数据
  34. public List<string> DressPropNameList = new List<string>();
  35. //道具id
  36. //public List<int> DressPropIdList = new List<int>();
  37. //道具索引
  38. public int DressPropIndex = 0;
  39. //道具索引字典
  40. public Dictionary<string, TransformData> DressPropTransInfoDic = new Dictionary<string, TransformData>();
  41. //道具位置信息
  42. public List<TransformData> TransformDataList = new List<TransformData>();
  43. public List<GameObject> itemGameObjs = new List<GameObject>();
  44. //所有信息的列表,用于前后端交互
  45. public List<CollocationInfo> AllDressIDInfoList = new List<CollocationInfo>();
  46. //public List<int> _equipSceneData = new List<int>();//当前穿戴的场景数据(从套装获得)
  47. //***************************************************************
  48. public int MatchingCompetitionSeason = 1;
  49. public int MatchingState = 1;
  50. public long MatchingEndTimes = 0;
  51. public long WorksID = 0;
  52. public string TempPictureUrl = "";
  53. public int MatchingRemainingTimes = 1;
  54. public MyWorksIdInfo myWorks = new MyWorksIdInfo();
  55. public List<ItemInfoProto> SpecialBonusList = new List<ItemInfoProto>();
  56. /// <summary>
  57. /// 搭配赛相册
  58. /// </summary>
  59. /// <typeparam name="PoemPhotoData"></typeparam>
  60. /// <returns></returns>
  61. public List<PoemPhotoData> MatchingPhotoInfos = new List<PoemPhotoData>();
  62. //角色详情界面图片信息
  63. public NTexture DetailNtexture;
  64. //自己的搭配图片
  65. public NTexture MyNtextture;
  66. public byte[] MyBytes;
  67. //本期排行榜数据
  68. public List<MatchingPhotoWorksData> _currentRankList = new List<MatchingPhotoWorksData>();
  69. //往期作品集
  70. public List<MatchingWorksData> _BeforeWorksList = new List<MatchingWorksData>();
  71. //往期排行榜数据
  72. public List<MatchingPhotoWorksData> _BeforeRankList = new List<MatchingPhotoWorksData>();
  73. //根据时间判断:1:集结期 2:评选期 3;结算期
  74. //public int CheckCompetitionState()
  75. //{
  76. // long currentTime = TimeHelper.ServerNow();
  77. // DateTime dateTime = DateTimeOffset.FromUnixTimeSeconds(currentTime).DateTime;
  78. // // 获取星期几
  79. // DayOfWeek dayOfWeek = dateTime.DayOfWeek;
  80. // int week = (int)dayOfWeek;
  81. // int hour = dateTime.Hour;
  82. // if(week == 0)
  83. // {
  84. // if(hour >= 21)
  85. // {
  86. // return 3;
  87. // }
  88. // else
  89. // {
  90. // return 2;
  91. // }
  92. // }
  93. // if(week <= 3 && week >= 1)
  94. // {
  95. // if(week == 3 && hour >= 5)
  96. // {
  97. // return 2;
  98. // }
  99. // if(week == 1 && hour < 5)
  100. // {
  101. // return 3;
  102. // }
  103. // return 1;
  104. // }
  105. // else if(week > 3 && week <= 6)
  106. // {
  107. // return 2;
  108. // }
  109. // return -1;
  110. //}
  111. public void ConvertInfoToList()
  112. {
  113. //将所有需要存储的信息转换成list
  114. AllDressIDInfoList.Clear();
  115. foreach(var item in MathingDressDate.itemList)
  116. {
  117. CollocationInfo itemInfo = new CollocationInfo();
  118. itemInfo.ItemId = item.ToString();
  119. itemInfo.ClientPosition = "";
  120. AllDressIDInfoList.Add(itemInfo);
  121. }
  122. foreach (var item in DressPropTransInfoDic)
  123. {
  124. CollocationInfo itemInfo = new CollocationInfo();
  125. itemInfo.ItemId = item.Key;
  126. string transStr = item.Value.position.x.ToString() + "_" + item.Value.position.y.ToString() + "_"
  127. + item.Value.position.z.ToString()
  128. + "_" + item.Value.rotationZ.ToString()
  129. + "_" + item.Value.scale.x.ToString() + "_" +
  130. item.Value.scale.y.ToString() + "_" + item.Value.scale.z.ToString();
  131. itemInfo.ClientPosition = transStr;
  132. AllDressIDInfoList.Add(itemInfo);
  133. }
  134. //for(int i = 0;i< DressPropIdList.Count;i++)
  135. //{
  136. // CollocationInfo itemInfo = new CollocationInfo();
  137. // itemInfo.ItemId = DressPropIdList[i];
  138. // string transStr = TransformDataList[i].position.x.ToString()+"_" + TransformDataList[i].position.y.ToString() + "_"
  139. // + TransformDataList[i].position.z.ToString()
  140. // + "_" + TransformDataList[i].rotationZ.ToString()
  141. // + "_" + TransformDataList[i].scale.x.ToString() + "_" +
  142. // TransformDataList[i].scale.y.ToString() + "_" + TransformDataList[i].scale.z.ToString();
  143. // itemInfo.ClientPosition = transStr;
  144. // AllDressIDInfoList.Add(itemInfo);
  145. //}
  146. CollocationInfo itemBgInfo = new CollocationInfo();
  147. itemBgInfo.ItemId = MatchingCompetitionDataManager.Instance.DressUpBgID.ToString();
  148. itemBgInfo.ClientPosition = "";
  149. AllDressIDInfoList.Add(itemBgInfo);
  150. CollocationInfo itemActionInfo = new CollocationInfo();
  151. itemActionInfo.ItemId = MatchingCompetitionDataManager.Instance.MathingDressDate.actionId.ToString();
  152. itemActionInfo.ClientPosition = "";
  153. AllDressIDInfoList.Add(itemActionInfo);
  154. }
  155. //解析后台获取的信息
  156. public void AnalysisInfoToList()
  157. {
  158. List<int> dressitemIDList = new List<int>();
  159. List<int> propIDList = new List<int>();
  160. List<TransformData> transDataList = new List<TransformData>();
  161. DressUpBgID = 180001;
  162. MathingDressDate.bgId = 180001;
  163. MathingDressDate.actionId = 0;
  164. DressPropTransInfoDic.Clear();
  165. for (int i = 0; i < AllDressIDInfoList.Count; i++)
  166. {
  167. if(AllDressIDInfoList[i].ItemId == roleID)
  168. {
  169. //propIDList.Add(AllDressIDInfoList[i].ItemId);
  170. //transDataList.Add(AnalysisStringToTransform(AllDressIDInfoList[i].ClientPosition));
  171. DressPropTransInfoDic.Add(AllDressIDInfoList[i].ItemId.ToString(), AnalysisStringToTransform(AllDressIDInfoList[i].ClientPosition));
  172. }
  173. else
  174. {
  175. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(GetIDByString(AllDressIDInfoList[i].ItemId));
  176. if (itemCfg != null && itemCfg.itemType == ConstItemType.DRESS_UP)
  177. {
  178. if(itemCfg.subType == 19 || itemCfg.subType == 17 || itemCfg.subType == 21|| itemCfg.subType == 22)
  179. {
  180. //记录道具和位置信息
  181. //propIDList.Add(GetIDByString(AllDressIDInfoList[i].ItemId));
  182. //transDataList.Add(AnalysisStringToTransform(AllDressIDInfoList[i].ClientPosition));
  183. if(GetIDListByString(AllDressIDInfoList[i].ItemId).Count > 1)
  184. {
  185. DressPropTransInfoDic.Add(AllDressIDInfoList[i].ItemId.ToString(), AnalysisStringToTransform(AllDressIDInfoList[i].ClientPosition));
  186. }
  187. }
  188. else if (itemCfg != null && itemCfg.subType == ConstDressUpItemType.BEI_JING)
  189. {
  190. DressUpBgID = itemCfg.id;
  191. MathingDressDate.bgId = itemCfg.id;
  192. }
  193. else
  194. {
  195. dressitemIDList.Add(GetIDByString(AllDressIDInfoList[i].ItemId));
  196. }
  197. }
  198. else if (itemCfg != null && itemCfg.itemType == ConstItemType.PHOTOGRAPH)
  199. {
  200. //记录道具和位置信息
  201. //propIDList.Add(GetIDByString(AllDressIDInfoList[i].ItemId));
  202. //transDataList.Add(AnalysisStringToTransform(AllDressIDInfoList[i].ClientPosition));
  203. DressPropTransInfoDic.Add(AllDressIDInfoList[i].ItemId.ToString(), AnalysisStringToTransform(AllDressIDInfoList[i].ClientPosition));
  204. }
  205. else if(itemCfg == null)
  206. {
  207. SuitCfg actionId = SuitCfgArray.Instance.GetCfg(GetIDByString(AllDressIDInfoList[i].ItemId));
  208. if(actionId !=null)
  209. {
  210. MathingDressDate.actionId = GetIDByString(AllDressIDInfoList[i].ItemId);
  211. }
  212. }
  213. }
  214. }
  215. MathingDressDate.itemList = dressitemIDList;
  216. //DressPropIdList = propIDList;
  217. //TransformDataList = transDataList;
  218. }
  219. public TransformData AnalysisStringToTransform(string strTrans)
  220. {
  221. TransformData transData = new TransformData();
  222. string[] parts = Regex.Split(strTrans, "_");
  223. if(parts.Length > 6)
  224. {
  225. transData.position.x = float.Parse(parts[0]);
  226. transData.position.y = float.Parse(parts[1]);
  227. transData.position.z = float.Parse(parts[2]);
  228. transData.rotationZ = float.Parse(parts[3]);
  229. transData.scale.x = float.Parse(parts[4]);
  230. transData.scale.y = float.Parse(parts[5]);
  231. transData.scale.z = float.Parse(parts[6]);
  232. }
  233. return transData;
  234. }
  235. //存储道具信息
  236. public void SetTransformData()
  237. {
  238. DressPropNameList.Clear();
  239. TransformDataList.Clear();
  240. DressPropTransInfoDic.Clear();
  241. for (int i =0;i<itemGameObjs.Count;i++)
  242. {
  243. TransformData itemData = new TransformData();
  244. if (itemGameObjs[i].name == "Role")
  245. {
  246. roleTransFormData.position = itemGameObjs[i].transform.position;
  247. roleTransFormData.rotationZ = itemGameObjs[i].transform.eulerAngles.z;
  248. roleTransFormData.scale = itemGameObjs[i].transform.localScale;
  249. TransformDataList.Add(roleTransFormData);
  250. DressPropNameList.Add(itemGameObjs[i].name);
  251. }
  252. else
  253. {
  254. itemData.position = itemGameObjs[i].transform.position;
  255. itemData.rotationZ = itemGameObjs[i].transform.eulerAngles.z;
  256. itemData.scale = itemGameObjs[i].transform.localScale;
  257. TransformDataList.Add(itemData);
  258. DressPropNameList.Add(itemGameObjs[i].name);
  259. }
  260. DressPropTransInfoDic.Add(itemGameObjs[i].name, itemData);
  261. }
  262. //SetNameToIdList();
  263. }
  264. public int GetIDByString(string name)
  265. {
  266. int id = 0;
  267. //使用正则表达式分割字符串
  268. string[] parts = Regex.Split(name, "_");
  269. if (parts.Length > 0)
  270. {
  271. string vl = parts[0];
  272. bool isNumeric = int.TryParse(vl, out _);
  273. if (vl == "Role")
  274. {
  275. return -1;
  276. }
  277. else if (vl == "Border")
  278. {
  279. return -2;
  280. }
  281. else if (!isNumeric)
  282. {
  283. return -3;
  284. }
  285. id = int.Parse(parts[0]);
  286. }
  287. return id;
  288. }
  289. public List<int> GetIDListByString(string name)
  290. {
  291. List<int> idList = new List<int>();
  292. string[] parts = Regex.Split(name, "_");
  293. foreach(string id in parts)
  294. {
  295. idList.Add(int.Parse(id));
  296. }
  297. return idList;
  298. }
  299. //将名字转换成道具id
  300. //public void SetNameToIdList()
  301. //{
  302. // //DressPropIdList.Clear();
  303. // int flog_prefix = 0;
  304. // int flog_suffix = 0;
  305. // for (int i = 0; i < DressPropNameList.Count; i++)
  306. // {
  307. // bool containsUnderscore = Regex.IsMatch(DressPropNameList[i], "_");
  308. // if(!containsUnderscore)
  309. // {
  310. // if (DressPropNameList[i] == "Role")
  311. // {
  312. // DressPropIdList.Add(roleID);
  313. // }
  314. // else if (DressPropNameList[i] == "Border")
  315. // {
  316. // if (BorderID != 0)
  317. // {
  318. // DressPropIdList.Add(BorderID);
  319. // }
  320. // }
  321. // else if (DressPropNameList[i] == "Npc")
  322. // {
  323. // if (NpcID != 0)
  324. // {
  325. // DressPropIdList.Add(NpcID);
  326. // }
  327. // }
  328. // }
  329. // else
  330. // {
  331. // // 使用正则表达式分割字符串
  332. // string[] parts = Regex.Split(DressPropNameList[i], "_");
  333. // int partID = int.Parse(parts[0]);
  334. // if(flog_prefix == int.Parse(parts[0]))
  335. // {
  336. // if((flog_suffix == 3 && int.Parse(parts[1]) == 1)|| (flog_suffix == 1 && int.Parse(parts[1]) == 3))
  337. // {
  338. // flog_prefix = 0;
  339. // flog_suffix = 0;
  340. // continue;
  341. // }
  342. // if ((flog_suffix == 2 && int.Parse(parts[1]) == 1) || (flog_suffix == 1 && int.Parse(parts[1]) == 2))
  343. // {
  344. // flog_prefix = 0;
  345. // flog_suffix = 0;
  346. // continue;
  347. // }
  348. // }
  349. // flog_prefix = int.Parse(parts[0]);
  350. // flog_suffix = int.Parse(parts[1]);
  351. // DressPropIdList.Add(partID);
  352. // }
  353. // }
  354. //}
  355. //将穿戴数据分类
  356. //public void ClassifyEquipData()
  357. //{
  358. // _equipSceneData.Clear();
  359. // PhotographDataManager.Instance.dressUpObj = new DressUpObj();
  360. // //for (int i = 0; i < MathingDressDate.itemList.Count; i++)
  361. // //{
  362. // // int itemId = MathingDressDate.itemList[i];
  363. // // if (DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(itemId, false))
  364. // // {
  365. // // if (!_equipSceneData.ContainsKey(itemId))
  366. // // {
  367. // // _equipSceneData.Add(itemId, new List<int>());
  368. // // }
  369. // // _equipSceneData[itemId].Add(itemId);
  370. // // }
  371. // //}
  372. // for(int i =0;i<DressPropIdList.Count;i++)
  373. // {
  374. // int itemId = DressPropIdList[i];
  375. // if (DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(itemId, false))
  376. // {
  377. // _equipSceneData.Add(itemId);
  378. // }
  379. // }
  380. //}
  381. public void InsertGameObjectList()
  382. {
  383. int i = 0;
  384. foreach(var item in DressPropTransInfoDic)
  385. {
  386. i++;
  387. if (item.Key == roleID)
  388. {
  389. indexRoleData = i;
  390. break;
  391. }
  392. indexRoleData = i;
  393. }
  394. if(itemGameObjs.Count ==0)
  395. {
  396. itemGameObjs.Add(roleGameobj);
  397. }
  398. else
  399. {
  400. if (indexRoleData > itemGameObjs.Count)
  401. {
  402. itemGameObjs.Add(roleGameobj);
  403. }
  404. else
  405. {
  406. itemGameObjs.Insert(indexRoleData, roleGameobj);
  407. }
  408. }
  409. }
  410. public void SetNumToRank(int index,UI_Component4 rankCom)
  411. {
  412. int c1 = 0;
  413. int c2 = 0;
  414. if(index<=3&& index >=1)
  415. {
  416. c2 = index;
  417. }
  418. if (index > 3 && index <= 9)
  419. {
  420. c1 = 0;
  421. }
  422. else if(index >9 && index <= 50)
  423. {
  424. c1 = 1;
  425. }
  426. else
  427. {
  428. c1 = 2;
  429. }
  430. rankCom.m_c1.selectedIndex = c1;
  431. rankCom.m_c2.selectedIndex = c2;
  432. if(c1 == 0)
  433. {
  434. rankCom.m_num3.url = string.Format("ui://MatchingCompetition/{0}",index.ToString());
  435. }
  436. else if(c1 == 1)
  437. {
  438. int one = index / 10;
  439. int two = index % 10;
  440. rankCom.m_num1.url = string.Format("ui://MatchingCompetition/{0}", one.ToString());
  441. rankCom.m_num2.url = string.Format("ui://MatchingCompetition/{0}", two.ToString());
  442. }
  443. else
  444. {
  445. if (index == 0)
  446. {
  447. rankCom.m_RankText.text = "--";
  448. }
  449. else
  450. {
  451. for (int i = 11; i < JudgingRoundRewardCfgArray.Instance.dataArray.Length-1; i++)
  452. {
  453. JudgingRoundRewardCfg judgingCfg = JudgingRoundRewardCfgArray.Instance.GetCfg(i);
  454. JudgingRoundRewardCfg judgingNextCfg = JudgingRoundRewardCfgArray.Instance.GetCfg(i+1);
  455. if (index >= judgingCfg.rank && index < judgingNextCfg.rank)
  456. {
  457. rankCom.m_RankText.text = judgingNextCfg.desc;
  458. }
  459. else
  460. {
  461. rankCom.m_RankText.text = index.ToString();
  462. }
  463. }
  464. }
  465. }
  466. }
  467. public async void AddSceneItem(ItemCfg itemCfg, bool setLayer,int isLeft = 0)
  468. {
  469. Vector3 pos = Vector3.zero;
  470. if (!string.IsNullOrEmpty(itemCfg.resLayer3))
  471. {
  472. DressPropIndex++;
  473. GameObject parentGameObj3 = new GameObject(string.Format("{0}_{1}_{2}", itemCfg.id, 3,DressPropIndex));
  474. await PhotographSceneManager.Instance.AddSceneItem(parentGameObj3, itemCfg, 3, setLayer,false,isLeft);
  475. if (setLayer)
  476. {
  477. if (parentGameObj3.transform.childCount > 0)
  478. {
  479. parentGameObj3.transform.localPosition = -parentGameObj3.transform.GetChild(0).localPosition;
  480. pos = parentGameObj3.transform.localPosition;
  481. }
  482. }
  483. }
  484. if (!string.IsNullOrEmpty(itemCfg.resLayer2))
  485. {
  486. DressPropIndex++;
  487. GameObject parentGameObj2 = new GameObject(string.Format("{0}_{1}_{2}", itemCfg.id, 2,DressPropIndex));
  488. await PhotographSceneManager.Instance.AddSceneItem(parentGameObj2, itemCfg, 2, setLayer,false, isLeft);
  489. if (setLayer)
  490. {
  491. if (parentGameObj2.transform.childCount > 0)
  492. {
  493. parentGameObj2.transform.localPosition = pos == Vector3.zero ? -parentGameObj2.transform.GetChild(0).localPosition : pos;
  494. pos = parentGameObj2.transform.localPosition;
  495. }
  496. }
  497. }
  498. if (!string.IsNullOrEmpty(itemCfg.resLayer1))
  499. {
  500. DressPropIndex++;
  501. GameObject parentGameObj1 = new GameObject(string.Format("{0}_{1}_{2}", itemCfg.id, 1, DressPropIndex));
  502. await PhotographSceneManager.Instance.AddSceneItem(parentGameObj1, itemCfg, 1, setLayer, false, isLeft);
  503. if (setLayer)
  504. {
  505. if (parentGameObj1.transform.childCount > 0)
  506. {
  507. parentGameObj1.transform.localPosition = pos == Vector3.zero ? -parentGameObj1.transform.GetChild(0).localPosition : pos;
  508. pos = parentGameObj1.transform.localPosition;
  509. }
  510. }
  511. }
  512. }
  513. public async void AddSceneItemOne(ItemCfg itemCfg, int layer,int index, int isLeft = 0, bool setLayer = true)
  514. {
  515. Vector3 pos = Vector3.zero;
  516. if(DressPropIndex <= index)
  517. {
  518. DressPropIndex = index + 1;
  519. }
  520. GameObject parentGameObj3 = new GameObject(string.Format("{0}_{1}_{2}", itemCfg.id, layer, index));
  521. await PhotographSceneManager.Instance.AddSceneItem(parentGameObj3, itemCfg, layer, setLayer, false, isLeft);
  522. if (setLayer)
  523. {
  524. if (parentGameObj3.transform.childCount > 0)
  525. {
  526. parentGameObj3.transform.localPosition = -parentGameObj3.transform.GetChild(0).localPosition;
  527. pos = parentGameObj3.transform.localPosition;
  528. }
  529. }
  530. }
  531. public void OnClickBtnRule()
  532. {
  533. ViewManager.Show<MatchingCompetitionRuleTipsView>();
  534. }
  535. }
  536. class MatchingOneDataManager : SingletonBase<MatchingOneDataManager>
  537. {
  538. //其他玩家信息用于展示
  539. public MatchingPhotoWorksData OneRoleInfo = new MatchingPhotoWorksData();
  540. //人物位置信息
  541. public TransformData roleTransFormData = new TransformData();
  542. public GameObject roleGameobj;
  543. public string roleID = "Role";
  544. //*********************搭配数据*********************************
  545. //需要传输的数据:MathingDressDate,DressUpBgID,DressPropIdList,TransformDataList,
  546. public DressUpData MathingDressDate = DressUpData.CreateDefault();
  547. public int DressUpBgID = 0;
  548. //*****这两个id放列表的最后面
  549. //边框id
  550. public int BorderID = 0;
  551. //NpcId
  552. public int NpcID = 0;
  553. //道具数据,一一对应
  554. //道具id
  555. //public List<int> DressPropIdList = new List<int>();
  556. //道具位置信息
  557. public List<TransformData> TransformDataList = new List<TransformData>();
  558. //道具索引
  559. public int DressPropIndex = 0;
  560. //道具索引字典
  561. public Dictionary<string, TransformData> DressPropTransInfoDic = new Dictionary<string, TransformData>();
  562. public List<GameObject> itemGameObjs = new List<GameObject>();
  563. //***************************************************************
  564. //解析后台获取的信息
  565. public void AnalysisInfoToList()
  566. {
  567. List<int> dressitemIDList = new List<int>();
  568. List<int> propIDList = new List<int>();
  569. List<TransformData> transDataList = new List<TransformData>();
  570. DressPropTransInfoDic.Clear();
  571. for (int i = 0; i < OneRoleInfo.JudgingInfo.CollocationInfoList.Count; i++)
  572. {
  573. CollocationInfo colloctItemInfo = OneRoleInfo.JudgingInfo.CollocationInfoList[i];
  574. if (colloctItemInfo.ItemId == roleID)
  575. {
  576. //propIDList.Add(colloctItemInfo.ItemId);
  577. //transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  578. DressPropTransInfoDic.Add(colloctItemInfo.ItemId, MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  579. }
  580. else
  581. {
  582. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(MatchingCompetitionDataManager.Instance.GetIDByString( colloctItemInfo.ItemId));
  583. if (itemCfg != null && itemCfg.itemType == ConstItemType.DRESS_UP)
  584. {
  585. if (itemCfg.subType == 19 || itemCfg.subType == 17 || itemCfg.subType == 21 || itemCfg.subType == 22)
  586. {
  587. //记录道具和位置信息
  588. //propIDList.Add(colloctItemInfo.ItemId);
  589. //transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  590. DressPropTransInfoDic.Add(colloctItemInfo.ItemId, MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  591. }
  592. else if (itemCfg != null && itemCfg.subType == ConstDressUpItemType.BEI_JING)
  593. {
  594. DressUpBgID = itemCfg.id;
  595. }
  596. else
  597. {
  598. dressitemIDList.Add(MatchingCompetitionDataManager.Instance.GetIDByString(colloctItemInfo.ItemId));
  599. }
  600. }
  601. else if (itemCfg != null && itemCfg.itemType == ConstItemType.PHOTOGRAPH)
  602. {
  603. //记录道具和位置信息
  604. //propIDList.Add(colloctItemInfo.ItemId);
  605. //transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  606. DressPropTransInfoDic.Add(colloctItemInfo.ItemId, MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  607. }
  608. }
  609. }
  610. MathingDressDate.itemList = dressitemIDList;
  611. MathingDressDate.actionId = OneRoleInfo.JudgingInfo.ActionId;
  612. //DressPropIdList = propIDList;
  613. //TransformDataList = transDataList;
  614. DressUpBgID = OneRoleInfo.JudgingInfo.BagId;
  615. }
  616. public void InsertGameObjectList()
  617. {
  618. int indexRoleData = 0;
  619. int i = 0;
  620. foreach (var item in DressPropTransInfoDic)
  621. {
  622. i++;
  623. if (item.Key == roleID)
  624. {
  625. indexRoleData = i;
  626. }
  627. }
  628. if (itemGameObjs.Count == 0)
  629. {
  630. itemGameObjs.Add(roleGameobj);
  631. }
  632. else
  633. {
  634. if (indexRoleData > itemGameObjs.Count)
  635. {
  636. itemGameObjs.Add(roleGameobj);
  637. }
  638. else
  639. {
  640. itemGameObjs.Insert(indexRoleData, roleGameobj);
  641. }
  642. }
  643. }
  644. }
  645. }