123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280 |
- 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));
- }
- XunJianListData testData()
- {
- XunJianListData xj = new XunJianListData();
- xj.id = "saotu";
- xj.url = Application.streamingAssetsPath + "/DianYun/85471-ghzoffice (2).bytes";
- xj.projectname = "(扫图版本)GHZ-巡检测试";
- xj.inarea = "杨浦区";
- xj.updateState = "新项目";
- xj.projectState = "测试巡检 ";
- xj.projectType = "未开始 ";
- xj.projectTime = "2023/11/23 10:53 ";
- xj.renwuModelType = RenWuModelType.SaoTu;
- xj.itemList = getRenwuData();
- return xj;
- }
- XunJianListData testData2()
- {
- XunJianListData xj = new XunJianListData();
- xj.id = "saotu";
- xj.url = Application.streamingAssetsPath + "/DianYun/85471-ghzoffice (2).bytes";
- xj.projectname = "(点云版本)GHZ-巡检测试";
- xj.inarea = "杨浦区";
- xj.updateState = "新项目";
- xj.projectState = "测试巡检 ";
- xj.projectType = "未开始 ";
- xj.projectTime = "2023/11/23 10:53 ";
- xj.renwuModelType = RenWuModelType.DianYun;
- xj.itemList = getRenwuData();
- return xj;
- }
- List<RenWuItem> getRenwuData()
- {
- List < RenWuItem > itemlist = new List<RenWuItem>();
- for (int j = 0; j < 7; j++)
- {
- RenWuItem rw = new RenWuItem();
- rw.imageUrl = Application.streamingAssetsPath + "/ARTargetImage/" + (j + 1) + ".png";
-
- rw.id = j.ToString();
-
- rw.index = j;
- switch(j)
- {
- case 0:
-
- rw.roadList = new List<Vector3>();
- rw.roadList.Add(new Vector3(-4.2f+0.5f, 0, 0.92f));
- rw.roadList.Add(new Vector3(-4.2f + 0.5f, 0, 2));
- rw.roadList.Add(new Vector3(-5 + 0.5f, 0, 2));
- rw.info = "请检查办公室大门------并拍照/录像记录";
- break;
- case 1:
-
- rw.roadList = new List<Vector3>();
- rw.roadList.Add(new Vector3(-4.2f + 0.5f, 0, 0.92f));
- rw.info = "查看垃圾桶是否有垃圾------并拍照/录像记录";
- break;
- case 2:
-
- rw.roadList = new List<Vector3>();
- rw.roadList.Add(new Vector3(-4.2f + 0.5f, 0, -1.6f));
- rw.info = "检查空调是否正常------并拍照/录像记录";
- break;
- case 3:
-
- rw.roadList = new List<Vector3>();
- rw.roadList.Add(new Vector3(-4.2f + 0.5f, 0, 0.52f));
- rw.roadList.Add(new Vector3(-1.78f, 0, 0.52f));
- rw.roadList.Add(new Vector3(-1.78f, 0, -1.6f));
- rw.info = "请打开窗户并处于通风状态------并拍照/录像记录";
- break;
- case 4:
-
- rw.roadList = new List<Vector3>();
- rw.roadList.Add(new Vector3(-1.78f, 0, 0.52f));
- rw.roadList.Add(new Vector3(-5.18f + 0.5f, 0, 0.52f));
- rw.info = "冰箱内是否有过期食品------并拍照/录像记录";
- break;
- case 5:
-
- rw.roadList = new List<Vector3>();
- rw.roadList.Add(new Vector3(-1.78f, 0, 0.52f));
- rw.info = "确保所有眼镜都在充电------并拍照/录像记录";
- break;
- case 6:
-
- rw.roadList = new List<Vector3>();
- rw.roadList.Add(new Vector3(-4.2f + 0.5f, 0, 0.52f));
- rw.roadList.Add(new Vector3(-1.78f, 0, 0.52f));
- rw.roadList.Add(new Vector3(-1.78f, 0, -1f));
- rw.info = "请回到工位继续工作------并拍照/录像记录";
- break;
- }
-
-
- 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 = rw.info;
- rw.typeList.Add(rwtm4);
- itemlist.Add(rw);
- }
- return itemlist;
- }
- IEnumerator testBack(Action<List<XunJianListData>> callback)
- {
- xjDataList = new List<XunJianListData>();
- xjDataList.Add(testData());
- xjDataList.Add(testData2());
- 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 string url;
- }
- 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,
- }
- }
|