123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450 |
- using LitJson;
- using System.Collections;
- using System.Collections.Generic;
- using TMPro;
- using UnityEngine;
- using UnityEngine.UI;
- using XRTool.Util;
- using static XunJianDataManager;
- public class JinRuRenwu : WindowSingleton<JinRuRenwu>
- {
- RenWuItem rwitem;
- public GameObject WenJianLan;
- public TextMeshProUGUI info;
- public GameObject TaskGo;
- public GameObject VideoBT;
- public GameObject ModelBT;
- public GameObject ImageBT;
- public GameObject Image2BT;
- public GameObject TextBT;
- public GameObject AllBT;
- public GameObject Video;
- public GameObject Model;
- public GameObject Image;
- public GameObject Image2;
- public GameObject Text;
- public GameObject paizhaoGo;
- public TextMeshProUGUI indexText;
- public List<GameObject> updateList;
- public GameObject kong;
- public GameObject saotuTip;
- public GameObject StartGo;
- public GameObject paizhaoanniu;
- public int PaiZhaoIndex=0;
- public override void OnEnable()
- {
- base.OnEnable();
- }
- public void isPaiZhao(bool isPaizhao)
- {
- if(isPaizhao)
- {
- changIndex(0);
- }
- else
- {
- changIndex(1);
- }
- }
- public void changIndex(int i)
- {
- PaiZhaoIndex = i;
- if(PaiZhaoIndex==0)
- {
- if (ChangeCameraSaoMiao.Instance)
- ChangeCameraSaoMiao.Instance.showpaizhao();
- }else
- {
- if (ChangeCameraSaoMiao.Instance)
- ChangeCameraSaoMiao.Instance.showluxiang();
- }
- }
- public void initStart()
- {
- saotuTip.SetActive(true);
- StartGo.SetActive(false);
- saotuTip.GetComponent<SaoTuManager>().showSaoTu();
- }
-
- public void GotoStart()
- {
- XunJianDataManager.Instance.chooseXunJian.nowIndex = -1;
- switch (XunJianDataManager.Instance.chooseXunJian.renwuModelType)
- {
- case RenWuModelType.SaoTu:
- ChangeCameraSaoMiao.Instance.showsaomiao(XunJianDataManager.Instance.chooseXunJian.itemList[0]);
- break;
- case RenWuModelType.DianYun:
- break;
- case RenWuModelType.DingWeiBan:
- break;
- }
-
- }
- public void show()
- {
- Debug.Log("showshowshowshowshowshow");
- saotuTip.SetActive(false);
- StartGo.SetActive(true);
-
- TimerMgr.Instance.CreateTimer(() => {
- kong.SetActive(!kong.activeSelf);
- }, 0.01f, 6);
- gotoNextItem();
-
-
- }
-
- public override void UpdateData()
- {
- base.UpdateData();
- ChangeCameraSaoMiao.Instance.close();
- VideoBT.SetActive(false);
- ModelBT.SetActive(false);
- ImageBT.SetActive(false);
- Image2BT.SetActive(false);
- TextBT.SetActive(false);
- rwitem = XunJianDataManager.Instance.chooseXunJian.itemList[XunJianDataManager.Instance.chooseXunJian.nowIndex];
- if(XunJianDataManager.Instance.chooseXunJian.renwuModelType== RenWuModelType.DianYun)
- {
- LineManager.Instance.setRoad(rwitem.roadList);
- }
- indexText.text = (rwitem.index+1).ToString();
- info.text = rwitem.info;
- if (rwitem.typeList.Count > 0)
- {
- int img = 0;
- for (int i = 0; i < rwitem.typeList.Count; i++)
- {
- switch (rwitem.typeList[i].type)
- {
- case RenWuType.Image:
- if(img==0)
- {
- ImageBT.SetActive(true);
- Image.GetComponent<RenWuTypeWindow>().updateData(rwitem.typeList[i]);
- }
- else
- {
- Image2BT.SetActive(false);
- Image2.GetComponent<RenWuTypeWindow>().updateData(rwitem.typeList[i]);
- }
- img++;
- break;
- case RenWuType.Model:
- ModelBT.SetActive(true);
- Model.GetComponent<RenWuTypeWindow>().updateData(rwitem.typeList[i]);
- break;
- case RenWuType.Text:
- TextBT.SetActive(true);
- Text.GetComponent<RenWuTypeWindow>().updateData(rwitem.typeList[i]);
- break;
- case RenWuType.Video:
- VideoBT.SetActive(true);
- Video.GetComponent<RenWuTypeWindow>().updateData(rwitem.typeList[i]);
- break;
- }
- }
- if(rwitem.typeList.Count < 2)
- {
- AllBT.SetActive(false);
- }else
- {
- AllBT.SetActive(true);
- }
- WenJianLan.SetActive(true);
- }
- else
- {
- WenJianLan.SetActive(false);
- }
- }
- private void OnDisable()
- {
- if(ChangeCameraSaoMiao.Instance)
- {
- ChangeCameraSaoMiao.Instance.close();
- ChangeCameraSaoMiao.Instance.checkLuXiang();
- }
- LineManager.Instance.stop();
- WindowGenSui.Instance.jd = 30;
-
- }
- public List<GameObject> getResGo()
- {
- List<GameObject> list = new List<GameObject>();
- int img = 0;
- for (int i = 0; i < rwitem.typeList.Count; i++)
- {
- switch (rwitem.typeList[i].type)
- {
- case RenWuType.Image:
- if (img == 0)
- {
- list.Add(Image);
- }
- else
- {
- list.Add(Image2);
- }
- img++;
- break;
- case RenWuType.Model:
- list.Add(Model);
- break;
- case RenWuType.Text:
- list.Add(Text);
- break;
- case RenWuType.Video:
- list.Add(Video);
- break;
- }
- }
- return list;
- }
- public void gotoRTC()
- {
- WindowsManager.Instance.show(WindowConfig.windowType.Tip2, false, "¾´ÇëÆÚ´ý!");
-
- }
- public void showAll()
- {
- List<GameObject> list = getResGo();
- bool isOpen=false;
- for (int i = 0; i < list.Count; i++)
- {
- if(!list[i].activeSelf)
- {
- isOpen = true;
- }
- }
- for (int i = 0; i < list.Count; i++)
- {
- list[i].SetActive(isOpen);
- }
- checkJd();
- }
- void checkJd()
- {
- List<GameObject> list = getResGo();
- int ct=0;
- for (int i = 0; i < list.Count; i++)
- {
- if (list[i].activeSelf)
- {
- ct++;
- }
- }
- if (JinRuRenwu.Instance.paizhaoGo.activeSelf)
- {
- ct += 1;
- }
- if (ct >3)
- WindowGenSui.Instance.jd = 60;
- else if (ct > 0)
- WindowGenSui.Instance.jd = 45;
- else
- {
- WindowGenSui.Instance.jd = 30;
- }
- }
- public void closeAll()
- {
- List<GameObject> list = getResGo();
- for (int i = 0; i < list.Count; i++)
- {
- list[i].SetActive(false);
- }
- }
- public void showText()
- {
- Text.SetActive(!Text.activeSelf);
- if (!JinRuRenwu.Instance.paizhaoGo.activeSelf)
- {
- Text.transform.SetAsFirstSibling();
- }
- else
- {
- Video.transform.SetSiblingIndex(1);
- }
- checkJd();
- }
- public void showImage()
- {
- Image.SetActive(!Image.activeSelf);
- if (!JinRuRenwu.Instance.paizhaoGo.activeSelf)
- {
- Image.transform.SetAsFirstSibling();
- }
- else
- {
- Video.transform.SetSiblingIndex(1);
- }
- checkJd();
- }
- public void showImage2()
- {
- Image2.SetActive(!Image2.activeSelf);
- if (!JinRuRenwu.Instance.paizhaoGo.activeSelf)
- {
- Image2.transform.SetAsFirstSibling();
- }
- else
- {
- Video.transform.SetSiblingIndex(1);
- }
- checkJd();
- }
- public void showModel()
- {
- Model.SetActive(!Model.activeSelf);
- if (!JinRuRenwu.Instance.paizhaoGo.activeSelf)
- {
- Model.transform.SetAsFirstSibling();
- }
- else
- {
- Video.transform.SetSiblingIndex(1);
- }
- checkJd();
- }
- public void showVideo()
- {
- Video.SetActive(!Video.activeSelf);
- if (!JinRuRenwu.Instance.paizhaoGo.activeSelf)
- {
- Video.transform.SetAsFirstSibling();
- }
- else
- {
- Video.transform.SetSiblingIndex(1);
- }
- checkJd();
- }
- public Toggle paizhaoToggle;
- public void GotoPaiZhao()
- {
- if(!JinRuRenwu.Instance.paizhaoGo.activeSelf)
- {
- PaiZhaoIndex = 0;
- ChangeCameraSaoMiao.Instance.showpaizhao();
- }else
- {
- paizhaoToggle.isOn = true;
- ChangeCameraSaoMiao.Instance.close();
- }
- checkJd();
-
- }
- public void paizhaoAndLuxiang()
- {
- if (PaiZhaoIndex == 0)
- {
- ChangeCameraSaoMiao.Instance.paizhaoclick();
- }
- else
- {
- ChangeCameraSaoMiao.Instance.luxiangClick();
- }
- }
- public void GotoTask()
- {
- TaskGo.SetActive(!TaskGo.activeSelf);
- }
- public void updateListRef()
- {
- for (int i = updateList.Count-1; i >=0; i--)
- {
- if ((updateList[i].GetComponent<ContentSizeFitter>()))
- {
- updateList[i].GetComponent<ContentSizeFitter>().SetLayoutVertical();
- updateList[i].GetComponent<ContentSizeFitter>().SetLayoutHorizontal();
- }
- if (updateList[i].GetComponent<HorizontalLayoutGroup>())
- {
- updateList[i].GetComponent<HorizontalLayoutGroup>().SetLayoutHorizontal();
- updateList[i].GetComponent<HorizontalLayoutGroup>().CalculateLayoutInputHorizontal();
- }
- if ((updateList[i].GetComponent<VerticalLayoutGroup>()))
- {
- updateList[i].GetComponent<VerticalLayoutGroup>().SetLayoutVertical();
- updateList[i].GetComponent<VerticalLayoutGroup>().CalculateLayoutInputVertical();
- }
- }
- }
- public void successItem()
- {
- rwitem.state = RenWuState.Success;
- }
- public void failItem()
- {
- rwitem.state = RenWuState.Fail;
- }
- public void gotoNextItem()
- {
- XunJianDataManager.Instance.gotoNext();
- }
- public void GotoLieBiao()
- {
- WindowsManager.Instance.show(WindowConfig.windowType.XunJianLB);
- }
- }
|