XunJianDataManager.cs 5.2 KB

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