82 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			82 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			C#
		
	
	
	
using System.Collections;
 | 
						|
using System.Collections.Generic;
 | 
						|
using UnityEngine;
 | 
						|
using UnityEngine.UI;
 | 
						|
using TMPro;
 | 
						|
public class ChartManager : MonoBehaviour
 | 
						|
{
 | 
						|
    public GameObject 故障记录表;
 | 
						|
    //public TMP_Dropdown 地区;
 | 
						|
    public Dropdown 设备;
 | 
						|
    public Dropdown 详细缺陷;
 | 
						|
    public Dropdown 缺陷类型;
 | 
						|
    public GameObject content;
 | 
						|
    public List<string> 配电箱;
 | 
						|
    public List<string> 电线杆;
 | 
						|
    public List<string> 并网柜;
 | 
						|
    public List<string> 并网设备;
 | 
						|
    public List<string> 计量柜;
 | 
						|
    //public List<chartbase> chartbases = new List<chartbase>(); 
 | 
						|
    // Start is called before the first frame update
 | 
						|
    void Start()
 | 
						|
    {
 | 
						|
        设备.onValueChanged.AddListener(changedrop);
 | 
						|
        changedrop(1);
 | 
						|
    }
 | 
						|
 | 
						|
    // Update is called once per frame
 | 
						|
    void Update()
 | 
						|
    {
 | 
						|
        
 | 
						|
    }
 | 
						|
    public void 新增() {
 | 
						|
        var load = Resources.Load("Prefab/条目");
 | 
						|
        Debug.Log(load);
 | 
						|
        GameObject 条目 = Instantiate(load) as GameObject;
 | 
						|
        条目.transform.SetParent(content.transform);
 | 
						|
        条目.transform.localScale = new Vector3(1, 1, 1);
 | 
						|
        条目.transform.localPosition = new Vector3(0, 0, 0);
 | 
						|
        条目.transform.localEulerAngles = new Vector3(0, 0, 0);
 | 
						|
        //条目.GetComponent<chartbase>().地区.text = 地区.options[地区.value].text;
 | 
						|
        //条目.GetComponent<chartbase>().地区_value = 地区.value;
 | 
						|
        条目.GetComponent<chartbase>().设备.text = 设备.options[设备.value].text;
 | 
						|
        条目.GetComponent<chartbase>().设备_value = 设备.value;
 | 
						|
        条目.GetComponent<chartbase>().详细缺陷.text = 详细缺陷.options[详细缺陷.value].text;
 | 
						|
        条目.GetComponent<chartbase>().详细缺陷_value = 详细缺陷.value;
 | 
						|
        条目.GetComponent<chartbase>().缺陷类型.text = 缺陷类型.options[缺陷类型.value].text;
 | 
						|
        条目.GetComponent<chartbase>().缺陷类型_value = 缺陷类型.value;
 | 
						|
        //chartbases.Add(条目.GetComponent<chartbase>());
 | 
						|
    }
 | 
						|
    public void changedrop(int change) {
 | 
						|
 | 
						|
        详细缺陷.options.Clear();
 | 
						|
        switch (设备.options[设备.value].text)
 | 
						|
        {
 | 
						|
            case "配电箱":
 | 
						|
               
 | 
						|
 | 
						|
                    详细缺陷.AddOptions(配电箱);
 | 
						|
 | 
						|
                
 | 
						|
                break;
 | 
						|
            case "电线杆":
 | 
						|
                详细缺陷.AddOptions(电线杆);
 | 
						|
                break;
 | 
						|
            case "并网柜":
 | 
						|
                详细缺陷.AddOptions(并网柜);
 | 
						|
                break;
 | 
						|
            case "并网设备":
 | 
						|
                详细缺陷.AddOptions(并网设备);
 | 
						|
                break;
 | 
						|
            case "计量柜":
 | 
						|
                详细缺陷.AddOptions(计量柜);
 | 
						|
                break;
 | 
						|
        }
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
 | 
						|
    }
 | 
						|
}
 |