XunJianDataManager.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. using XRTool.Util;
  6. public class XunJianDataManager : Singleton<XunJianDataManager>
  7. {
  8. public XunJianListData chooseXunJian;
  9. public List<XunJianListData> xjDataList = new List<XunJianListData>();
  10. public Dictionary<string, RenWuItem> renwuItemList;
  11. public void GetXunJianList(Action<List<XunJianListData>> callback)
  12. {
  13. WindowsManager.Instance.StartCoroutine(testBack(callback));
  14. }
  15. IEnumerator testBack(Action<List<XunJianListData>> callback)
  16. {
  17. xjDataList = new List<XunJianListData>();
  18. for (int i = 0; i < 7; i++)
  19. {
  20. XunJianListData xj = new XunJianListData();
  21. xj.id = i.ToString();
  22. xj.projectname = "projectname " + i.ToString();
  23. xj.inarea = "inarea " + i.ToString();
  24. xj.updateState = "updateState " + i.ToString();
  25. xj.projectState = "projectState " + i.ToString();
  26. xj.projectType = "projectType " + i.ToString();
  27. xj.projectTime = "projectTime " + i.ToString();
  28. switch(i)
  29. {
  30. case 0:
  31. xj.renwuModelType = RenWuModelType.DianYun;
  32. break;
  33. case 1:
  34. xj.renwuModelType = RenWuModelType.DingWeiBan;
  35. break;
  36. default:
  37. xj.renwuModelType = RenWuModelType.SaoTu;
  38. break;
  39. }
  40. xj.itemList = new List<string>();
  41. for (int j = 0; j < 7; j++)
  42. {
  43. xj.itemList.Add(j.ToString());
  44. }
  45. xjDataList.Add(xj);
  46. }
  47. yield return null;
  48. callback.Invoke(xjDataList);
  49. GetXunJianItemList((Dictionary<string, RenWuItem> back) => {
  50. });
  51. }
  52. public void GetXunJianItemList(Action<Dictionary<string, RenWuItem>> callback)
  53. {
  54. WindowsManager.Instance.StartCoroutine(testBack2(callback));
  55. }
  56. IEnumerator testBack2(Action<Dictionary<string,RenWuItem>> callback)
  57. {
  58. renwuItemList = new Dictionary<string, RenWuItem>();
  59. for (int i = 0; i < 7; i++)
  60. {
  61. RenWuItem rw = new RenWuItem();
  62. rw.id = i.ToString();
  63. rw.index = i;
  64. rw.info = "info" + i;
  65. int randomInt = UnityEngine.Random.Range(0, 10);
  66. rw.isPaiZhao = randomInt > 5 ? true : false;
  67. int randomInt2 = UnityEngine.Random.Range(0, 10);
  68. rw.isYuanChneg = randomInt2 > 5 ? true : false;
  69. rw.typeList = new List<RenWuTypeModel>();
  70. RenWuTypeModel rwtm = new RenWuTypeModel();
  71. rwtm.id = "1";
  72. rwtm.type = RenWuType.Image;
  73. rwtm.url = "/renwuType/Image.png";
  74. rw.typeList.Add(rwtm);
  75. RenWuTypeModel rwtm2 = new RenWuTypeModel();
  76. rwtm2.id = "2";
  77. rwtm2.type = RenWuType.Video;
  78. rwtm2.url = "/renwuType/Video.mp4";
  79. rw.typeList.Add(rwtm2);
  80. RenWuTypeModel rwtm3 = new RenWuTypeModel();
  81. rwtm3.id = "2";
  82. rwtm3.type = RenWuType.Model;
  83. rwtm3.url = "/renwuType/Model.mp4";
  84. rw.typeList.Add(rwtm3);
  85. RenWuTypeModel rwtm4 = new RenWuTypeModel();
  86. rwtm4.id = "2";
  87. rwtm4.type = RenWuType.Text;
  88. rwtm4.info = "Text12344566788";
  89. rw.typeList.Add(rwtm4);
  90. renwuItemList.Add(i.ToString(), rw);
  91. }
  92. yield return null;
  93. callback?.Invoke(renwuItemList);
  94. }
  95. public class XunJianListData
  96. {
  97. public int nowIndex = 0;
  98. public string id;
  99. public string projectname;
  100. public string inarea;
  101. public string updateState;
  102. public string projectState;
  103. public string projectType;
  104. public string projectTime;
  105. public List<string> itemList;
  106. public RenWuModelType renwuModelType;
  107. }
  108. public void GotoXunJian(XunJianListData xjld)
  109. {
  110. chooseXunJian = xjld;
  111. WindowsManager.Instance.show(WindowConfig.windowType.XunJianStart);
  112. }
  113. public RenWuItem GetRenWuItem(string id)
  114. {
  115. return renwuItemList[id];
  116. }
  117. public class RenWuItem
  118. {
  119. public string id;
  120. public int index;
  121. public bool isPaiZhao;
  122. public bool isYuanChneg;
  123. public string info;
  124. public List<RenWuTypeModel> typeList;
  125. }
  126. public class RenWuTypeModel
  127. {
  128. public RenWuType type;
  129. public string id;
  130. public string url;
  131. public string info;
  132. }
  133. public enum RenWuType
  134. {
  135. Text = 100001, // 文字
  136. Image = 100002, // 图片
  137. Video = 100003, // 视频
  138. Model = 100004, // 模型
  139. }
  140. public enum RenWuModelType
  141. {
  142. SaoTu = 100001, // 扫图
  143. DingWeiBan = 100002, // 定位板
  144. DianYun = 100003, // 点云
  145. }
  146. }