using System.Collections; using System.Collections.Generic; using UnityEngine; using DG.Tweening; public class InspectList : MonoBehaviour { public GameObject[] button; public GameObject[] tagText;//标题文本框 public List inspectListObjList_WaiXiang = new List();//外箱 public List inspectListObjList_FuJian = new List();//附件 public List inspectListObjList_PeiZhi = new List();//附件 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().material = tagTextMaterial2; } else { tagText[i].transform.DOLocalMoveZ(0.003700018f, 0.5f); tagText[i].GetComponent().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; } } }