123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217 |
- using LitJson;
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using XRTool.Util;
- using static easyar.ImageTargetController;
- public class XunJianDataManager : Singleton<XunJianDataManager>
- {
- public XunJianListData chooseXunJian;
- public List<XunJianListData> xjDataList = new List<XunJianListData>();
- public void GetXunJianList(Action<List<XunJianListData>> callback)
- {
- WindowsManager.Instance.StartCoroutine(testBack(callback));
- }
- IEnumerator testBack(Action<List<XunJianListData>> callback)
- {
- xjDataList = new List<XunJianListData>();
- for (int i = 0; i < 7; i++)
- {
- XunJianListData xj = new XunJianListData();
- xj.id = i.ToString();
- xj.projectname = "projectname " + i.ToString();
- xj.inarea = "inarea " + i.ToString();
- xj.updateState = "updateState " + i.ToString();
- xj.projectState = "projectState " + i.ToString();
- xj.projectType = "projectType " + i.ToString();
- xj.projectTime = "projectTime " + i.ToString();
- switch(i)
- {
- case 0:
- xj.renwuModelType = RenWuModelType.DianYun;
- break;
- case 1:
- xj.renwuModelType = RenWuModelType.DingWeiBan;
- break;
- default:
- xj.renwuModelType = RenWuModelType.SaoTu;
- break;
- }
- xj.itemList = new List<RenWuItem>();
- for (int j = 0; j < 7; j++)
- {
- RenWuItem rw = new RenWuItem();
- rw.imageUrl = Application.streamingAssetsPath + "/ARTargetImage/"+(j+1)+".png";
-
- rw.roadList = new List<Vector3>();
- Vector3 v3 = new Vector3(UnityEngine.Random.Range(-3.1f, 3.1f), 0, UnityEngine.Random.Range(-3.1f, 3.1f));
- rw.roadList.Add(v3);
- rw.roadList.Add(new Vector3(v3.x + UnityEngine.Random.Range(-2.1f, 2.1f), 0, v3.z + UnityEngine.Random.Range(-2.1f, 2.1f)));
-
- rw.id = j.ToString();
-
- rw.index = j;
-
- rw.info = "info" + j;
-
- int randomInt = UnityEngine.Random.Range(0, 10);
- rw.isPaiZhao = randomInt > 5 ? true : false;
-
- int randomInt2 = UnityEngine.Random.Range(0, 10);
- rw.isYuanCheng = randomInt2 > 5 ? true : false;
-
- rw.typeList = new List<RenWuTypeModel>();
- RenWuTypeModel rwtm = new RenWuTypeModel();
- rwtm.id = "1";
- rwtm.type = RenWuType.Image;
- rwtm.url = Application.streamingAssetsPath+ "/Art/16:9.jpg";
- rw.typeList.Add(rwtm);
- RenWuTypeModel rwtm2 = new RenWuTypeModel();
- rwtm2.id = "2";
- rwtm2.type = RenWuType.Video;
- rwtm2.url = Application.streamingAssetsPath + "/Art/Video.mp4";
- rw.typeList.Add(rwtm2);
- RenWuTypeModel rwtm3 = new RenWuTypeModel();
- rwtm3.id = "3";
- rwtm3.type = RenWuType.Model;
- rwtm3.url = Application.streamingAssetsPath + "/Art/ExampleCar.fbx";
- rw.typeList.Add(rwtm3);
- RenWuTypeModel rwtm4 = new RenWuTypeModel();
- rwtm4.id = "4";
- rwtm4.type = RenWuType.Text;
- rwtm4.info = "Text12344566788";
- rw.typeList.Add(rwtm4);
- xj.itemList.Add(rw);
- }
- xjDataList.Add(xj);
- }
- yield return null;
- callback.Invoke(xjDataList);
- }
- public class XunJianListData
- {
- public int nowIndex = 0;
- public string id;
- public string projectname;
- public string inarea;
- public string updateState;
- public string projectState;
- public string projectType;
- public string projectTime;
- public List<RenWuItem> itemList;
- public RenWuModelType renwuModelType;
- }
- public void GotoXunJian(XunJianListData xjld)
- {
- chooseXunJian = xjld;
- WindowsManager.Instance.show(WindowConfig.windowType.XunJianStart);
- JinRuRenwu.Instance.initStart();
- }
- public void gotoNext()
- {
- if(chooseXunJian.itemList.Count-1 > chooseXunJian.nowIndex)
- {
- chooseXunJian.nowIndex++;
- if (JinRuRenwu.Instance != null)
- {
- JinRuRenwu.Instance.UpdateData();
- }
- if (RenWuListWindow.Instance != null)
- {
- RenWuListWindow.Instance.UpdateData();
- }
- if (CaoZuoLanManager.Instance)
- CaoZuoLanManager.Instance.nextInteractable(false);
- }
- else
- {
- List<string> backTip = new List<string>();
- JsonData data = new JsonData();
- data["type"] = "30001";
- backTip.Add("1");
- backTip.Add(data.ToJson());
- backTip.Add("3");
- WindowsManager.Instance.show(WindowConfig.windowType.Error, false, WindowsManager.Instance.getErrorData("提示", "已经是最后一步了!", Color.gray, "icon", backTip, false, "自动退出", 5,"","退出巡检","返回").ToJson());
- }
- }
- public void chooseItem(int i)
- {
- chooseXunJian.nowIndex = i;
- if (JinRuRenwu.Instance != null)
- {
- JinRuRenwu.Instance.UpdateData();
- }
- if (RenWuListWindow.Instance != null)
- {
- RenWuListWindow.Instance.UpdateData();
- }
- }
- public class RenWuItem
- {
- public string id;
- public int index;
- public bool isPaiZhao;
- public bool isYuanCheng;
- public string info;
- public List<RenWuTypeModel> typeList;
- public List<Vector3> roadList;
- public string imageUrl;
- public ImageFileSourceData imageData;
- public RenWuState state = RenWuState.None;
- }
- public class RenWuTypeModel
- {
- public RenWuType type;
- public string id;
- public string url;
- public string info;
- }
- public enum RenWuState
- {
- None = 100001,
- Success = 100002,
- Fail = 100003,
- }
- public enum RenWuType
- {
- Text = 100001,
- Image = 100002,
- Video = 100003,
- Model = 100004,
- }
- public enum RenWuModelType
- {
- SaoTu = 100001,
- DingWeiBan = 100002,
- DianYun = 100003,
- }
- }
|