MatchingCompetitionDataManager.cs 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  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. if(parts[0] == "Role")
  272. {
  273. return -1;
  274. }
  275. id = int.Parse(parts[0]);
  276. }
  277. return id;
  278. }
  279. public List<int> GetIDListByString(string name)
  280. {
  281. List<int> idList = new List<int>();
  282. string[] parts = Regex.Split(name, "_");
  283. foreach(string id in parts)
  284. {
  285. idList.Add(int.Parse(id));
  286. }
  287. return idList;
  288. }
  289. //将名字转换成道具id
  290. //public void SetNameToIdList()
  291. //{
  292. // //DressPropIdList.Clear();
  293. // int flog_prefix = 0;
  294. // int flog_suffix = 0;
  295. // for (int i = 0; i < DressPropNameList.Count; i++)
  296. // {
  297. // bool containsUnderscore = Regex.IsMatch(DressPropNameList[i], "_");
  298. // if(!containsUnderscore)
  299. // {
  300. // if (DressPropNameList[i] == "Role")
  301. // {
  302. // DressPropIdList.Add(roleID);
  303. // }
  304. // else if (DressPropNameList[i] == "Border")
  305. // {
  306. // if (BorderID != 0)
  307. // {
  308. // DressPropIdList.Add(BorderID);
  309. // }
  310. // }
  311. // else if (DressPropNameList[i] == "Npc")
  312. // {
  313. // if (NpcID != 0)
  314. // {
  315. // DressPropIdList.Add(NpcID);
  316. // }
  317. // }
  318. // }
  319. // else
  320. // {
  321. // // 使用正则表达式分割字符串
  322. // string[] parts = Regex.Split(DressPropNameList[i], "_");
  323. // int partID = int.Parse(parts[0]);
  324. // if(flog_prefix == int.Parse(parts[0]))
  325. // {
  326. // if((flog_suffix == 3 && int.Parse(parts[1]) == 1)|| (flog_suffix == 1 && int.Parse(parts[1]) == 3))
  327. // {
  328. // flog_prefix = 0;
  329. // flog_suffix = 0;
  330. // continue;
  331. // }
  332. // if ((flog_suffix == 2 && int.Parse(parts[1]) == 1) || (flog_suffix == 1 && int.Parse(parts[1]) == 2))
  333. // {
  334. // flog_prefix = 0;
  335. // flog_suffix = 0;
  336. // continue;
  337. // }
  338. // }
  339. // flog_prefix = int.Parse(parts[0]);
  340. // flog_suffix = int.Parse(parts[1]);
  341. // DressPropIdList.Add(partID);
  342. // }
  343. // }
  344. //}
  345. //将穿戴数据分类
  346. //public void ClassifyEquipData()
  347. //{
  348. // _equipSceneData.Clear();
  349. // PhotographDataManager.Instance.dressUpObj = new DressUpObj();
  350. // //for (int i = 0; i < MathingDressDate.itemList.Count; i++)
  351. // //{
  352. // // int itemId = MathingDressDate.itemList[i];
  353. // // if (DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(itemId, false))
  354. // // {
  355. // // if (!_equipSceneData.ContainsKey(itemId))
  356. // // {
  357. // // _equipSceneData.Add(itemId, new List<int>());
  358. // // }
  359. // // _equipSceneData[itemId].Add(itemId);
  360. // // }
  361. // //}
  362. // for(int i =0;i<DressPropIdList.Count;i++)
  363. // {
  364. // int itemId = DressPropIdList[i];
  365. // if (DressUpMenuItemCfg1Array.Instance.CheckIsSceneType(itemId, false))
  366. // {
  367. // _equipSceneData.Add(itemId);
  368. // }
  369. // }
  370. //}
  371. public void InsertGameObjectList()
  372. {
  373. int i = 0;
  374. foreach(var item in DressPropTransInfoDic)
  375. {
  376. i++;
  377. if (item.Key == roleID)
  378. {
  379. indexRoleData = i;
  380. break;
  381. }
  382. indexRoleData = i;
  383. }
  384. if(itemGameObjs.Count ==0)
  385. {
  386. itemGameObjs.Add(roleGameobj);
  387. }
  388. else
  389. {
  390. if (indexRoleData > itemGameObjs.Count)
  391. {
  392. itemGameObjs.Add(roleGameobj);
  393. }
  394. else
  395. {
  396. itemGameObjs.Insert(indexRoleData, roleGameobj);
  397. }
  398. }
  399. }
  400. public void SetNumToRank(int index,UI_Component4 rankCom)
  401. {
  402. int c1 = 0;
  403. int c2 = 0;
  404. if(index<=3&& index >=1)
  405. {
  406. c2 = index;
  407. }
  408. if (index > 3 && index <= 9)
  409. {
  410. c1 = 0;
  411. }
  412. else if(index >9 && index <= 50)
  413. {
  414. c1 = 1;
  415. }
  416. else
  417. {
  418. c1 = 2;
  419. }
  420. rankCom.m_c1.selectedIndex = c1;
  421. rankCom.m_c2.selectedIndex = c2;
  422. if(c1 == 0)
  423. {
  424. rankCom.m_num3.url = string.Format("ui://MatchingCompetition/{0}",index.ToString());
  425. }
  426. else if(c1 == 1)
  427. {
  428. int one = index / 10;
  429. int two = index % 10;
  430. rankCom.m_num1.url = string.Format("ui://MatchingCompetition/{0}", one.ToString());
  431. rankCom.m_num2.url = string.Format("ui://MatchingCompetition/{0}", two.ToString());
  432. }
  433. else
  434. {
  435. if (index == 0)
  436. {
  437. rankCom.m_RankText.text = "--";
  438. }
  439. else
  440. {
  441. for (int i = 11; i < JudgingRoundRewardCfgArray.Instance.dataArray.Length-1; i++)
  442. {
  443. JudgingRoundRewardCfg judgingCfg = JudgingRoundRewardCfgArray.Instance.GetCfg(i);
  444. JudgingRoundRewardCfg judgingNextCfg = JudgingRoundRewardCfgArray.Instance.GetCfg(i+1);
  445. if (index >= judgingCfg.rank && index < judgingNextCfg.rank)
  446. {
  447. rankCom.m_RankText.text = judgingNextCfg.desc;
  448. }
  449. else
  450. {
  451. rankCom.m_RankText.text = index.ToString();
  452. }
  453. }
  454. }
  455. }
  456. }
  457. public async void AddSceneItem(ItemCfg itemCfg, bool setLayer,int isLeft = 0)
  458. {
  459. Vector3 pos = Vector3.zero;
  460. if (!string.IsNullOrEmpty(itemCfg.resLayer3))
  461. {
  462. DressPropIndex++;
  463. GameObject parentGameObj3 = new GameObject(string.Format("{0}_{1}_{2}", itemCfg.id, 3,DressPropIndex));
  464. await PhotographSceneManager.Instance.AddSceneItem(parentGameObj3, itemCfg, 3, setLayer,false,isLeft);
  465. if (setLayer)
  466. {
  467. if (parentGameObj3.transform.childCount > 0)
  468. {
  469. parentGameObj3.transform.localPosition = -parentGameObj3.transform.GetChild(0).localPosition;
  470. pos = parentGameObj3.transform.localPosition;
  471. }
  472. }
  473. }
  474. if (!string.IsNullOrEmpty(itemCfg.resLayer2))
  475. {
  476. DressPropIndex++;
  477. GameObject parentGameObj2 = new GameObject(string.Format("{0}_{1}_{2}", itemCfg.id, 2,DressPropIndex));
  478. await PhotographSceneManager.Instance.AddSceneItem(parentGameObj2, itemCfg, 2, setLayer,false, isLeft);
  479. if (setLayer)
  480. {
  481. if (parentGameObj2.transform.childCount > 0)
  482. {
  483. parentGameObj2.transform.localPosition = pos == Vector3.zero ? -parentGameObj2.transform.GetChild(0).localPosition : pos;
  484. pos = parentGameObj2.transform.localPosition;
  485. }
  486. }
  487. }
  488. if (!string.IsNullOrEmpty(itemCfg.resLayer1))
  489. {
  490. DressPropIndex++;
  491. GameObject parentGameObj1 = new GameObject(string.Format("{0}_{1}_{2}", itemCfg.id, 1, DressPropIndex));
  492. await PhotographSceneManager.Instance.AddSceneItem(parentGameObj1, itemCfg, 1, setLayer, false, isLeft);
  493. if (setLayer)
  494. {
  495. if (parentGameObj1.transform.childCount > 0)
  496. {
  497. parentGameObj1.transform.localPosition = pos == Vector3.zero ? -parentGameObj1.transform.GetChild(0).localPosition : pos;
  498. pos = parentGameObj1.transform.localPosition;
  499. }
  500. }
  501. }
  502. }
  503. public async void AddSceneItemOne(ItemCfg itemCfg, int layer,int index, int isLeft = 0, bool setLayer = true)
  504. {
  505. Vector3 pos = Vector3.zero;
  506. if(DressPropIndex <= index)
  507. {
  508. DressPropIndex = index + 1;
  509. }
  510. GameObject parentGameObj3 = new GameObject(string.Format("{0}_{1}_{2}", itemCfg.id, layer, index));
  511. await PhotographSceneManager.Instance.AddSceneItem(parentGameObj3, itemCfg, layer, setLayer, false, isLeft);
  512. if (setLayer)
  513. {
  514. if (parentGameObj3.transform.childCount > 0)
  515. {
  516. parentGameObj3.transform.localPosition = -parentGameObj3.transform.GetChild(0).localPosition;
  517. pos = parentGameObj3.transform.localPosition;
  518. }
  519. }
  520. }
  521. public void OnClickBtnRule()
  522. {
  523. ViewManager.Show<MatchingCompetitionRuleTipsView>();
  524. }
  525. }
  526. class MatchingOneDataManager : SingletonBase<MatchingOneDataManager>
  527. {
  528. //其他玩家信息用于展示
  529. public MatchingPhotoWorksData OneRoleInfo = new MatchingPhotoWorksData();
  530. //人物位置信息
  531. public TransformData roleTransFormData = new TransformData();
  532. public GameObject roleGameobj;
  533. public string roleID = "Role";
  534. //*********************搭配数据*********************************
  535. //需要传输的数据:MathingDressDate,DressUpBgID,DressPropIdList,TransformDataList,
  536. public DressUpData MathingDressDate = DressUpData.CreateDefault();
  537. public int DressUpBgID = 0;
  538. //*****这两个id放列表的最后面
  539. //边框id
  540. public int BorderID = 0;
  541. //NpcId
  542. public int NpcID = 0;
  543. //道具数据,一一对应
  544. //道具id
  545. //public List<int> DressPropIdList = new List<int>();
  546. //道具位置信息
  547. public List<TransformData> TransformDataList = new List<TransformData>();
  548. //道具索引
  549. public int DressPropIndex = 0;
  550. //道具索引字典
  551. public Dictionary<string, TransformData> DressPropTransInfoDic = new Dictionary<string, TransformData>();
  552. public List<GameObject> itemGameObjs = new List<GameObject>();
  553. //***************************************************************
  554. //解析后台获取的信息
  555. public void AnalysisInfoToList()
  556. {
  557. List<int> dressitemIDList = new List<int>();
  558. List<int> propIDList = new List<int>();
  559. List<TransformData> transDataList = new List<TransformData>();
  560. DressPropTransInfoDic.Clear();
  561. for (int i = 0; i < OneRoleInfo.JudgingInfo.CollocationInfoList.Count; i++)
  562. {
  563. CollocationInfo colloctItemInfo = OneRoleInfo.JudgingInfo.CollocationInfoList[i];
  564. if (colloctItemInfo.ItemId == roleID)
  565. {
  566. //propIDList.Add(colloctItemInfo.ItemId);
  567. //transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  568. DressPropTransInfoDic.Add(colloctItemInfo.ItemId, MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  569. }
  570. else
  571. {
  572. ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(MatchingCompetitionDataManager.Instance.GetIDByString( colloctItemInfo.ItemId));
  573. if (itemCfg != null && itemCfg.itemType == ConstItemType.DRESS_UP)
  574. {
  575. if (itemCfg.subType == 19 || itemCfg.subType == 17 || itemCfg.subType == 21 || itemCfg.subType == 22)
  576. {
  577. //记录道具和位置信息
  578. //propIDList.Add(colloctItemInfo.ItemId);
  579. //transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  580. DressPropTransInfoDic.Add(colloctItemInfo.ItemId, MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  581. }
  582. else if (itemCfg != null && itemCfg.subType == ConstDressUpItemType.BEI_JING)
  583. {
  584. DressUpBgID = itemCfg.id;
  585. }
  586. else
  587. {
  588. dressitemIDList.Add(MatchingCompetitionDataManager.Instance.GetIDByString(colloctItemInfo.ItemId));
  589. }
  590. }
  591. else if (itemCfg != null && itemCfg.itemType == ConstItemType.PHOTOGRAPH)
  592. {
  593. //记录道具和位置信息
  594. //propIDList.Add(colloctItemInfo.ItemId);
  595. //transDataList.Add(MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  596. DressPropTransInfoDic.Add(colloctItemInfo.ItemId, MatchingCompetitionDataManager.Instance.AnalysisStringToTransform(colloctItemInfo.ClientPosition));
  597. }
  598. }
  599. }
  600. MathingDressDate.itemList = dressitemIDList;
  601. MathingDressDate.actionId = OneRoleInfo.JudgingInfo.ActionId;
  602. //DressPropIdList = propIDList;
  603. //TransformDataList = transDataList;
  604. DressUpBgID = OneRoleInfo.JudgingInfo.BagId;
  605. }
  606. public void InsertGameObjectList()
  607. {
  608. int indexRoleData = 0;
  609. int i = 0;
  610. foreach (var item in DressPropTransInfoDic)
  611. {
  612. i++;
  613. if (item.Key == roleID)
  614. {
  615. indexRoleData = i;
  616. }
  617. }
  618. if (itemGameObjs.Count == 0)
  619. {
  620. itemGameObjs.Add(roleGameobj);
  621. }
  622. else
  623. {
  624. if (indexRoleData > itemGameObjs.Count)
  625. {
  626. itemGameObjs.Add(roleGameobj);
  627. }
  628. else
  629. {
  630. itemGameObjs.Insert(indexRoleData, roleGameobj);
  631. }
  632. }
  633. }
  634. }
  635. }