XunJianDataManager.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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.roadList = new List<Vector3>();
  44. Vector3 v3 = new Vector3(UnityEngine.Random.Range(-3.1f, 3.1f), 0, UnityEngine.Random.Range(-3.1f, 3.1f));
  45. rw.roadList.Add(v3);
  46. rw.roadList.Add(new Vector3(v3.x + UnityEngine.Random.Range(-2.1f, 2.1f), 0, v3.z + UnityEngine.Random.Range(-2.1f, 2.1f)));
  47. rw.id = j.ToString();
  48. rw.index = j;
  49. rw.info = "info" + j;
  50. int randomInt = UnityEngine.Random.Range(0, 10);
  51. rw.isPaiZhao = randomInt > 5 ? true : false;
  52. int randomInt2 = UnityEngine.Random.Range(0, 10);
  53. rw.isYuanChneg = randomInt2 > 5 ? true : false;
  54. rw.typeList = new List<RenWuTypeModel>();
  55. RenWuTypeModel rwtm = new RenWuTypeModel();
  56. rwtm.id = "1";
  57. rwtm.type = RenWuType.Image;
  58. rwtm.url = "/renwuType/Image.png";
  59. rw.typeList.Add(rwtm);
  60. RenWuTypeModel rwtm2 = new RenWuTypeModel();
  61. rwtm2.id = "2";
  62. rwtm2.type = RenWuType.Video;
  63. rwtm2.url = "/renwuType/Video.mp4";
  64. rw.typeList.Add(rwtm2);
  65. RenWuTypeModel rwtm3 = new RenWuTypeModel();
  66. rwtm3.id = "2";
  67. rwtm3.type = RenWuType.Model;
  68. rwtm3.url = "/renwuType/Model.mp4";
  69. rw.typeList.Add(rwtm3);
  70. RenWuTypeModel rwtm4 = new RenWuTypeModel();
  71. rwtm4.id = "2";
  72. rwtm4.type = RenWuType.Text;
  73. rwtm4.info = "Text12344566788";
  74. rw.typeList.Add(rwtm4);
  75. xj.itemList.Add(rw);
  76. }
  77. xjDataList.Add(xj);
  78. }
  79. yield return null;
  80. callback.Invoke(xjDataList);
  81. }
  82. public class XunJianListData
  83. {
  84. public int nowIndex = 0;
  85. public string id;
  86. public string projectname;
  87. public string inarea;
  88. public string updateState;
  89. public string projectState;
  90. public string projectType;
  91. public string projectTime;
  92. public List<RenWuItem> itemList;
  93. public RenWuModelType renwuModelType;
  94. }
  95. public void GotoXunJian(XunJianListData xjld)
  96. {
  97. chooseXunJian = xjld;
  98. WindowsManager.Instance.show(WindowConfig.windowType.XunJianStart);
  99. }
  100. public void gotoNext()
  101. {
  102. if(chooseXunJian.itemList.Count-1 > chooseXunJian.nowIndex)
  103. {
  104. chooseXunJian.nowIndex++;
  105. if (JinRuRenwu.Instance != null)
  106. {
  107. JinRuRenwu.Instance.UpdateData();
  108. }
  109. if (RenWuListWindow.Instance != null)
  110. {
  111. RenWuListWindow.Instance.UpdateData();
  112. }
  113. }else
  114. {
  115. List<string> backTip = new List<string>();
  116. backTip.Add("1");
  117. backTip.Add("2");
  118. backTip.Add("3");
  119. WindowsManager.Instance.show(WindowConfig.windowType.Error, false, WindowsManager.Instance.getErrorData("提示", "已经是最后一步了!", Color.gray, "icon", backTip, false, "敬请期待", 5).ToJson());
  120. }
  121. }
  122. public void chooseItem(int i)
  123. {
  124. chooseXunJian.nowIndex = i;
  125. if (JinRuRenwu.Instance != null)
  126. {
  127. JinRuRenwu.Instance.UpdateData();
  128. }
  129. if (RenWuListWindow.Instance != null)
  130. {
  131. RenWuListWindow.Instance.UpdateData();
  132. }
  133. }
  134. public class RenWuItem
  135. {
  136. public string id;
  137. public int index;
  138. public bool isPaiZhao;
  139. public bool isYuanChneg;
  140. public string info;
  141. public List<RenWuTypeModel> typeList;
  142. public List<Vector3> roadList;
  143. public RenWuState state = RenWuState.None;
  144. }
  145. public class RenWuTypeModel
  146. {
  147. public RenWuType type;
  148. public string id;
  149. public string url;
  150. public string info;
  151. }
  152. public enum RenWuState
  153. {
  154. None = 100001, // 未处理
  155. Success = 100002, // 成功
  156. Fail = 100003, // 失败
  157. }
  158. public enum RenWuType
  159. {
  160. Text = 100001, // 文字
  161. Image = 100002, // 图片
  162. Video = 100003, // 视频
  163. Model = 100004, // 模型
  164. }
  165. public enum RenWuModelType
  166. {
  167. SaoTu = 100001, // 扫图
  168. DingWeiBan = 100002, // 定位板
  169. DianYun = 100003, // 点云
  170. }
  171. }