| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450 | 
							- using DG.Tweening;
 
- using Newtonsoft.Json;
 
- using Newtonsoft.Json.Linq;
 
- using System;
 
- using System.Collections;
 
- using System.Collections.Generic;
 
- using System.Threading.Tasks;
 
- using UnityAsync;
 
- using UnityEditor;
 
- using UnityEngine;
 
- using UnityEngine.Networking;
 
- using UnityEngine.UI;
 
- using WaitUntil = UnityAsync.WaitUntil;
 
- public enum XHGKImportantStatic
 
- {
 
-     BY,
 
-     TK,
 
-     GTK,
 
-     YK
 
- }
 
- [System.Serializable]
 
- public class DSJData
 
- {
 
-     public string year;
 
-     public string date;
 
-     public string title;
 
-     public string pos;
 
-     public string content;
 
-     public DSJData(string y, string d, string t, string p, string c)
 
-     {
 
-         year = y;
 
-         date = d;
 
-         title = t;
 
-         pos = p;
 
-         content = c;
 
-     }
 
- }
 
- [System.Serializable]
 
- public class XHGKLayerData
 
- {
 
-     public string datatime;
 
-     public string title;
 
-     public XHGKImportantStatic importantStatic;
 
-     public int year;
 
-     public bool havePic;
 
-     public string content;
 
- }
 
- public class XHGKLayer : YZTRootLayer
 
- {
 
-     public RectTransform xhgkContent;
 
-     public RectTransform compare;
 
-     public RectTransform yearContent;
 
-     public RectTransform middleContent;
 
-     public RectTransform importantContent;
 
-     public RectTransform rightContent;
 
-     public ScrollRect scrollView;
 
-     public List<XHGKLayerData> xHGKLayerDatas16;
 
-     public List<XHGKLayerData> xHGKLayerDatas17;
 
-     public List<XHGKLayerData> xHGKLayerDatas18;
 
-     public List<XHGKLayerData> xHGKLayerDatas19;
 
-     public List<XHGKLayerData> xHGKLayerDatas20;
 
-     public List<XHGKLayerData> xHGKLayerDatas21;
 
-     public List<XHGKLayerData> xHGKLayerDatas22;
 
-     public int currentActive = 0;
 
-     public List<YearBtn> yearBtns;
 
-     public ImportBtn importThingPrefab;
 
-     public Button closeBtn;
 
-     public Button showInfoBtn;
 
-     public Sprite[] showSprites;
 
-     public List<ImportBtn> importBtns;
 
-     public Image leftImage;
 
-     public RawImage rightImage;
 
-     public Image beforeImage;
 
-     public RawImage afterImage;
 
-     public Sprite[] workImages;
 
-     public Text compareText;
 
-     public Text timeText;
 
-     public Button compareBtn;
 
-     public Button exitCompareBtn;
 
-     public Transform filterContent;
 
-     private string[] filterName = new string[5] { "", "补元闸", "套口闸", "腰口泵站", "高潭口二站" }; 
 
-     // Start is called before the first frame update
 
-     async void Awake()
 
-     {
 
-         for (int i = 0; i < filterContent.childCount; i++)
 
-         {
 
-             Button btn = filterContent.GetChild(i).GetComponent<Button>();
 
-             int temp = i;
 
-             btn.onClick.AddListener(() =>
 
-             {
 
-                 for (int j = 0; j < filterContent.childCount; j++) {
 
-                     Button btn = filterContent.GetChild(j).GetComponent<Button>();
 
-                     btn.GetComponent<Image>().sprite = showSprites[1];
 
-                     if (temp == j) {
 
-                         btn.GetComponent<Image>().sprite = showSprites[0];
 
-                     }
 
-                 }
 
-                 InitDSJ(filterName[temp]);
 
-             });
 
-         }
 
-         yearBtns = new List<YearBtn>();
 
-         for (int i = 0; i < yearContent.childCount; i++)
 
-         {
 
-             yearBtns.Add(yearContent.GetChild(i).GetComponent<YearBtn>());
 
-             int temp = i;
 
-             if (yearBtns[i].defaultActive)
 
-             {
 
-                 currentActive = temp;
 
-             }
 
-             yearBtns[temp].heightY = -320 + 56 * temp;
 
-             yearBtns[temp].GetComponent<UnityEngine.UI.Button>().onClick.AddListener(() =>
 
-             {
 
-                 yearContent.DOLocalMoveY(yearBtns[temp].heightY, 0.3f);
 
-                 for (int j = 0; j < yearBtns.Count; j++)
 
-                 {
 
-                     yearBtns[j].OnActive(false);
 
-                 }
 
-                 currentActive = temp;
 
-                 yearBtns[temp].OnActive(true);
 
-                 ChangeImportantToCurrent();
 
-             });
 
-         }
 
-         compareBtn.onClick.AddListener(() =>
 
-         {
 
-             xhgkContent.gameObject.SetActive(false);
 
-             compare.gameObject.SetActive(true);
 
-         });
 
-         exitCompareBtn.onClick.AddListener(() =>
 
-         {
 
-             xhgkContent.gameObject.SetActive(true);
 
-             compare.gameObject.SetActive(false);
 
-         });
 
-         await InitData();
 
-         InitDSJ();
 
-     }
 
-     async Task InitData()
 
-     {
 
-         await new WaitUntil(() =>
 
-         {
 
-             return GlobalData.dsjContents.Count > 0;
 
-         });
 
-     }
 
-     void InitDSJ(string filter = "")
 
-     {
 
-         xHGKLayerDatas16.Clear();
 
-         xHGKLayerDatas17.Clear();
 
-         xHGKLayerDatas18.Clear();
 
-         xHGKLayerDatas19.Clear();
 
-         xHGKLayerDatas20.Clear();
 
-         xHGKLayerDatas21.Clear();
 
-         xHGKLayerDatas22.Clear();
 
-         for (int i = 0; i < GlobalData.dsjContents.Count; i++)
 
-         {
 
-             XHGKLayerData xHGKLayerDatas = new XHGKLayerData();
 
-             xHGKLayerDatas.year = int.Parse(GlobalData.dsjContents[i].year);
 
-             xHGKLayerDatas.datatime = GlobalData.dsjContents[i].date;
 
-             xHGKLayerDatas.title = GlobalData.dsjContents[i].title;
 
-             if (filter != "" && filter != GlobalData.dsjContents[i].pos)
 
-             {
 
-                 continue;
 
-             }
 
-             switch (GlobalData.dsjContents[i].pos)
 
-             {
 
-                 case "补元闸":
 
-                     xHGKLayerDatas.importantStatic = XHGKImportantStatic.BY;
 
-                     break;
 
-                 case "套口闸":
 
-                     xHGKLayerDatas.importantStatic = XHGKImportantStatic.TK;
 
-                     break;
 
-                 case "高潭口二站":
 
-                     xHGKLayerDatas.importantStatic = XHGKImportantStatic.GTK;
 
-                     break;
 
-                 case "腰口泵站":
 
-                     xHGKLayerDatas.importantStatic = XHGKImportantStatic.YK;
 
-                     break;
 
-                 default:
 
-                     xHGKLayerDatas.importantStatic = XHGKImportantStatic.BY;
 
-                     break;
 
-             }
 
-             //xHGKLayerDatas.importantStatic = XHGKImportantStatic.BY;
 
-             xHGKLayerDatas.content = GlobalData.dsjContents[i].content;
 
-             xHGKLayerDatas.havePic = true;
 
-             switch (GlobalData.dsjContents[i].year)
 
-             {
 
-                 case "2016":
 
-                     xHGKLayerDatas.havePic = false;
 
-                     xHGKLayerDatas16.Add(xHGKLayerDatas);
 
-                     break;
 
-                 case "2017":
 
-                     xHGKLayerDatas17.Add(xHGKLayerDatas);
 
-                     break;
 
-                 case "2018":
 
-                     xHGKLayerDatas18.Add(xHGKLayerDatas);
 
-                     break;
 
-                 case "2019":
 
-                     xHGKLayerDatas19.Add(xHGKLayerDatas);
 
-                     break;
 
-                 case "2020":
 
-                     xHGKLayerDatas20.Add(xHGKLayerDatas);
 
-                     break;
 
-                 case "2021":
 
-                     xHGKLayerDatas21.Add(xHGKLayerDatas);
 
-                     break;
 
-                 case "2022":
 
-                     xHGKLayerDatas22.Add(xHGKLayerDatas);
 
-                     break;
 
-             }
 
-         }
 
-         ChangeImportantToCurrent();
 
-         RefreshToFirst();
 
-     }
 
-     private void OnEnable()
 
-     {
 
-         RefreshToFirst();
 
-     }
 
-     async void RefreshRightImage(int year, int index)
 
-     {
 
-         string picName = "";
 
-         switch (index)
 
-         {
 
-             case 0:
 
-                 picName = "by.jpg";
 
-                 break;
 
-             case 1:
 
-                 picName = "tk.jpg";
 
-                 break;
 
-             case 2:
 
-                 picName = "gtk.jpg";
 
-                 break;
 
-             case 3:
 
-                 picName = "yk.jpg";
 
-                 break;
 
-         }
 
-         picName = ServerAddress.ServerPicPath + year + "/" + picName;
 
-         Debug.Log(picName);
 
-         WWW www = new WWW(picName);
 
-         await new UnityAsync.WaitUntil(() =>
 
-         {
 
-             return www.isDone;
 
-         });
 
-         rightImage.texture = www.texture;
 
-         afterImage.texture = www.texture;
 
-         www.Dispose();
 
-         Resources.UnloadUnusedAssets();
 
-     }
 
-     void RefreshToFirst()
 
-     {
 
-         if (importBtns.Count < 1) return;
 
-         for (int i = 0; i < importBtns.Count; i++)
 
-         {
 
-             importBtns[i].OnActive(false);
 
-         }
 
-         importBtns[0].OnActive(true);
 
-         int staticIndex = (int)importBtns[0].data1.importantStatic;
 
-         StaticLod.instance.OnFoucusStatic(staticIndex);
 
-         for (int j = 0; j < rightContent.childCount; j++) rightContent.GetChild(j).gameObject.SetActive(false);
 
-         rightContent.GetChild(staticIndex).gameObject.SetActive(true);
 
-         leftImage.sprite = workImages[staticIndex];
 
-         beforeImage.sprite = workImages[staticIndex];
 
-         if (staticIndex < importBtns.Count)
 
-         {
 
-             RefreshRightImage(importBtns[staticIndex].data1.year, staticIndex);
 
-             compareText.text = importBtns[staticIndex].data1.content;
 
-             timeText.text = importBtns[staticIndex].data1.datatime;
 
-         }
 
-         
 
-     }
 
-     void ChangeImportantToCurrent()
 
-     {
 
-         switch (currentActive)
 
-         {
 
-             case 0:
 
-                 InitDSJPanel(xHGKLayerDatas16);
 
-                 break;
 
-             case 1:
 
-                 InitDSJPanel(xHGKLayerDatas17);
 
-                 break;
 
-             case 2:
 
-                 InitDSJPanel(xHGKLayerDatas18);
 
-                 break;
 
-             case 3:
 
-                 InitDSJPanel(xHGKLayerDatas19);
 
-                 break;
 
-             case 4:
 
-                 InitDSJPanel(xHGKLayerDatas20);
 
-                 break;
 
-             case 5:
 
-                 InitDSJPanel(xHGKLayerDatas21);
 
-                 break;
 
-             case 6:
 
-                 InitDSJPanel(xHGKLayerDatas22);
 
-                 break;
 
-         }
 
-     }
 
-     async Task InitDSJPanel(List<XHGKLayerData> xHGKLayerDatas)
 
-     {
 
-         if (middleContent.gameObject.activeSelf)
 
-         {
 
-             showInfoBtn.gameObject.SetActive(false);
 
-         }
 
-         closeBtn.onClick.AddListener(() =>
 
-         {
 
-             showInfoBtn.gameObject.SetActive(true);
 
-             middleContent.gameObject.SetActive(false);
 
-         });
 
-         showInfoBtn.onClick.AddListener(() =>
 
-         {
 
-             showInfoBtn.gameObject.SetActive(false);
 
-             middleContent.gameObject.SetActive(true);
 
-         });
 
-         scrollView.GetComponent<CanvasGroup>().alpha = 0;
 
-         for (int i = importBtns.Count - 1; i >= 0; i--)
 
-         {
 
-             Destroy(importBtns[i].gameObject);
 
-             importBtns.RemoveAt(i);
 
-         }
 
-         for (int i = 0; i < xHGKLayerDatas.Count; i++)
 
-         {
 
-             ImportBtn btn = Instantiate(importThingPrefab);
 
-             btn.GetComponent<RectTransform>().SetParent(importantContent);
 
-             btn.GetComponent<RectTransform>().localScale = Vector3.one;
 
-             int tempI = i;
 
-             btn.OnInit(xHGKLayerDatas[tempI]);
 
-             btn.OnActive(false);
 
-             btn.button.onClick.AddListener(() =>
 
-             {
 
-                 for (int i = 0; i < importBtns.Count; i++)
 
-                 {
 
-                     importBtns[i].OnActive(false);
 
-                 }
 
-                 importBtns[tempI].OnActive(true);
 
-                 int staticIndex = (int)importBtns[tempI].data1.importantStatic;
 
-                 StaticLod.instance.OnFoucusStatic(staticIndex);
 
-                 for (int j = 0; j < rightContent.childCount; j++) rightContent.GetChild(j).gameObject.SetActive(false);
 
-                 rightContent.GetChild(staticIndex).gameObject.SetActive(true);
 
-                 leftImage.sprite = workImages[staticIndex];
 
-                 beforeImage.sprite = workImages[staticIndex];
 
-                 RefreshRightImage(importBtns[tempI].data1.year, staticIndex);
 
-                 compareText.text = importBtns[tempI].data1.content;
 
-                 timeText.text = importBtns[tempI].data1.datatime;
 
-             });
 
-             importBtns.Add(btn);
 
-         }
 
-         await new UnityAsync.WaitForSeconds(0.04f);
 
-         scrollView.verticalNormalizedPosition = 1;
 
-         DOTween.To(() => scrollView.GetComponent<CanvasGroup>().alpha, x => scrollView.GetComponent<CanvasGroup>().alpha = x, 1, 0.5f);
 
-     }
 
-     // Update is called once per frame
 
-     void Update()
 
-     {
 
-         if (yearBtns.Count > 0)
 
-         {
 
-             for (int i = 0; i < yearBtns.Count; i++)
 
-             {
 
-                 int offset = Mathf.Abs(i - currentActive);
 
-                 yearBtns[i].normalDig.color = new Color(1, 1, 1, 1 - 0.2f * offset);
 
-                 yearBtns[i].activeDig.color = new Color(1, 1, 1, 1 - 0.2f * offset);
 
-             }
 
-         }
 
-         if (StaticLod.instance.currentStatic != null)
 
-         {
 
-             if (middleContent.gameObject.activeSelf)
 
-             {
 
-                 Vector3 pos = CameraManager.instance.mainCamera.WorldToScreenPoint(StaticLod.instance.currentStatic.transform.position) * 1920.0f / Screen.width;
 
-                 //middleContent.anchoredPosition = new Vector3(pos.x - 400, pos.y + 200, pos.z);
 
-                 Vector3 tempPos = new Vector3(pos.x - 400, pos.y + 200, pos.z);
 
-                 middleContent.anchoredPosition = new Vector3(Screen.width/2,Screen.height/2,pos.z);
 
-                 if (tempPos.x < 500 || tempPos.x > 1400 || tempPos.y < 70 || tempPos.y > 950)
 
-                 {
 
-                     if (middleContent.GetComponent<CanvasGroup>().alpha > 0)
 
-                     {
 
-                         middleContent.GetComponent<CanvasGroup>().alpha -= Time.deltaTime * 3;
 
-                     }
 
-                 }
 
-                 else
 
-                 {
 
-                     if (middleContent.GetComponent<CanvasGroup>().alpha < 1)
 
-                     {
 
-                         middleContent.GetComponent<CanvasGroup>().alpha += Time.deltaTime * 3;
 
-                     }
 
-                 }
 
-             }
 
-         }
 
-     }
 
-     private void LateUpdate()
 
-     {
 
-         showInfoBtn.GetComponent<RectTransform>().anchoredPosition = CameraManager.instance.mainCamera.WorldToScreenPoint(StaticLod.instance.currentStatic.transform.position) / Screen.width * 1920.0f;
 
-     }
 
- }
 
 
  |