123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using DG.Tweening;
- public class InspectList : MonoBehaviour
- {
- public GameObject[] button;
- public GameObject[] tagText;//标题文本框
- public List<GameObject> inspectListObjList_WaiXiang = new List<GameObject>();//外箱
- public List<GameObject> inspectListObjList_FuJian = new List<GameObject>();//附件
- public List<GameObject> inspectListObjList_PeiZhi = new List<GameObject>();//附件
- private GameObject inspectListObj;
- public GameObject listParent;
- public GameObject inspectListObjParent_WaiXiang;//外箱列表父级
- public GameObject inspectListObjParent_FuJian;//外箱列表父级
- public GameObject inspectListObjParent_PeiZhi;//外箱列表父级
- public Material tagTextMaterial1, tagTextMaterial2;//标题文本框颜色
- public GameObject clickFrame;//点击的 蓝色 移动框
- public InspectListPanel inspectListPanel;
- public int inspectListObjIndex_WaiXiang = 0;//命名
- public int inspectListObjIndex_FuJian = 0;//命名
- public int inspectListObjIndex_PeiZhi = 0;//命名
- public void Start()
- {
- inspectListObj = Resources.Load("excel_buttom") as GameObject;
- //ShowBaseListView("WaiXiang");
- //MakeView_WaiXiang();
- //MakeView_FuJian();
- //MakeView_PeiZhi();
- }
- void OnDisable()
- {
- }
- public void UserClick(string ButtonName)
- {
-
- switch (ButtonName)
- {
- case "buttonTag1": //外箱
- ShowBaseListView("WaiXiang");
- clickFrame.transform.DOMove(button[0].transform.position, 0.5f);
- showTextTag(tagText[0]);
- inspectListPanel.ShowHandleClick(0);
- break;
- case "buttonTag2": //附件
- ShowBaseListView("FuJian");
- clickFrame.transform.DOMove(button[1].transform.position, 0.5f);
- showTextTag(tagText[1]);
- inspectListPanel.ShowHandleClick(5);
- break;
- case "buttonTag3": //配置
- ShowBaseListView("PeiZhi");
- showTextTag(tagText[2]);
- clickFrame.transform.DOMove(button[2].transform.position, 0.5f);
- inspectListPanel.ShowHandleClick(12);
- break;
- }
- }
- public void showTextTag(GameObject obj)
- {
- for (int i = 0; i < tagText.Length; i++)
- {
- if (tagText[i].name == obj.name)
- {
- tagText[i].transform.DOLocalMoveZ(-0.000279963f, 0.5f);
- tagText[i].GetComponent<MeshRenderer>().material = tagTextMaterial2;
- }
- else
- {
- tagText[i].transform.DOLocalMoveZ(0.003700018f, 0.5f);
- tagText[i].GetComponent<MeshRenderer>().material = tagTextMaterial1;
- }
- }
- }
- public void MakeView_WaiXiang()
- {
- for (int i = 0; i < inspectListObjList_WaiXiang.Count; i++)
- {
- inspectListObjIndex_WaiXiang++;
- GameObject obj = Instantiate(inspectListObj, new Vector3(inspectListObjList_WaiXiang[i].transform.position.x, inspectListObjList_WaiXiang[i].transform.position.y, 0.3526f), Quaternion.Euler(0, 0, -90));
- obj.transform.parent = inspectListObjParent_WaiXiang.transform;
- obj.name = "excel_buttom" + inspectListObjIndex_WaiXiang;
- inspectListPanel.taskList.Add(obj);
- }
- }
- public void MakeView_FuJian()
- {
- for (int i = 0; i < inspectListObjList_FuJian.Count; i++)
- {
- inspectListObjIndex_FuJian++;
- GameObject obj = Instantiate(inspectListObj, new Vector3(inspectListObjList_FuJian[i].transform.position.x, inspectListObjList_FuJian[i].transform.position.y, 0.3526f), Quaternion.Euler(0, 0, -90));
- obj.transform.parent = inspectListObjParent_FuJian.transform;
- obj.name = "excel_buttom" + inspectListObjIndex_FuJian;
- inspectListPanel.taskList.Add(obj);
- }
- }
- public void MakeView_PeiZhi()
- {
- for (int i = 0; i < inspectListObjList_PeiZhi.Count; i++)
- {
- inspectListObjIndex_PeiZhi++;
- if (inspectListObjIndex_PeiZhi <= inspectListObjList_PeiZhi.Count)
- {
- GameObject obj = Instantiate(inspectListObj, new Vector3(inspectListObjList_PeiZhi[i].transform.position.x, inspectListObjList_PeiZhi[i].transform.position.y, 0.3526f), Quaternion.Euler(0, 0, -90));
- obj.transform.parent = inspectListObjParent_PeiZhi.transform;
- obj.name = "excel_buttom" + inspectListObjIndex_PeiZhi;
- inspectListPanel.taskList.Add(obj);
- }
- }
- }
- public void ShowBaseListView(string str)
- {
- switch (str)
- {
- case "WaiXiang":
- // inspectListPanel.ShowContent(InspectListPanel.taskIndex);
- inspectListObjParent_WaiXiang.SetActive(true);
- inspectListObjParent_FuJian.SetActive(false);
- inspectListObjParent_PeiZhi.SetActive(false);
- // Invoke("Show1", 0.4f);
- break;
- case "FuJian":
- // inspectListPanel.ShowContent(InspectListPanel.taskIndex);
- inspectListObjParent_FuJian.SetActive(true);
- inspectListObjParent_PeiZhi.SetActive(false);
- inspectListObjParent_WaiXiang.SetActive(false);
- // Invoke("Show2", 0.4f);
- break;
- case "PeiZhi":
- // inspectListPanel.ShowContent(InspectListPanel.taskIndex);
- inspectListObjParent_PeiZhi.SetActive(true);
- inspectListObjParent_WaiXiang.SetActive(false);
- inspectListObjParent_FuJian.SetActive(false);
- // Invoke("Show3", 0.4f);
- break;
- }
- }
-
- }
|